On Mon, 21 Apr 2008 19:46:41 +1000, Christoph Hellwig <hch@xxxxxxxxxxxxx>
wrote:
> +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.
There's already a "flags" field in xfs_da_args and only the low 16 bits
are currently used for attr operations.
We could use 5 of the high bits for these flags, or just add another
flags field (which are used for things other than lookup).
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html