From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Andreas Dilger <adilger@sun.com>
Cc: Theodore Tso <tytso@mit.edu>,
cmm@us.ibm.com, sandeen@redhat.com, linux-ext4@vger.kernel.org
Subject: Re: [PATCH -v2] ext4: Use inode preallocation with -o noextents
Date: Fri, 6 Jun 2008 00:42:51 +0530 [thread overview]
Message-ID: <20080605191251.GC4723@skywalker> (raw)
In-Reply-To: <20080605182830.GW2961@webber.adilger.int>
On Thu, Jun 05, 2008 at 12:28:30PM -0600, Andreas Dilger wrote:
> On Jun 05, 2008 11:37 -0400, Theodore Ts'o wrote:
> > This is better, but it still means that we are exporting a large
> > number of functions to the callers. It's not clear to me we need so
> > many different variants of ext4_new_blocks_* --- what is their
> > justification to exist?
> >
> > For example, why not just have:
> >
> > static ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode,
> > ext4_lblk_t iblock, ext4_fsblk_t goal,
> > unsigned long *count, int *errp, int meta)
> >
> > where if inode is NULL, then you're allocating a metadata block, and
> > if count is NULL, then you only want one block. Of course, this needs
> > to be carefully documented at the function.
>
> I don't necessarily agree that meta should be implied by inode != NULL.
> We do want to cluster metadata allocations for a single inode if possible,
> so keeping the inode information is useful. We may want to keep a separate
> "metadata goal block" from the "data goal block" in the inode...
>
> That said, it seems you still have a "meta" parameter here? I always hate
> having an int for a boolean, and we may as well make this a "flags" so
> that when we want to improve it later we don't need to rename it and change
> all of the "1" parameters to "EXT4_META_BLOCK". Do it right the first time.
>
how about ?
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index c6e6a6f..014e5b5 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -1928,9 +1928,11 @@ ext4_fsblk_t ext4_orlov_new_blocks(handle_t *handle, struct inode *inode,
return 0;
}
+#defin EXT4_META_BLOCK 0x1
+
static ext4_fsblk_t do_blk_alloc(handle_t *handle, struct inode *inode,
ext4_lblk_t iblock, ext4_fsblk_t goal,
- unsigned long *count, int *errp, int meta)
+ unsigned long *count, int *errp, int flags)
{
struct ext4_allocation_request ar;
ext4_fsblk_t ret;
@@ -1950,7 +1952,7 @@ static ext4_fsblk_t do_blk_alloc(handle_t *handle, struct inode *inode,
ar.goal = goal;
ar.len = *count;
ar.logical = iblock;
- if (S_ISREG(inode->i_mode) && !meta)
+ if (S_ISREG(inode->i_mode) && !(flags & EXT4_META_BLOCK))
ar.flags = EXT4_MB_HINT_DATA;
else
/* disable in-core preallocation for non-regular files */
@@ -1965,13 +1967,15 @@ ext4_fsblk_t ext4_new_meta_block(handle_t *handle, struct inode *inode,
ext4_fsblk_t goal, int *errp)
{
unsigned long count = 1;
- return do_blk_alloc(handle, inode, 0, goal, &count, errp, 1);
+ return do_blk_alloc(handle, inode, 0, goal, &count,
+ errp, EXT4_META_BLOCK);
}
ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode,
ext4_fsblk_t goal, unsigned long *count, int *errp)
{
- return do_blk_alloc(handle, inode, 0, goal, count, errp, 1);
+ return do_blk_alloc(handle, inode, 0, goal, count,
+ errp, EXT4_META_BLOCK);
}
ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode,
next prev parent reply other threads:[~2008-06-05 19:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-19 20:34 [PATCH -v2] ext4: Use inode preallocation with -o noextents Aneesh Kumar K.V
2008-06-04 2:23 ` Theodore Tso
2008-06-04 4:01 ` Aneesh Kumar K.V
2008-06-05 3:22 ` Theodore Tso
2008-06-05 8:43 ` Aneesh Kumar K.V
2008-06-05 14:55 ` Mingming Cao
2008-06-05 18:24 ` Andreas Dilger
2008-06-05 18:46 ` Aneesh Kumar K.V
2008-06-06 21:33 ` Mingming Cao
2008-06-11 3:26 ` Shen Feng
2008-06-12 9:34 ` Andreas Dilger
2008-06-12 13:41 ` Eric Sandeen
2008-06-11 3:44 ` Shen Feng
2008-06-16 3:41 ` Shen Feng
2008-06-17 9:42 ` Shen Feng
2008-06-17 10:48 ` Aneesh Kumar K.V
2008-06-18 1:43 ` Shen Feng
2008-06-05 15:37 ` Theodore Tso
2008-06-05 18:28 ` Andreas Dilger
2008-06-05 19:12 ` Aneesh Kumar K.V [this message]
2008-06-05 20:58 ` Andreas Dilger
2008-06-06 16:26 ` Aneesh Kumar K.V
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=20080605191251.GC4723@skywalker \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=adilger@sun.com \
--cc=cmm@us.ibm.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 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.