[Btrfs-devel] list of things to do

Josef Bacik jwhiter at redhat.com
Tue Jul 3 18:00:05 PDT 2007


> Here are a few ideas of things that won't conflict too much with my
> current enospc work.  But, if you have other ideas or bits you would
> like to improve, please feel free to suggest them, I'm happy to get all
> the help I can.
> 
> 1) On fsync, ext3 and reiserfs have code to let more writers try and
> come into the current transaction before a commit is forced (this is
> called let_transaction_grow in reiserfs).  btrfs needs something
> similar.  It's fairly simple, you look at the count of procs currently
> in the transaction, and if it is non-zero you sleep for a bit before
> forcing the commit.
> 
> It's important to sleep without any locks held and without being in the
> transaction.  Once coded, you can benchmark with Ric Wheeler's fs_mark:
> 
> http://developer.osdl.org/dev/doubt/fs_mark/index.html
> 
> If you're comparing btrfs to ext3 on a sata or ide drive, make sure to
> mount ext3 with -o barrier=1
>

Ok I started looking into this, and I figured the best place to do this would be
in btrfs_commit_transaction, but it appears it already does something like this,
where we check trans->transaction->num_writers > 1, and if it is we declare a
watiqueue  and sleep for a bit, and keep doing this until we have only 1 or 0
writers.  So it appears you've already done this.  Now I'm getting ready for my
wedding so its entirely possible that I've lost my mind, and if so please let me
know :).  If it is the case that you've already done this then I will run the
fs_mark test to make sure everything is working well.
 
> 2) The in ram portion of the inode needs a field to indicate which
> transaction number last changed the inode.  This field can be checked by
> fsync to decide if a commit is actually required.
> 
> You would have to an index (use a radix tree) of the in memory
> transaction structs so that you can check to make sure a given
> transaction is actually done.
> 
> 3) struct btrfs_root_item has fields for block use accounting, but they
> currently don't get updated.  When blocks are allocated for a given
> root, we need to reflect that in struct btrfs_root_item and send it down
> to disk when the transaction commits.
> 
> The in memory struct btrfs_root has a duplicate of the root item, so the
> updates can be stored in the in memory version and then put into the
> tree once right before commit.
>

I will look into these other things as I get time, but you probably won't hear
anything out of me for about a week.  If you manage to do these yourself while
I'm out let me know and I'll start tackling things on the TODO list.  Thanks
much,

Josef 



More information about the Btrfs-devel mailing list