[Btrfs-devel] [RFC] implement xattrs for btrfs

Chris Mason chris.mason at oracle.com
Tue Aug 28 13:35:45 PDT 2007


On Tue, 28 Aug 2007 16:04:11 -0400
Josef Bacik <jbacik at redhat.com> wrote:

> Hello,
> 
> This is my quick preview of what I'm doing so I can fix any of the
> major design flaws now.  For the most part, every filesystem
> implements different extended attribute handlers for each prefix, so
> ext3 has a different handler for "user.", "security.", "trusted."
> etc.  The problem with this is that none of the handlers seem to do
> anything different between each of the prefixes, you just get alot
> more code and abstraction than I think is necesary.  So the only
> thing I do is check to make sure the prefix is something that we
> support, and then handle everything the same way.  Is this a bad
> idea?  Let me know now so I can still change it :).  Right now
> setfatter and getfattr are the only things that work, so this is how
> I test it

Christoph replied here, I managed to talk someone else into xattrs in
my past filesystem lives, so I'll take his word for it.

> 
> setfattr -n "user.myname" -v "myvalue" /mnt/btrfs-test/default/blah
> getfattr -n "user.myname" /mnt/btrfs-test/default/blah 
> 
> which works fine.  I embed the value into the dir_item, I don't do
> any checking to make sure the insertion of the item went ok, I'll do
> that when I get the xattr handling all nailed down.  If the insertion
> fails b/c the dir_item is too big then ill just put the data in an
> inode there and set a flag on the dir_item so we know we have to look
> elsewhere for the xattr data.  Let me know what you think,

This is exactly what I was thinking of, but lets replace the flags
field in struct btrfs_dir_item with data_len, nobody is using the flags
right now, and I can't think of ways to use it in the future.

-chris



More information about the Btrfs-devel mailing list