Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: [PATCH 1/6] btrfs: remove BTRFS_MAP_DISCARD
Date: Wed, 31 May 2023 06:17:34 +0200	[thread overview]
Message-ID: <20230531041740.375963-2-hch@lst.de> (raw)
In-Reply-To: <20230531041740.375963-1-hch@lst.de>

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(-)

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;
-- 
2.39.2


  reply	other threads:[~2023-05-31  4:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  4:17 cleanup the btrfs_map_block interface Christoph Hellwig
2023-05-31  4:17 ` Christoph Hellwig [this message]
2023-05-31  8:45   ` [PATCH 1/6] btrfs: remove BTRFS_MAP_DISCARD Qu Wenruo
2023-05-31  4:17 ` [PATCH 2/6] btrfs: optimize simple reads in btrfsic_map_block Christoph Hellwig
2023-05-31  8:47   ` Qu Wenruo
2023-05-31 12:31     ` Johannes Thumshirn
2023-05-31 12:35       ` Christoph Hellwig
2023-05-31 12:46         ` Johannes Thumshirn
2023-05-31  4:17 ` [PATCH 3/6] btrfs: remove btrfs_map_block Christoph Hellwig
2023-05-31  8:48   ` Qu Wenruo
2023-05-31  4:17 ` [PATCH 4/6] btrfs: rename __btrfs_map_block to btrfs_map_block Christoph Hellwig
2023-05-31  8:48   ` Qu Wenruo
2023-05-31  4:17 ` [PATCH 5/6] btrfs: remove btrfs_map_sblock Christoph Hellwig
2023-05-31  8:49   ` Qu Wenruo
2023-05-31  4:17 ` [PATCH 6/6] btrfs: remove need_full_stripe Christoph Hellwig
2023-05-31  8:52   ` Qu Wenruo
2023-05-31 12:37     ` Christoph Hellwig
2023-05-31 12:35 ` cleanup the btrfs_map_block interface Johannes Thumshirn
2023-05-31 23:38 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230531041740.375963-2-hch@lst.de \
    --to=hch@lst.de \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox