[Btrfs-devel] use for the flags section of dir_item
    Josef Bacik 
    jbacik at redhat.com
       
    Tue Sep 11 11:03:58 PDT 2007
    
    
  
Hello,
I don't need an "flags" type thing per se, I just think it would be useful to
have a nice small sub-identifier for the dir_item so I can quickly figure out
who the handler for the xattr I'm looking at is.  Currently for my listxattr
code, I do a search for type BTRFS_XATTR_ITEM_KEY and I get all of my xattr's
back.  Now because I abstracted out the the handling of each prefix ("user.",
"security." etc) i have a "list" function like ext3 et al has that just
bascially copies the information from the dir item into the buffer to return
back to user space.  This is why I originally didn't do the abstraction, because
I thought this approach was dumb since we always do the same thing, but
apparently it has its uses.  So when I pull out a dir item, I have to loop
through all of my known prefixes until I find the one it matches, and send it
off to the specific list handler to copy it into the buffer.  I can at this
point do one of two things
1) just not abstract out the list function.  I can't see anywhere where I would
want to do something differently, but again I may have missed something so I'd
like to know what other people think about this.
2) add a field that I can put the attr index for that particular attr, so when I
read it off the disk, i just do something like
struct xattr_handler *handler = btrfs_xattr_handler(btrfs_dir_item_ident(di));
instead of having to loop through all of my handlers for each xattr attached to
that inode.  Let me know what you think :),
Josef
    
    
More information about the Btrfs-devel
mailing list