[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871vho1y48.fsf@linux.vnet.ibm.com>
Date: Sun, 17 Jan 2010 22:12:47 +0530
From: "Aneesh Kumar K. V" <aneesh.kumar@...ux.vnet.ibm.com>
To: Eric Sandeen <sandeen@...hat.com>
Cc: "Theodore Ts'o" <tytso@....edu>,
Ext4 Developers List <linux-ext4@...r.kernel.org>,
Jiaying Zhang <jiayingz@...gle.com>
Subject: Re: [PATCH v4 1/3] ext4: mechanical change on dio get_block code in
prepare for it to be used by buffer write
On Sun, 17 Jan 2010 10:19:30 -0600, Eric Sandeen <sandeen@...hat.com> wrote:
> Aneesh Kumar K. V wrote:
>
> > How about
> >
> > EXT4_GET_BLOCKS_CREATE. Indicate we should do block
> > allocation. But that flag alone doesn't say whether we are suppose
> > to create init or uninit extent.
> >
> > EXT4_GET_BLOCKS_UNINIT_EXT -> Request the creation of uninit extent
> >
> > EXT4_GET_BLOCKS_CREATE_UNINIT_EXT -> EXT4_GET_BLOCKS_CREATE|EXT4_GET_BLOCKS_UNINIT_EXT;
> >
> > EXT4_GET_BLOCKS_DELALLOC_RESERVE -> Request for delayed allocaion
> > reservation
> >
> > EXT4_GET_BLOCKS_PRE_IO -> 0x0008 -> Indicate that we should do all
> > necessary extent split and make the requested range in to single extent.
> >
> > EXT4_GET_BLOCKS_CONVERT_IO -> Convert the specified range which should be a
> > single extent into init and then try to merge the extent to left/right
> >
> > EXT4_GET_BLOCKS_IO_CREATE_EXT -> EXT4_GET_BLOCKS_PRE_IO | EXT4_GET_BLOCKS_CREATE_UNINIT_EXT
> >
> > EXT4_GET_BLOCKS_IO_CONVERT_EXT -> EXT4_GET_BLOCKS_CREATE | EXT4_GET_BLOCKS_CONVERT_IO;
>
>
> In addition to Aneesh's suggestions, I'm not sure of the value of
> creating more
>
> #define FLAG_A = FLAG_B|FLAG_C
>
> flag macros; unless you have this all in your head you just have to
> go look up the flag definition anyway, since we usually test individual
> flags not the aggregates. I'm wondering if it might be better to just
> explicitly send in the OR'd flags rather than creating a new one, to
> see the code flow better.
>
> Maybe it saves space, but at the cost of easy understanding IMHO.
> At least that's been my experience.
It help us to do things like below
if (flag & FLAG_B)
/* we need to do things for flag B */
if (flag & FLAG_C)
/* things for flag C */
instead of
if ((flag & FLAG_A) || (flag & FLAG_D)
/* things related to previous flag B */
So it simplifies the if condition.
-aneesh
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists