diff mbox series

[1/6] btrfs: remove BTRFS_MAP_DISCARD

Message ID 20230531041740.375963-2-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/6] btrfs: remove BTRFS_MAP_DISCARD | expand

Commit Message

Christoph Hellwig May 31, 2023, 4:17 a.m. UTC
BTRFS_MAP_DISCARD is never set, as REQ_OP_DISCARD is never passed to
btrfs_op() only only checked in two ASSERTS.

Remove it and let the catchall WARN_ON in btrfs_op() deal with accidental
REQ_OP_DISCARDs leaked into btrfs_op().

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/volumes.c | 3 ---
 fs/btrfs/volumes.h | 3 ---
 2 files changed, 6 deletions(-)

Comments

Qu Wenruo May 31, 2023, 8:45 a.m. UTC | #1
On 2023/5/31 12:17, Christoph Hellwig wrote:
> BTRFS_MAP_DISCARD is never set, as REQ_OP_DISCARD is never passed to
> btrfs_op() only only checked in two ASSERTS.
>
> Remove it and let the catchall WARN_ON in btrfs_op() deal with accidental
> REQ_OP_DISCARDs leaked into btrfs_op().
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

Thanks,
Qu
> ---
>   fs/btrfs/volumes.c | 3 ---
>   fs/btrfs/volumes.h | 3 ---
>   2 files changed, 6 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index a4bfec088617ec..c236bfba0cec3b 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -6182,8 +6182,6 @@ static u64 btrfs_max_io_len(struct map_lookup *map, enum btrfs_map_op op,
>   			    u64 offset, u32 *stripe_nr, u64 *stripe_offset,
>   			    u64 *full_stripe_start)
>   {
> -	ASSERT(op != BTRFS_MAP_DISCARD);
> -
>   	/*
>   	 * Stripe_nr is the stripe where this block falls.  stripe_offset is
>   	 * the offset of this block in its stripe.
> @@ -6261,7 +6259,6 @@ int __btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
>   	u64 max_len;
>
>   	ASSERT(bioc_ret);
> -	ASSERT(op != BTRFS_MAP_DISCARD);
>
>   	num_copies = btrfs_num_copies(fs_info, logical, fs_info->sectorsize);
>   	if (mirror_num > num_copies)
> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
> index 16fc640cabd3f7..e960a51abf873d 100644
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -556,15 +556,12 @@ struct btrfs_dev_lookup_args {
>   enum btrfs_map_op {
>   	BTRFS_MAP_READ,
>   	BTRFS_MAP_WRITE,
> -	BTRFS_MAP_DISCARD,
>   	BTRFS_MAP_GET_READ_MIRRORS,
>   };
>
>   static inline enum btrfs_map_op btrfs_op(struct bio *bio)
>   {
>   	switch (bio_op(bio)) {
> -	case REQ_OP_DISCARD:
> -		return BTRFS_MAP_DISCARD;
>   	case REQ_OP_WRITE:
>   	case REQ_OP_ZONE_APPEND:
>   		return BTRFS_MAP_WRITE;
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index a4bfec088617ec..c236bfba0cec3b 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -6182,8 +6182,6 @@  static u64 btrfs_max_io_len(struct map_lookup *map, enum btrfs_map_op op,
 			    u64 offset, u32 *stripe_nr, u64 *stripe_offset,
 			    u64 *full_stripe_start)
 {
-	ASSERT(op != BTRFS_MAP_DISCARD);
-
 	/*
 	 * Stripe_nr is the stripe where this block falls.  stripe_offset is
 	 * the offset of this block in its stripe.
@@ -6261,7 +6259,6 @@  int __btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
 	u64 max_len;
 
 	ASSERT(bioc_ret);
-	ASSERT(op != BTRFS_MAP_DISCARD);
 
 	num_copies = btrfs_num_copies(fs_info, logical, fs_info->sectorsize);
 	if (mirror_num > num_copies)
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 16fc640cabd3f7..e960a51abf873d 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -556,15 +556,12 @@  struct btrfs_dev_lookup_args {
 enum btrfs_map_op {
 	BTRFS_MAP_READ,
 	BTRFS_MAP_WRITE,
-	BTRFS_MAP_DISCARD,
 	BTRFS_MAP_GET_READ_MIRRORS,
 };
 
 static inline enum btrfs_map_op btrfs_op(struct bio *bio)
 {
 	switch (bio_op(bio)) {
-	case REQ_OP_DISCARD:
-		return BTRFS_MAP_DISCARD;
 	case REQ_OP_WRITE:
 	case REQ_OP_ZONE_APPEND:
 		return BTRFS_MAP_WRITE;