diff mbox series

btrfs: move comment to the related code

Message ID b186e39f1c4bd938270918ff0411f9c8ba6e8934.1679571105.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs: move comment to the related code | expand

Commit Message

Anand Jain March 23, 2023, 11:32 a.m. UTC
Commit 12659251ca5d  ("btrfs: implement log-structured superblock for ZONED
mode") moved only the code but not its related comment. Move to the comment
code where it makes sense.

(no functional change).

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/volumes.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Neal Gompa March 23, 2023, 11:45 a.m. UTC | #1
On Thu, Mar 23, 2023 at 7:40 AM Anand Jain <anand.jain@oracle.com> wrote:
>
> Commit 12659251ca5d  ("btrfs: implement log-structured superblock for ZONED
> mode") moved only the code but not its related comment. Move to the comment
> code where it makes sense.
>
> (no functional change).
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  fs/btrfs/volumes.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index cc1871767c8c..e04b10a73d3b 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -1360,13 +1360,6 @@ struct btrfs_device *btrfs_scan_one_device(const char *path, fmode_t flags,
>
>         lockdep_assert_held(&uuid_mutex);
>
> -       /*
> -        * we would like to check all the supers, but that would make
> -        * a btrfs mount succeed after a mkfs from a different FS.
> -        * So, we need to add a special mount option to scan for
> -        * later supers, using BTRFS_SUPER_MIRROR_MAX instead
> -        */
> -
>         /*
>          * Avoid using flag |= FMODE_EXCL here, as the systemd-udev may
>          * initiate the device scan which may race with the user's mount
> @@ -1381,6 +1374,12 @@ struct btrfs_device *btrfs_scan_one_device(const char *path, fmode_t flags,
>         if (IS_ERR(bdev))
>                 return ERR_CAST(bdev);
>
> +       /*
> +        * We would like to check all the supers, but that would make
> +        * a btrfs mount succeed after a mkfs from a different FS.
> +        * So, we need to add a special mount option to scan for
> +        * later supers, using BTRFS_SUPER_MIRROR_MAX instead
> +        */
>         bytenr_orig = btrfs_sb_offset(0);
>         ret = btrfs_sb_log_location_bdev(bdev, 0, READ, &bytenr);
>         if (ret) {
> --
> 2.38.1
>

Reviewed-by: Neal Gompa <neal@gompa.dev>
David Sterba March 23, 2023, 6:44 p.m. UTC | #2
On Thu, Mar 23, 2023 at 07:32:16PM +0800, Anand Jain wrote:
> Commit 12659251ca5d  ("btrfs: implement log-structured superblock for ZONED
> mode") moved only the code but not its related comment. Move to the comment
> code where it makes sense.
> 
> (no functional change).
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  fs/btrfs/volumes.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index cc1871767c8c..e04b10a73d3b 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -1360,13 +1360,6 @@ struct btrfs_device *btrfs_scan_one_device(const char *path, fmode_t flags,
>  
>  	lockdep_assert_held(&uuid_mutex);
>  
> -	/*
> -	 * we would like to check all the supers, but that would make
> -	 * a btrfs mount succeed after a mkfs from a different FS.
> -	 * So, we need to add a special mount option to scan for
> -	 * later supers, using BTRFS_SUPER_MIRROR_MAX instead
> -	 */
> -
>  	/*
>  	 * Avoid using flag |= FMODE_EXCL here, as the systemd-udev may
>  	 * initiate the device scan which may race with the user's mount
> @@ -1381,6 +1374,12 @@ struct btrfs_device *btrfs_scan_one_device(const char *path, fmode_t flags,
>  	if (IS_ERR(bdev))
>  		return ERR_CAST(bdev);
>  
> +	/*
> +	 * We would like to check all the supers, but that would make
> +	 * a btrfs mount succeed after a mkfs from a different FS.
> +	 * So, we need to add a special mount option to scan for
> +	 * later supers, using BTRFS_SUPER_MIRROR_MAX instead
> +	 */

The comment should not be even here, it got stale during the zonded code
updates. It's supposed to be in btrfs_read_dev_super where it explains
why only the one loop is done, the comment is there but not properly
formatted.
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index cc1871767c8c..e04b10a73d3b 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1360,13 +1360,6 @@  struct btrfs_device *btrfs_scan_one_device(const char *path, fmode_t flags,
 
 	lockdep_assert_held(&uuid_mutex);
 
-	/*
-	 * we would like to check all the supers, but that would make
-	 * a btrfs mount succeed after a mkfs from a different FS.
-	 * So, we need to add a special mount option to scan for
-	 * later supers, using BTRFS_SUPER_MIRROR_MAX instead
-	 */
-
 	/*
 	 * Avoid using flag |= FMODE_EXCL here, as the systemd-udev may
 	 * initiate the device scan which may race with the user's mount
@@ -1381,6 +1374,12 @@  struct btrfs_device *btrfs_scan_one_device(const char *path, fmode_t flags,
 	if (IS_ERR(bdev))
 		return ERR_CAST(bdev);
 
+	/*
+	 * We would like to check all the supers, but that would make
+	 * a btrfs mount succeed after a mkfs from a different FS.
+	 * So, we need to add a special mount option to scan for
+	 * later supers, using BTRFS_SUPER_MIRROR_MAX instead
+	 */
 	bytenr_orig = btrfs_sb_offset(0);
 	ret = btrfs_sb_log_location_bdev(bdev, 0, READ, &bytenr);
 	if (ret) {