aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Jansen <sensille@gmx.net>2011-05-28 16:58:38 -0400
committerChris Mason <chris.mason@oracle.com>2011-06-04 08:03:46 -0400
commite7786c3ae517b2c433edc91714e86be770e9f1ce (patch)
tree90caab3728a36a579162b4868f41fc3426c5cbb4
parenta4689d2bd3b00dcf5c4320f06e0ab88810fbff9c (diff)
btrfs: scrub: add explicit plugging
With the removal of the implicit plugging scrub ends up doing more and smaller I/O than necessary. This patch adds explicit plugging per chunk. Signed-off-by: Arne Jansen <sensille@gmx.net> Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r--fs/btrfs/scrub.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 2d1f8909a8e1..1204eab94028 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -348,9 +348,6 @@ static int scrub_fixup_io(int rw, struct block_device *bdev, sector_t sector,
348 int ret; 348 int ret;
349 DECLARE_COMPLETION_ONSTACK(complete); 349 DECLARE_COMPLETION_ONSTACK(complete);
350 350
351 /* we are going to wait on this IO */
352 rw |= REQ_SYNC;
353
354 bio = bio_alloc(GFP_NOFS, 1); 351 bio = bio_alloc(GFP_NOFS, 1);
355 bio->bi_bdev = bdev; 352 bio->bi_bdev = bdev;
356 bio->bi_sector = sector; 353 bio->bi_sector = sector;
@@ -359,6 +356,7 @@ static int scrub_fixup_io(int rw, struct block_device *bdev, sector_t sector,
359 bio->bi_private = &complete; 356 bio->bi_private = &complete;
360 submit_bio(rw, bio); 357 submit_bio(rw, bio);
361 358
359 /* this will also unplug the queue */
362 wait_for_completion(&complete); 360 wait_for_completion(&complete);
363 361
364 ret = !test_bit(BIO_UPTODATE, &bio->bi_flags); 362 ret = !test_bit(BIO_UPTODATE, &bio->bi_flags);
@@ -743,6 +741,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_dev *sdev,
743 struct btrfs_root *root = fs_info->extent_root; 741 struct btrfs_root *root = fs_info->extent_root;
744 struct btrfs_root *csum_root = fs_info->csum_root; 742 struct btrfs_root *csum_root = fs_info->csum_root;
745 struct btrfs_extent_item *extent; 743 struct btrfs_extent_item *extent;
744 struct blk_plug plug;
746 u64 flags; 745 u64 flags;
747 int ret; 746 int ret;
748 int slot; 747 int slot;
@@ -847,6 +846,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_dev *sdev,
847 * the scrub. This might currently (crc32) end up to be about 1MB 846 * the scrub. This might currently (crc32) end up to be about 1MB
848 */ 847 */
849 start_stripe = 0; 848 start_stripe = 0;
849 blk_start_plug(&plug);
850again: 850again:
851 logical = base + offset + start_stripe * increment; 851 logical = base + offset + start_stripe * increment;
852 for (i = start_stripe; i < nstripes; ++i) { 852 for (i = start_stripe; i < nstripes; ++i) {
@@ -988,6 +988,7 @@ next:
988 scrub_submit(sdev); 988 scrub_submit(sdev);
989 989
990out: 990out:
991 blk_finish_plug(&plug);
991 btrfs_free_path(path); 992 btrfs_free_path(path);
992 return ret < 0 ? ret : 0; 993 return ret < 0 ? ret : 0;
993} 994}