summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/raid56.c
diff options
context:
space:
mode:
authorLiu Bo <bo.liu@linux.alibaba.com>2018-03-21 21:20:11 -0400
committerDavid Sterba <dsterba@suse.com>2018-03-30 19:41:12 -0400
commit580c6efaf91f89fae1efda53892df41ae1e41559 (patch)
tree5daf8ab057f86ff3cd71254b3f7f525c5fab9c69 /fs/btrfs/raid56.c
parent8a5a916d9a35e13576d79cc16e24611821b13e34 (diff)
Btrfs: replace: cache rbio when rebuild data on missing device
Rebuild on missing device is as same as recover, after it's done, rbio has data which is consistent with on-disk data, so it can be cached to avoid further reads. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/raid56.c')
-rw-r--r--fs/btrfs/raid56.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 002bddc7fa09..c3a2bc8af675 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1987,7 +1987,13 @@ cleanup:
1987 kfree(pointers); 1987 kfree(pointers);
1988 1988
1989cleanup_io: 1989cleanup_io:
1990 if (rbio->operation == BTRFS_RBIO_READ_REBUILD) { 1990 /*
1991 * Similar to READ_REBUILD, REBUILD_MISSING at this point also has a
1992 * valid rbio which is consistent with ondisk content, thus such a
1993 * valid rbio can be cached to avoid further disk reads.
1994 */
1995 if (rbio->operation == BTRFS_RBIO_READ_REBUILD ||
1996 rbio->operation == BTRFS_RBIO_REBUILD_MISSING) {
1991 /* 1997 /*
1992 * - In case of two failures, where rbio->failb != -1: 1998 * - In case of two failures, where rbio->failb != -1:
1993 * 1999 *
@@ -2009,8 +2015,6 @@ cleanup_io:
2009 clear_bit(RBIO_CACHE_READY_BIT, &rbio->flags); 2015 clear_bit(RBIO_CACHE_READY_BIT, &rbio->flags);
2010 2016
2011 rbio_orig_end_io(rbio, err); 2017 rbio_orig_end_io(rbio, err);
2012 } else if (rbio->operation == BTRFS_RBIO_REBUILD_MISSING) {
2013 rbio_orig_end_io(rbio, err);
2014 } else if (err == BLK_STS_OK) { 2018 } else if (err == BLK_STS_OK) {
2015 rbio->faila = -1; 2019 rbio->faila = -1;
2016 rbio->failb = -1; 2020 rbio->failb = -1;