From: "Josef 'Jeff' Sipek" <jeffpc@josefsipek.net>
To: Barry Naujok <bnaujok@sgi.com>
Cc: xfs@oss.sgi.com, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 3/7] XFS: Refactor node format directory lookup/addname
Date: Wed, 2 Apr 2008 21:51:22 -0400 [thread overview]
Message-ID: <20080403015122.GE5211@josefsipek.net> (raw)
In-Reply-To: <20080402062708.380299192@chook.melbourne.sgi.com>
On Wed, Apr 02, 2008 at 04:25:11PM +1000, Barry Naujok wrote:
...
> --- kern_ci.orig/fs/xfs/xfs_dir2_node.c
> +++ kern_ci/fs/xfs/xfs_dir2_node.c
...
> @@ -432,27 +429,15 @@ xfs_dir2_leafn_lookup_int(
> /*
> * Do we have a buffer coming in?
> */
> - if (state->extravalid)
> - curbp = state->extrablk.bp;
> - else
> - curbp = NULL;
> + curbp = state->extravalid ? state->extrablk.bp : NULL;
> /*
> * For addname, it's a free block buffer, get the block number.
> */
> - if (args->addname) {
> - curfdb = curbp ? state->extrablk.blkno : -1;
> - curdb = -1;
> - length = xfs_dir2_data_entsize(args->namelen);
> - if ((free = (curbp ? curbp->data : NULL)))
> - ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC);
> - }
> - /*
> - * For others, it's a data block buffer, get the block number.
> - */
> - else {
> - curfdb = -1;
> - curdb = curbp ? state->extrablk.blkno : -1;
> - }
> + curfdb = curbp ? state->extrablk.blkno : -1;
> + free = curbp ? curbp->data : NULL;
The previous 3 lines can be cleaned up as:
if (state->extravalid)
curbp = state->extrablk.bp;
else
curbp = NULL;
if (curbp) {
curfdb = state->extrablk.blkno;
free = curbp->data;
} else {
curfdb = -1;
free = NULL;
}
or, if (state->extravalid && state->extrablk.bp == NULL) is _ALWAYS_ false
(which seems to be the case), you can do:
if (state->extravalid) {
curbp = state->extrablk.bp;
curfdb = state->extrablk.blkno;
free = curbp->data;
} else {
curbp = NULL;
curfdb = -1;
free = NULL;
}
...
> +static int
> +xfs_dir2_leafn_lookup_for_entry(
> + xfs_dabuf_t *bp, /* leaf buffer */
> + xfs_da_args_t *args, /* operation arguments */
> + int *indexp, /* out: leaf entry index */
> + xfs_da_state_t *state) /* state to fill in */
> +{
> + xfs_dabuf_t *curbp; /* current data/free buffer */
> + xfs_dir2_db_t curdb; /* current data block number */
> + xfs_dir2_data_entry_t *dep; /* data block entry */
> + xfs_inode_t *dp; /* incore directory inode */
> + int error; /* error return value */
> + int index; /* leaf entry index */
> + xfs_dir2_leaf_t *leaf; /* leaf structure */
> + xfs_dir2_leaf_entry_t *lep; /* leaf entry */
> + xfs_mount_t *mp; /* filesystem mount point */
> + xfs_dir2_db_t newdb; /* new data block number */
> + xfs_trans_t *tp; /* transaction pointer */
> + xfs_dacmp_t cmp; /* comparison result */
> + xfs_dabuf_t *ci_bp = NULL; /* buffer with CI match */
Did you try to check the stack usage (scripts/checkstack.pl)?
> + dp = args->dp;
> + tp = args->trans;
> + mp = dp->i_mount;
> + leaf = bp->data;
> + ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
> +#ifdef __KERNEL__
> + ASSERT(be16_to_cpu(leaf->hdr.count) > 0);
> +#endif
What's this #ifdef for?
> + dep = (xfs_dir2_data_entry_t *)((char *)curbp->data +
> + xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address)));
Perhaps a static inline to do this calculation more cleanly (assuming it's
done elsewhere as well).
...
> + /*
> + * Compare the entry, return it if it matches.
> + */
> + cmp = args->oknoent ?
> + xfs_dir_compname(dp, dep->name, dep->namelen,
> + args->name, args->namelen):
> + xfs_da_compname(dep->name, dep->namelen,
> + args->name, args->namelen);
same as comment for 1/7.
Josef 'Jeff' Sipek.
--
My public GPG key can be found at
http://www.josefsipek.net/gpg/public-0xC7958FFE.txt
next prev parent reply other threads:[~2008-04-03 1:52 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-02 6:25 [PATCH 0/7] XFS: case-insensitive lookup and Unicode support Barry Naujok
2008-04-02 6:25 ` [PATCH 1/7] XFS: Name operation vector for hash and compare Barry Naujok
2008-04-03 0:22 ` Josef 'Jeff' Sipek
2008-04-03 4:50 ` Barry Naujok
2008-04-03 1:29 ` David Chinner
2008-04-03 1:45 ` Barry Naujok
2008-04-03 22:51 ` Christoph Hellwig
2008-04-02 6:25 ` [PATCH 2/7] XFS: ASCII case-insensitive support Barry Naujok
2008-04-03 0:35 ` Josef 'Jeff' Sipek
2008-04-03 1:53 ` David Chinner
2008-04-03 17:09 ` Christoph Hellwig
2008-04-03 22:55 ` Christoph Hellwig
2008-04-02 6:25 ` [PATCH 3/7] XFS: Refactor node format directory lookup/addname Barry Naujok
2008-04-03 1:51 ` Josef 'Jeff' Sipek [this message]
2008-04-03 4:04 ` Barry Naujok
2008-04-03 4:10 ` Barry Naujok
2008-04-03 4:33 ` David Chinner
2008-04-02 6:25 ` [PATCH 4/7] XFS: Return case-insensitive match for dentry cache Barry Naujok
2008-04-03 2:34 ` Josef 'Jeff' Sipek
2008-04-03 5:22 ` David Chinner
2008-04-03 5:41 ` Stephen Rothwell
2008-04-03 14:56 ` Christoph Hellwig
2008-04-03 23:06 ` Christoph Hellwig
2008-04-02 6:25 ` [PATCH 5/7] XFS: Unicode case-insensitive lookup implementation Barry Naujok
2008-04-03 8:31 ` David Chinner
2008-04-17 5:38 ` Barry Naujok
2008-04-17 8:49 ` David Chinner
2008-04-03 17:14 ` Christoph Hellwig
2008-04-03 17:24 ` Jeremy Allison
2008-04-03 18:09 ` Josef 'Jeff' Sipek
2008-04-03 18:11 ` Eric Sandeen
2008-04-03 18:22 ` Jeremy Allison
2008-04-04 0:00 ` Mark Goodwin
2008-04-03 18:43 ` Christoph Hellwig
2008-04-03 18:47 ` Jeremy Allison
2008-04-03 18:55 ` Christoph Hellwig
2008-04-03 18:57 ` Christoph Hellwig
2008-04-03 22:34 ` Jeremy Allison
2008-04-03 22:20 ` David Chinner
2008-04-03 22:31 ` Christoph Hellwig
2008-04-03 23:00 ` Jamie Lokier
2008-04-02 6:25 ` [PATCH 6/7] XFS: Native Language Support for Unicode in XFS Barry Naujok
2008-04-04 0:05 ` David Chinner
2008-04-02 6:25 ` [PATCH 7/7] XFS: NLS config option Barry Naujok
2008-04-03 1:26 ` Josef 'Jeff' Sipek
2008-04-03 1:38 ` Barry Naujok
2008-04-08 11:45 ` [PATCH 0/7] XFS: case-insensitive lookup and Unicode support Christoph Hellwig
2008-04-09 1:53 ` Barry Naujok
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=20080403015122.GE5211@josefsipek.net \
--to=jeffpc@josefsipek.net \
--cc=bnaujok@sgi.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=xfs@oss.sgi.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 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).