linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: raid56: remove unused BTRFS_RBIO_PARITY_SCRUB
@ 2023-06-28  8:11 Qu Wenruo
  2023-06-28  8:26 ` Christoph Hellwig
  2023-06-29 16:14 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Qu Wenruo @ 2023-06-28  8:11 UTC (permalink / raw)
  To: linux-btrfs

Commit aca43fe839e4 ("btrfs: remove unused raid56 functions which were
dedicated for scrub") removed the special handling of RAID56 scrub for
missing device.

As scrub goes full mirror_num based recovery, that means if it hits a
missing device in RAID56, it would just try the next mirror, which would
go through the BTRFS_RBIO_READ_REBUILD operation.

This means there is no longer any use of BTRFS_RBIO_PARITY_SCRUB
operation and we can safely remove it.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/raid56.c | 17 +++++------------
 fs/btrfs/raid56.h |  1 -
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index f37b925d587f..cf2c74ce76a9 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -584,8 +584,7 @@ static int rbio_can_merge(struct btrfs_raid_bio *last,
 	if (last->operation == BTRFS_RBIO_PARITY_SCRUB)
 		return 0;
 
-	if (last->operation == BTRFS_RBIO_REBUILD_MISSING ||
-	    last->operation == BTRFS_RBIO_READ_REBUILD)
+	if (last->operation == BTRFS_RBIO_READ_REBUILD)
 		return 0;
 
 	return 1;
@@ -784,10 +783,7 @@ static noinline void unlock_stripe(struct btrfs_raid_bio *rbio)
 			spin_unlock(&rbio->bio_list_lock);
 			spin_unlock(&h->lock);
 
-			if (next->operation == BTRFS_RBIO_READ_REBUILD)
-				start_async_work(next, recover_rbio_work_locked);
-			else if (next->operation == BTRFS_RBIO_REBUILD_MISSING) {
-				steal_rbio(rbio, next);
+			if (next->operation == BTRFS_RBIO_READ_REBUILD) {
 				start_async_work(next, recover_rbio_work_locked);
 			} else if (next->operation == BTRFS_RBIO_WRITE) {
 				steal_rbio(rbio, next);
@@ -1698,8 +1694,7 @@ static int verify_one_sector(struct btrfs_raid_bio *rbio,
 	 * If we're rebuilding a read, we have to use pages from the
 	 * bio list if possible.
 	 */
-	if ((rbio->operation == BTRFS_RBIO_READ_REBUILD ||
-	     rbio->operation == BTRFS_RBIO_REBUILD_MISSING)) {
+	if (rbio->operation == BTRFS_RBIO_READ_REBUILD) {
 		sector = sector_in_rbio(rbio, stripe_nr, sector_nr, 0);
 	} else {
 		sector = rbio_stripe_sector(rbio, stripe_nr, sector_nr);
@@ -1763,8 +1758,7 @@ static int recover_vertical(struct btrfs_raid_bio *rbio, int sector_nr,
 		 * If we're rebuilding a read, we have to use pages from the
 		 * bio list if possible.
 		 */
-		if ((rbio->operation == BTRFS_RBIO_READ_REBUILD ||
-		     rbio->operation == BTRFS_RBIO_REBUILD_MISSING)) {
+		if (rbio->operation == BTRFS_RBIO_READ_REBUILD) {
 			sector = sector_in_rbio(rbio, stripe_nr, sector_nr, 0);
 		} else {
 			sector = rbio_stripe_sector(rbio, stripe_nr, sector_nr);
@@ -1897,8 +1891,7 @@ static int recover_sectors(struct btrfs_raid_bio *rbio)
 		goto out;
 	}
 
-	if (rbio->operation == BTRFS_RBIO_READ_REBUILD ||
-	    rbio->operation == BTRFS_RBIO_REBUILD_MISSING) {
+	if (rbio->operation == BTRFS_RBIO_READ_REBUILD) {
 		spin_lock(&rbio->bio_list_lock);
 		set_bit(RBIO_RMW_LOCKED_BIT, &rbio->flags);
 		spin_unlock(&rbio->bio_list_lock);
diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
index 0e84c9c9293f..45e6ff78316f 100644
--- a/fs/btrfs/raid56.h
+++ b/fs/btrfs/raid56.h
@@ -14,7 +14,6 @@ enum btrfs_rbio_ops {
 	BTRFS_RBIO_WRITE,
 	BTRFS_RBIO_READ_REBUILD,
 	BTRFS_RBIO_PARITY_SCRUB,
-	BTRFS_RBIO_REBUILD_MISSING,
 };
 
 struct btrfs_raid_bio {
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: raid56: remove unused BTRFS_RBIO_PARITY_SCRUB
  2023-06-28  8:11 [PATCH] btrfs: raid56: remove unused BTRFS_RBIO_PARITY_SCRUB Qu Wenruo
@ 2023-06-28  8:26 ` Christoph Hellwig
  2023-06-29 16:14 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2023-06-28  8:26 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: raid56: remove unused BTRFS_RBIO_PARITY_SCRUB
  2023-06-28  8:11 [PATCH] btrfs: raid56: remove unused BTRFS_RBIO_PARITY_SCRUB Qu Wenruo
  2023-06-28  8:26 ` Christoph Hellwig
@ 2023-06-29 16:14 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2023-06-29 16:14 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

On Wed, Jun 28, 2023 at 04:11:15PM +0800, Qu Wenruo wrote:
> Commit aca43fe839e4 ("btrfs: remove unused raid56 functions which were
> dedicated for scrub") removed the special handling of RAID56 scrub for
> missing device.
> 
> As scrub goes full mirror_num based recovery, that means if it hits a
> missing device in RAID56, it would just try the next mirror, which would
> go through the BTRFS_RBIO_READ_REBUILD operation.
> 
> This means there is no longer any use of BTRFS_RBIO_PARITY_SCRUB
> operation and we can safely remove it.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Subject should say BTRFS_RBIO_REBUILD_MISSING, BTRFS_RBIO_PARITY_SCRUB
stays. Fixed and added to misc-next, thanks.

> --- a/fs/btrfs/raid56.h
> +++ b/fs/btrfs/raid56.h
> @@ -14,7 +14,6 @@ enum btrfs_rbio_ops {
>  	BTRFS_RBIO_WRITE,
>  	BTRFS_RBIO_READ_REBUILD,
>  	BTRFS_RBIO_PARITY_SCRUB,
> -	BTRFS_RBIO_REBUILD_MISSING,
>  };

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-29 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28  8:11 [PATCH] btrfs: raid56: remove unused BTRFS_RBIO_PARITY_SCRUB Qu Wenruo
2023-06-28  8:26 ` Christoph Hellwig
2023-06-29 16:14 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).