From: Christoph Hellwig <hch@infradead.org>
To: Barry Naujok <bnaujok@sgi.com>
Cc: xfs@oss.sgi.com, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/4] XFS: Return case-insensitive match for dentry cache
Date: Mon, 21 Apr 2008 05:46:41 -0400 [thread overview]
Message-ID: <20080421094641.GA5191@infradead.org> (raw)
In-Reply-To: <20080421085947.GA10399@infradead.org>
> > +kmem_zone_t *xfs_name_zone;
>
> What about just using kmalloc here? We know the length of the name
> anyway, so there is no point of allocating the maximum possible size.
>
> > error = xfs_iget(dp->i_mount, NULL, inum, 0, 0, ipp, 0);
> > - if (error)
> > + if (error) {
> > + if (ci_match && *ci_match)
> > + xfs_name_free(name->name);
> > goto out;
> > + }
>
> All the allocation and freeing for ci_match looks odd and error prone
> to me. I think the low-level directory code should never allocate
> args->value unless it's explicitly asked for a CI match. That way
> there's only one place in xfs_ci_lookup to free it either.
Also the low-level name duplication code could be factored out a little
more ala:
/*
* If a case-insensitive match, allocate a buffer and copy the actual
* name into the buffer. Return it via args->value.
*/
void xfs_copy_ci_name(struct xfs_da_args *args, const char *name, int namelen)
{
if (args->return_ci_name && args->cmpresult == XFS_CMP_CASE) {
args->valuelen = namelen;
args->value = kmemdup(name, namelen, GFP_NOFS);
/* error handled in higher layers */
}
}
Instead of adding args->return_ci_name it might make sense to just
replace the last four chars there with an unsigned short lookup_flags
and just set bits in it.
next prev parent reply other threads:[~2008-04-21 9:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-21 8:31 [PATCH 0/4] XFS: case-insensitive lookup and Unicode support Barry Naujok
2008-04-21 8:31 ` [PATCH 1/4] XFS: Name operation vector for hash and compare Barry Naujok
2008-04-21 8:42 ` Christoph Hellwig
2008-04-21 8:31 ` [PATCH 2/4] XFS: Return case-insensitive match for dentry cache Barry Naujok
2008-04-21 8:59 ` Christoph Hellwig
2008-04-21 9:46 ` Christoph Hellwig [this message]
2008-04-22 3:54 ` Barry Naujok
2008-04-22 4:52 ` Christoph Hellwig
2008-04-21 21:13 ` David Chinner
2008-04-22 4:53 ` Christoph Hellwig
2008-04-22 2:07 ` Barry Naujok
2008-04-22 4:55 ` Christoph Hellwig
2008-04-21 8:31 ` [PATCH 3/4] XFS: ASCII case-insensitive support Barry Naujok
2008-04-21 9:03 ` Christoph Hellwig
2008-04-21 8:31 ` [PATCH 4/4] XFS: Unicode case-insensitive lookup implementation Barry Naujok
2008-04-21 9:15 ` Christoph Hellwig
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=20080421094641.GA5191@infradead.org \
--to=hch@infradead.org \
--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