From: Christoph Hellwig <hch@infradead.org>
To: marcin.slusarz@gmail.com
Cc: LKML <linux-kernel@vger.kernel.org>,
Ben Fennema <bfennema@falcon.csc.calpoly.edu>,
Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH 3/7] udf: create common function for changing free space counter
Date: Mon, 7 Jan 2008 12:41:05 +0000 [thread overview]
Message-ID: <20080107124104.GE3710@infradead.org> (raw)
In-Reply-To: <1199582513-7915-3-git-send-email-marcin.slusarz@gmail.com>
On Sun, Jan 06, 2008 at 02:21:49AM +0100, marcin.slusarz@gmail.com wrote:
> +static inline bool udf_inc_free_space(struct udf_sb_info *sbi,
> + u16 partition, u32 cnt)
> +{
> + if (sbi->s_lvid_bh) {
> + struct logicalVolIntegrityDesc *lvid =
> + (struct logicalVolIntegrityDesc *)
> + sbi->s_lvid_bh->b_data;
> + lvid->freeSpaceTable[partition] =
> + cpu_to_le32(le32_to_cpu(
> + lvid->freeSpaceTable[partition]) + cnt);
> + }
> + return sbi->s_lvid_bh != NULL;
> +}
No need to mark helpers like this inline, the compiler will take care
of it if nessecary. Also I'd add an early return for the sbi->s_lvid_bh
case and a local variable for the freespace to make the function better
readable:
static bool udf_inc_free_space(struct udf_sb_info *sbi, u16 partition,
u32 cnt)
{
struct logicalVolIntegrityDesc *lvid;
if (!sbi->s_lvid_bh)
return 0;
lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data;
free = le32_to_cpu(lvid->freeSpaceTable[partition]) + cnt;
lvid->freeSpaceTable[partition] = cpu_to_le32(free);
return 1;
}
next prev parent reply other threads:[~2008-01-07 12:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-06 1:21 [PATCH 0/7] udf: more cleanups marcin.slusarz
2008-01-06 1:21 ` [PATCH 2/7] udf: create common function for tag checksumming marcin.slusarz
2008-01-07 12:29 ` Christoph Hellwig
2008-01-06 1:21 ` [PATCH 3/7] udf: create common function for changing free space counter marcin.slusarz
2008-01-07 12:41 ` Christoph Hellwig [this message]
2008-01-06 1:21 ` [PATCH 4/7] udf: replace loops coded with goto to real loops marcin.slusarz
2008-01-07 14:48 ` Jan Kara
2008-01-07 21:10 ` Marcin Slusarz
2008-01-08 10:17 ` Jan Kara
2008-01-08 18:29 ` Marcin Slusarz
2008-01-06 1:21 ` [PATCH 5/7] udf: convert byte order of constant instead of variable marcin.slusarz
2008-01-07 14:52 ` Jan Kara
2008-01-06 1:21 ` [PATCH 6/7] udf: remove UDF_I_* macros and open code them marcin.slusarz
2008-01-07 14:53 ` Jan Kara
2008-01-06 1:21 ` [PATCH 7/7] udf: cache struct udf_inode_info marcin.slusarz
2008-01-07 14:55 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080107124104.GE3710@infradead.org \
--to=hch@infradead.org \
--cc=bfennema@falcon.csc.calpoly.edu \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=marcin.slusarz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.