lk: teach crfs_readdir about dirents with multiple items

Zach Brown zach.brown at oracle.com
Mon May 12 15:38:23 PDT 2008


Alex Chiang wrote:
> Teach crfs_readdir about dirents with multiple items.

This is a great start, thanks for working on this.
		
> +				done = filldir(dirent, ditem->name,
> +				          le16_to_cpu(ditem->name_len),
> +				          filp->f_pos,
> +				          le64_to_cpu(ditem->location.objectid),
> +				          crfs_filldir_type[ditem->type]);
> +
> +				if (!done)
> +					filp->f_pos++;

Hmm, do we want to be incrementing f_pos at each dirent in the item?  If
the user doesn't have enough room for all the dirents in the item then
we'll return from the syscall after having given them some of the items.
 Then they'll call back in with an f_pos that is roughly (objectid +
dirents).  That f_pos will be used as the objectid that they'll start
from, so they'll miss the rest of the dirents in the item they were in
and they'll miss dirents in the items of the objectids that they skipped.

So we need a reasonably clever way to encode objectid+direntoffset in
stupid old f_pos.  We should see how Chris is doing this in btrfs.

Family hate readdir().

- z



More information about the crfs-devel mailing list