btrfs: Record error in btree_csum_one_bio()
PATCH 1/1 btrfs: Record error in btree_csum_one_bio()
Since commit 6dc4f100c175 ("block: allow bio_for_each_segment_all() to iterate over multi-page bvec"), break will only break the inner loop of bio_for_each_segment_all(), unable to break the outer loop.
This patch will break out by utilizing goto command.
--- fs/btrfs/disk-io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/disk-io.c +2 -1
@@ -840,9 +840,10 @@ static blk_status_t btree_csum_one_bio(struct bio *bio) root =BTRFS_I (bvec->bv_page->mapping->host)->root; ret =csum_dirty_buffer (root->fs_info, bvec->bv_page);if (ret) -break ; + goto out; } +out:return errno_to_blk_status (ret); }
Signature · 1 line
2.21.0
Quoted 16 lines · Qu Wenruo
Since commit
6dc4f100c175("block: allowbio_for_each_segment_all()to iterate over multi-page bvec"), break will only break the inner loop ofbio_for_each_segment_all(), unable to break the outer loop.This patch will break out by utilizing goto command.
Signed-off-by Qu Wenruo <[email protected]>--- fs/btrfs/disk-io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/btrfs/disk-io.c +0
-0
fs/btrfs/disk-io.c static blk_status_t btree_csum_one_bio(struct bio *bio) · line 843
Quoted 5 lines
fs/btrfs/disk-io.c +1
-1@@ -840,9 +840,10 @@ static blk_status_t btree_csum_one_bio(struct bio *bio) root =BTRFS_I (bvec->bv_page->mapping->host)->root; ret =csum_dirty_buffer (root->fs_info, bvec->bv_page);if (ret) -break ; + goto out;
This being fixed in the block layer macros, but note that 'break' is not the only thing that's broken, also 'continue' and we do have a few instances of that in btrfs code.
Once this is fixed in the macros, this patch is not necessary.