]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: don't allow WRITE_SYNC bios to starve out regular writes
authorChris Mason <chris.mason@oracle.com>
Tue, 9 Jun 2009 19:39:08 +0000 (15:39 -0400)
committerChris Mason <chris.mason@oracle.com>
Wed, 10 Jun 2009 15:29:49 +0000 (11:29 -0400)
commit5af10e7d446d28b40466021e3e8f55cbdf60698c
tree7d8f49716140738c1bdcb97978b06328dd148a7a
parenteeb15a4101e353ed68b4017a756c0690bfcd630d
Btrfs: don't allow WRITE_SYNC bios to starve out regular writes

Btrfs uses dedicated threads to submit bios when checksumming is on,
which allows us to make sure the threads dedicated to checksumming don't get
stuck waiting for requests.  For each btrfs device, there are
two lists of bios.  One list is for WRITE_SYNC bios and the other
is for regular priority bios.

The IO submission threads used to process all of the WRITE_SYNC bios first and
then switch to the regular bios.  This commit makes sure we don't completely
starve the regular bios by rotating between the two lists.

WRITE_SYNC bios are still favored 2:1 over the regular bios, and this tries
to run in batches to avoid seeking.  Benchmarking shows this eliminates
stalls during streaming buffered writes on both multi-device and
single device filesystems.

If the regular bios starve, the system can end up with a large amount of ram
pinned down in writeback pages.  If we are a little more fair between the two
classes, we're able to keep throughput up and make progress on the bulk of
our dirty ram.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/volumes.c