diff mbox series

[2/2] btrfs: simplify the no-bioc fast path condition in btrfs_map_block

Message ID 20230627061324.85216-3-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/2] btrfs: be a bit more careful when setting mirror_num_ret in btrfs_map_block | expand

Commit Message

Christoph Hellwig June 27, 2023, 6:13 a.m. UTC
nr_alloc_stripes can't be one if we are writing to a replacement device,
as it is incremented for that case right above.  Remove the duplicate
checks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/volumes.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Qu Wenruo June 27, 2023, 6:26 a.m. UTC | #1
On 2023/6/27 14:13, Christoph Hellwig wrote:
> nr_alloc_stripes can't be one if we are writing to a replacement device,
> as it is incremented for that case right above.  Remove the duplicate
> checks.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   fs/btrfs/volumes.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 0d386ed44279ce..4907ed9809109d 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -6402,9 +6402,7 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
>   	 * I/O context structure.
>   	 */
>   	if (smap && num_alloc_stripes == 1 &&
> -	    !((map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) && mirror_num > 1) &&
> -	    (op == BTRFS_MAP_READ || !dev_replace_is_ongoing ||
> -	     !dev_replace->tgtdev)) {
> +	    !((map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) && mirror_num > 1)) {
>   		set_io_stripe(smap, map, stripe_index, stripe_offset, stripe_nr);
>   		if (mirror_num_ret)
>   			*mirror_num_ret = mirror_num;
Johannes Thumshirn June 27, 2023, 7:41 a.m. UTC | #2
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 0d386ed44279ce..4907ed9809109d 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -6402,9 +6402,7 @@  int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
 	 * I/O context structure.
 	 */
 	if (smap && num_alloc_stripes == 1 &&
-	    !((map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) && mirror_num > 1) &&
-	    (op == BTRFS_MAP_READ || !dev_replace_is_ongoing ||
-	     !dev_replace->tgtdev)) {
+	    !((map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) && mirror_num > 1)) {
 		set_io_stripe(smap, map, stripe_index, stripe_offset, stripe_nr);
 		if (mirror_num_ret)
 			*mirror_num_ret = mirror_num;