[Btrfs-devel] [RFC] wait for more writers to join the transaction

Josef Bacik jwhiter at redhat.com
Tue Aug 7 18:01:27 PDT 2007


On Tue, Aug 07, 2007 at 07:34:42PM -0400, Chris Mason wrote:
> On Tue, 7 Aug 2007 18:11:54 -0400
> Josef Bacik <jwhiter at redhat.com> wrote:
> 
> > Hello,
> > 
> > Sorry for my long silence, getting all situated took longer than I
> > expected.  I just wrote something very quickly to try and make btrfs
> > sleep longer if there were writers while we were sleeping during an
> > fsync.  Running the fs_mark test, btrfs by itself gets walloped by
> > ext3, so I'm ignoring that for now.  With btrfs+my patch we seem to
> > get about the same performance, except in the -S2 and -S5 cases,
> > which are
> 
> fs_mark can test lots of different things.  In the multi-threaded
> tests, the big fat fs_mutex in btrfs is going to hurt us quite a lot,
> so that part isn't horribly surprising (this is very high on my list to
> fix).
> 
> How did you mount ext3?  If you're running on sata or IDE drives, make
> sure to use mount -o barrier=1.  btrfs does write barriers by default,
> so to be fair you have to turn them on in ext3 as well.
> 

Yeah I mounted with barrier=1 and ran single threaded tests to try and make
everything as even as possible.

> > 
> >  Sync method: SYSTEM SYNC/SINGLE FSYNC: Issue sync() after main write
> > loop and 1 file fsync() per subdirectory
> 
> I would just use the default sync method.  ext3 has some code to
> basically make the fsync a noop if the transaction that changed the
> file last is already committed.  This would be the next thing I ask you
> to add to btrfs ;)
> 

Hehe ok I will run the default test and add this feature to my todo list.

> >  	}
> > -	while (trans->transaction->num_writers > 1) {
> > +	while (trans->transaction->num_writers > 1 ||
> > +		trans->transaction->writers_while_asleep > 0) {
> > +
> >  		WARN_ON(cur_trans != trans->transaction);
> > +		
> >  		prepare_to_wait(&trans->transaction->writer_wait,
> > &wait, TASK_UNINTERRUPTIBLE);
> >  		if (trans->transaction->num_writers <= 1)
> >  			break;
> 
> I think you need the writers_while_asleep check here too (before the
> break).
>

Yeah my logic is a little flawed in a few other places too I will rework this,
but glad the overall approach is acceptable.  Thanks much for your feedback,

Josef 



More information about the Btrfs-devel mailing list