Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7786c3a authored by Arne Jansen's avatar Arne Jansen Committed by Chris Mason
Browse files

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: default avatarArne Jansen <sensille@gmx.net>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent a4689d2b
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -348,9 +348,6 @@ static int scrub_fixup_io(int rw, struct block_device *bdev, sector_t sector,
	int ret;
	DECLARE_COMPLETION_ONSTACK(complete);

	/* we are going to wait on this IO */
	rw |= REQ_SYNC;

	bio = bio_alloc(GFP_NOFS, 1);
	bio->bi_bdev = bdev;
	bio->bi_sector = sector;
@@ -359,6 +356,7 @@ static int scrub_fixup_io(int rw, struct block_device *bdev, sector_t sector,
	bio->bi_private = &complete;
	submit_bio(rw, bio);

	/* this will also unplug the queue */
	wait_for_completion(&complete);

	ret = !test_bit(BIO_UPTODATE, &bio->bi_flags);
@@ -743,6 +741,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_dev *sdev,
	struct btrfs_root *root = fs_info->extent_root;
	struct btrfs_root *csum_root = fs_info->csum_root;
	struct btrfs_extent_item *extent;
	struct blk_plug plug;
	u64 flags;
	int ret;
	int slot;
@@ -847,6 +846,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_dev *sdev,
	 * the scrub. This might currently (crc32) end up to be about 1MB
	 */
	start_stripe = 0;
	blk_start_plug(&plug);
again:
	logical = base + offset + start_stripe * increment;
	for (i = start_stripe; i < nstripes; ++i) {
@@ -988,6 +988,7 @@ next:
	scrub_submit(sdev);

out:
	blk_finish_plug(&plug);
	btrfs_free_path(path);
	return ret < 0 ? ret : 0;
}