[Btrfs-devel] Next things to work on

Chris Mason chris.mason at oracle.com
Tue Aug 14 17:23:29 PDT 2007

On Tue, 14 Aug 2007 11:44:37 -0400
Josef Bacik <jbacik at redhat.com> wrote:

> Hello,
> I assume the block stuff I sent is OK so I'm going to start working
> on xattrs, unless there are any objections?  Want to make sure since
> I have a tendancy to step on your toes Chris :).

Hi, sorry for the delay.  The top of my list right now is real tree
locking, so xattrs won't cause too many problems.  Your accounting
stuff looks pretty good to me, but we need some btrfsctl command or
sysfs code (sysfs would be better) to spit out information about

Xattrs are a fairly good sized chunk of work, as long as you don't mind
having to go through a few iterations I'd be thrilled to see someone do

Basically I would start with small xattrs that fit inside a tree
block.  The idea is to put these small xattrs inside directory
items (similar to how we pack file bodies inside extents).  But, you'll
need a new key type because directories already have directory items.
In ctree.h you'll find:

#define BTRFS_INODE_ITEM_KEY            1

/* reserve 2-15 close to the inode for later flexibility */

We want the xattrs right after the inode on disk, so use key type 2.

You'll have to refactor the directory code a little so you can reuse it
to store the xattrs.  directory items have a flags field and a type
field.  The type field stores things used by readdir, but the flags
field is currently unused.

For large xattrs the dir items would point to a key, which is just a
regularly allocated inode.  But you can get there later.


More information about the Btrfs-devel mailing list