All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
To: David Sterba <dsterba@suse.com>
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	linux-btrfs@vger.kernel.org, Nikolay Borisov <nborisov@suse.com>,
	Naohiro Aota <Naohiro.Aota@wdc.com>
Subject: [PATCH 03/21] btrfs: zoned: sink zone check into btrfs_repair_one_zone
Date: Wed, 24 Nov 2021 01:30:29 -0800	[thread overview]
Message-ID: <8c38c2f9d1bee46ded4ec491e16398f2f5764200.1637745470.git.johannes.thumshirn@wdc.com> (raw)
In-Reply-To: <cover.1637745470.git.johannes.thumshirn@wdc.com>

Sink zone check into btrfs_repair_one_zone() so we don't need to do it in
all callers.

Also as btrfs_repair_one_zone() doesn't return a sensible error, just
make it a void function.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 fs/btrfs/extent_io.c |  3 +--
 fs/btrfs/scrub.c     |  4 ++--
 fs/btrfs/volumes.c   | 13 ++++++++-----
 fs/btrfs/volumes.h   |  2 +-
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 1654c611d2002..96c2e40887772 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2314,8 +2314,7 @@ static int repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
 	ASSERT(!(fs_info->sb->s_flags & SB_RDONLY));
 	BUG_ON(!mirror_num);
 
-	if (btrfs_is_zoned(fs_info))
-		return btrfs_repair_one_zone(fs_info, logical);
+	btrfs_repair_one_zone(fs_info, logical);
 
 	bio = btrfs_bio_alloc(1);
 	bio->bi_iter.bi_size = 0;
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index d175c5ab11349..30bb304bb5e9a 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -852,8 +852,8 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check)
 	have_csum = sblock_to_check->pagev[0]->have_csum;
 	dev = sblock_to_check->pagev[0]->dev;
 
-	if (btrfs_is_zoned(fs_info) && !sctx->is_dev_replace)
-		return btrfs_repair_one_zone(fs_info, logical);
+	if (!sctx->is_dev_replace)
+		btrfs_repair_one_zone(fs_info, logical);
 
 	/*
 	 * We must use GFP_NOFS because the scrub task might be waiting for a
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ae1a4f2a8af64..d0615256dacc3 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -8329,23 +8329,26 @@ static int relocating_repair_kthread(void *data)
 	return ret;
 }
 
-int btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical)
+void btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical)
 {
 	struct btrfs_block_group *cache;
 
+	if (!btrfs_is_zoned(fs_info))
+		return;
+
 	/* Do not attempt to repair in degraded state */
 	if (btrfs_test_opt(fs_info, DEGRADED))
-		return 0;
+		return;
 
 	cache = btrfs_lookup_block_group(fs_info, logical);
 	if (!cache)
-		return 0;
+		return;
 
 	spin_lock(&cache->lock);
 	if (cache->relocating_repair) {
 		spin_unlock(&cache->lock);
 		btrfs_put_block_group(cache);
-		return 0;
+		return;
 	}
 	cache->relocating_repair = 1;
 	spin_unlock(&cache->lock);
@@ -8353,5 +8356,5 @@ int btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical)
 	kthread_run(relocating_repair_kthread, cache,
 		    "btrfs-relocating-repair");
 
-	return 0;
+	return;
 }
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 3b81306807493..ab30cf4236fa3 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -637,6 +637,6 @@ enum btrfs_raid_types __attribute_const__ btrfs_bg_flags_to_raid_index(u64 flags
 int btrfs_bg_type_to_factor(u64 flags);
 const char *btrfs_bg_type_to_raid_name(u64 flags);
 int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info);
-int btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical);
+void btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical);
 
 #endif
-- 
2.31.1


  parent reply	other threads:[~2021-11-24  9:31 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24  9:30 [PATCH 00/21] btrfs: first batch of zoned cleanups Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 01/21] btrfs: zoned: encapsulate inode locking for zoned relocation Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 02/21] btrfs: zoned: simplify btrfs_check_meta_write_pointer Johannes Thumshirn
2021-11-24  9:30 ` Johannes Thumshirn [this message]
2021-11-24 16:28   ` [PATCH 03/21] btrfs: zoned: sink zone check into btrfs_repair_one_zone Josef Bacik
2021-11-24 17:29   ` David Sterba
2021-11-25  7:13     ` Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 04/21] btrfs: zoned: it's pointless to check for REQ_OP_ZONE_APPEND and btrfs_is_zoned Johannes Thumshirn
2021-11-24 17:33   ` David Sterba
2021-11-24  9:30 ` [PATCH 05/21] btrfs: zoned: move compatible fs flags check to zoned code Johannes Thumshirn
2021-11-24 17:36   ` David Sterba
2021-11-25 10:00     ` Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 06/21] btrfs: zoned: move mark_block_group_to_copy " Johannes Thumshirn
2021-11-24 17:48   ` David Sterba
2021-11-24  9:30 ` [PATCH 07/21] btrfs: zoned: move btrfs_finish_block_group_to_copy " Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 08/21] btrfs: zoned: move is_block_group_to_copy " Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 09/21] btrfs: zoned: skip zoned check if block_group is marked as copy Johannes Thumshirn
2021-11-29  8:18   ` [btrfs] a323b5f59e: xfstests.btrfs.167.fail kernel test robot
2021-11-29  8:18     ` kernel test robot
2021-11-24  9:30 ` [PATCH 10/21] btrfs: move struct scrub_ctx to scrub.h Johannes Thumshirn
2021-11-26 16:48   ` David Sterba
2021-11-24  9:30 ` [PATCH 11/21] btrfs: zoned: move fill_writer_pointer_gap to zoned code Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 12/21] btrfs: zoned: sync_write_pointer_for_zoned " Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 13/21] btrfs: make scrub_submit and scrub_wr_submit non-static Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 14/21] btrfs: zoned: move sync_replace_for_zoned to zoned code Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 15/21] btrfs: zoned: move finish_extent_writes_for_zoned " Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 16/21] btrfs: move btrfs_scrub_dev() definition to scrub.h Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 17/21] btrfs: move btrfs_scrub_pause() " Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 18/21] btrfs: move btrfs_scrub_continue() " Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 19/21] btrfs: move btrfs_scrub_cancel() " Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 20/21] btrfs: move btrfs_scrub_cancel_dev() " Johannes Thumshirn
2021-11-24  9:30 ` [PATCH 21/21] btrfs: move btrfs_scrub_progress() " Johannes Thumshirn
2021-11-24 16:34 ` [PATCH 00/21] btrfs: first batch of zoned cleanups Josef Bacik
2021-11-25  9:58   ` Johannes Thumshirn

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=8c38c2f9d1bee46ded4ec491e16398f2f5764200.1637745470.git.johannes.thumshirn@wdc.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=Naohiro.Aota@wdc.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.