btrfs: remove unused BTRFS_MAP_DISCARD
authorChristoph Hellwig <hch@lst.de>
Wed, 31 May 2023 04:17:34 +0000 (06:17 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2023 11:59:33 +0000 (13:59 +0200)
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(). Last use was in a4012f06f188
("btrfs: split discard handling out of btrfs_map_block").

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c
fs/btrfs/volumes.h

index a4bfec0..c236bfb 100644 (file)
@@ -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)
index 16fc640..e960a51 100644 (file)
@@ -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;