linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K. V" <aneesh.kumar@linux.vnet.ibm.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>,
	Jiaying Zhang <jiayingz@google.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
Date: Sun, 17 Jan 2010 22:12:47 +0530	[thread overview]
Message-ID: <871vho1y48.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <4B533892.5040900@redhat.com>

On Sun, 17 Jan 2010 10:19:30 -0600, Eric Sandeen <sandeen@redhat.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

  reply	other threads:[~2010-01-17 16:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-15 19:30 [PATCH v4 0/3] dioread_nolock patch Theodore Ts'o
2010-01-15 19:30 ` [PATCH v4 1/3] ext4: mechanical change on dio get_block code in prepare for it to be used by buffer write Theodore Ts'o
2010-01-17 14:36   ` Aneesh Kumar K. V
2010-01-17 16:19     ` Eric Sandeen
2010-01-17 16:42       ` Aneesh Kumar K. V [this message]
2010-01-18  3:57       ` tytso
2010-01-15 19:30 ` [PATCH v4 2/3] ext4: use ext4_get_block_write in " Theodore Ts'o
2010-01-16  2:17   ` tytso
2010-01-17 14:21   ` Aneesh Kumar K. V
2010-01-18  5:25     ` Jiaying Zhang
2010-01-15 19:30 ` [PATCH v4 3/3] ext4: Use direct_IO_no_locking in ext4 dio read Theodore Ts'o
2010-01-17 14:19   ` Aneesh Kumar K. V
2010-01-15 19:39 ` [PATCH v4 0/3] dioread_nolock patch Ric Wheeler
2010-01-15 19:52 ` Eric Sandeen
2010-01-15 20:15   ` tytso
2010-01-15 20:17     ` Eric Sandeen
2010-01-15 21:47       ` Michael Rubin
2010-01-22 20:47         ` Valerie Aurora
2010-02-20  0:56           ` Michael Rubin
2010-02-23  0:36             ` Andreas Dilger
2010-02-16 21:07 ` Darrick J. Wong
2010-02-17 19:34   ` Jiaying Zhang
2010-02-19 21:25     ` Darrick J. Wong

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=871vho1y48.fsf@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=jiayingz@google.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=tytso@mit.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).