[Btrfs-devel] xattr design thoughts

Josef Bacik jbacik at redhat.com
Tue Oct 16 07:45:08 PDT 2007


On Tue, Oct 16, 2007 at 10:47:30AM -0400, Chris Mason wrote:
> On Tue, 2007-10-16 at 10:26 -0400, Josef Bacik wrote:
> > Hello,
> > 
> > Now that I actually understand whats going on with the generic xattr handling
> > stuff, I've rethought how to do xattrs.  Currently each individual xattr for a
> > particular inode has its own item, or if its too large its own inode.  So if I
> > create file blah and then add "security.mysec", "user.stuff", "trusted.whatever"
> > to blah, there will be 3 dir_item's, one for each xattr.  I was trying to figure
> > out why ext3 wasn't storing the prefix on disk with the xattr and I figured it
> > out, it has its own little object for holding xattrs for the inode.  So instead
> > of having 3 different locations for its xattrs, it has one big chunk that it
> > uses for its xattrs.  So this is what I was thinking of doing, having a xattr
> > disk structure that holds the name, the index (for looking up the
> > prefix/handler), and the value.  Then we only use one dir_item per inode for
> > xattrs, and just pack in new entries as they come along, and then once we
> > outgrow the dir_item just move it all into an inode.  Let me know what you guys
> > think about this.  Thank you,
> 
> For the common case where we have a really small number of xattrs on an
> inode, I doubt it makes a huge difference either way.  The dir items
> should be cheap enough that you can create one dir item per xattr
> without much pain, and I prefer that approach over one blob.
> 
> The problem with the blob is that the performance of the xattrs as a
> whole is dependent on your largest xattr.  With the one dir item per
> xattr, the btree takes care of all of that nonsense for you.
> 

Awesome works for me

/me breathes a sigh of relief :)

Josef



More information about the Btrfs-devel mailing list