All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove fsid argument from btrfs_sysfs_update_sprout_fsid
@ 2020-08-12 13:18 Nikolay Borisov
  2020-08-12 13:52 ` Josef Bacik
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Nikolay Borisov @ 2020-08-12 13:18 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

It can be accessed from 'fs_devices' as it's identical to
fs_info->fs_devices. Also add a comment about why we are calling the
function. No semantic changes.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/sysfs.c   | 6 +++---
 fs/btrfs/sysfs.h   | 3 +--
 fs/btrfs/volumes.c | 8 ++++++--
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 784a0f8a4cab..2d987b770a20 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -1322,8 +1322,8 @@ void btrfs_kobject_uevent(struct block_device *bdev, enum kobject_action action)
 			&disk_to_dev(bdev->bd_disk)->kobj);
 }
 
-void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices,
-				    const u8 *fsid)
+void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices)
+
 {
 	char fsid_buf[BTRFS_UUID_UNPARSED_SIZE];
 
@@ -1331,7 +1331,7 @@ void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices,
 	 * Sprouting changes fsid of the mounted filesystem, rename the fsid
 	 * directory
 	 */
-	snprintf(fsid_buf, BTRFS_UUID_UNPARSED_SIZE, "%pU", fsid);
+	snprintf(fsid_buf, BTRFS_UUID_UNPARSED_SIZE, "%pU", fs_devices->fsid);
 	if (kobject_rename(&fs_devices->fsid_kobj, fsid_buf))
 		btrfs_warn(fs_devices->fs_info,
 				"sysfs: failed to create fsid for sprout");
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h
index cf839c46a131..c9efa15f96e0 100644
--- a/fs/btrfs/sysfs.h
+++ b/fs/btrfs/sysfs.h
@@ -20,8 +20,7 @@ int btrfs_sysfs_remove_devices_dir(struct btrfs_fs_devices *fs_devices,
                 struct btrfs_device *one_device);
 int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs);
 void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs);
-void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices,
-				    const u8 *fsid);
+void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices);
 void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
 		u64 bit, enum btrfs_feature_set set);
 void btrfs_kobject_uevent(struct block_device *bdev, enum kobject_action action);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 4bae30b9c944..631cb03b3513 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2630,8 +2630,12 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
 			goto error_sysfs;
 		}
 
-		btrfs_sysfs_update_sprout_fsid(fs_devices,
-				fs_info->fs_devices->fsid);
+		/*
+		 * fs_devices now represents the newly sprouted filesystem and
+		 * its fsid has been changed by btrfs_prepare_sprout
+		 */
+		btrfs_sysfs_update_sprout_fsid(fs_devices);
+
 	}
 
 	ret = btrfs_commit_transaction(trans);
-- 
2.17.1


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

* Re: [PATCH] btrfs: remove fsid argument from btrfs_sysfs_update_sprout_fsid
  2020-08-12 13:18 [PATCH] btrfs: remove fsid argument from btrfs_sysfs_update_sprout_fsid Nikolay Borisov
@ 2020-08-12 13:52 ` Josef Bacik
  2020-08-12 14:37 ` Johannes Thumshirn
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Josef Bacik @ 2020-08-12 13:52 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs

On 8/12/20 9:18 AM, Nikolay Borisov wrote:
> It can be accessed from 'fs_devices' as it's identical to
> fs_info->fs_devices. Also add a comment about why we are calling the
> function. No semantic changes.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef

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

* Re: [PATCH] btrfs: remove fsid argument from btrfs_sysfs_update_sprout_fsid
  2020-08-12 13:18 [PATCH] btrfs: remove fsid argument from btrfs_sysfs_update_sprout_fsid Nikolay Borisov
  2020-08-12 13:52 ` Josef Bacik
@ 2020-08-12 14:37 ` Johannes Thumshirn
  2020-08-13 13:55 ` David Sterba
  2020-08-29 14:59 ` Anand Jain
  3 siblings, 0 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2020-08-12 14:37 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs

On 12/08/2020 15:19, Nikolay Borisov wrote:
> +void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices)
> +
>  {

Stray newline,

Otherwise 
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH] btrfs: remove fsid argument from btrfs_sysfs_update_sprout_fsid
  2020-08-12 13:18 [PATCH] btrfs: remove fsid argument from btrfs_sysfs_update_sprout_fsid Nikolay Borisov
  2020-08-12 13:52 ` Josef Bacik
  2020-08-12 14:37 ` Johannes Thumshirn
@ 2020-08-13 13:55 ` David Sterba
  2020-08-29 14:59 ` Anand Jain
  3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2020-08-13 13:55 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Wed, Aug 12, 2020 at 04:18:51PM +0300, Nikolay Borisov wrote:
> It can be accessed from 'fs_devices' as it's identical to
> fs_info->fs_devices. Also add a comment about why we are calling the
> function. No semantic changes.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Added to misc-next, thanks.

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

* Re: [PATCH] btrfs: remove fsid argument from btrfs_sysfs_update_sprout_fsid
  2020-08-12 13:18 [PATCH] btrfs: remove fsid argument from btrfs_sysfs_update_sprout_fsid Nikolay Borisov
                   ` (2 preceding siblings ...)
  2020-08-13 13:55 ` David Sterba
@ 2020-08-29 14:59 ` Anand Jain
  3 siblings, 0 replies; 5+ messages in thread
From: Anand Jain @ 2020-08-29 14:59 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs

On 12/8/20 9:18 pm, Nikolay Borisov wrote:
> It can be accessed from 'fs_devices' as it's identical to
> fs_info->fs_devices. Also add a comment about why we are calling the
> function. No semantic changes.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
>   fs/btrfs/sysfs.c   | 6 +++---
>   fs/btrfs/sysfs.h   | 3 +--
>   fs/btrfs/volumes.c | 8 ++++++--
>   3 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> index 784a0f8a4cab..2d987b770a20 100644
> --- a/fs/btrfs/sysfs.c
> +++ b/fs/btrfs/sysfs.c
> @@ -1322,8 +1322,8 @@ void btrfs_kobject_uevent(struct block_device *bdev, enum kobject_action action)
>   			&disk_to_dev(bdev->bd_disk)->kobj);
>   }
>   
> -void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices,
> -				    const u8 *fsid)
> +void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices)
> +
>   {
>   	char fsid_buf[BTRFS_UUID_UNPARSED_SIZE];
>   
> @@ -1331,7 +1331,7 @@ void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices,
>   	 * Sprouting changes fsid of the mounted filesystem, rename the fsid
>   	 * directory
>   	 */
> -	snprintf(fsid_buf, BTRFS_UUID_UNPARSED_SIZE, "%pU", fsid);
> +	snprintf(fsid_buf, BTRFS_UUID_UNPARSED_SIZE, "%pU", fs_devices->fsid);
>   	if (kobject_rename(&fs_devices->fsid_kobj, fsid_buf))
>   		btrfs_warn(fs_devices->fs_info,
>   				"sysfs: failed to create fsid for sprout");
> diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h
> index cf839c46a131..c9efa15f96e0 100644
> --- a/fs/btrfs/sysfs.h
> +++ b/fs/btrfs/sysfs.h
> @@ -20,8 +20,7 @@ int btrfs_sysfs_remove_devices_dir(struct btrfs_fs_devices *fs_devices,
>                   struct btrfs_device *one_device);
>   int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs);
>   void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs);
> -void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices,
> -				    const u8 *fsid);
> +void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices);
>   void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
>   		u64 bit, enum btrfs_feature_set set);
>   void btrfs_kobject_uevent(struct block_device *bdev, enum kobject_action action);
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 4bae30b9c944..631cb03b3513 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -2630,8 +2630,12 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
>   			goto error_sysfs;
>   		}
>   
> -		btrfs_sysfs_update_sprout_fsid(fs_devices,
> -				fs_info->fs_devices->fsid);
> +		/*
> +		 * fs_devices now represents the newly sprouted filesystem and
> +		 * its fsid has been changed by btrfs_prepare_sprout
> +		 */
> +		btrfs_sysfs_update_sprout_fsid(fs_devices);
> +
>   	}
>   
>   	ret = btrfs_commit_transaction(trans);
> 

Reviewed-by: Anand Jain <anand.jain@oracle.com>


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

end of thread, other threads:[~2020-08-29 14:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12 13:18 [PATCH] btrfs: remove fsid argument from btrfs_sysfs_update_sprout_fsid Nikolay Borisov
2020-08-12 13:52 ` Josef Bacik
2020-08-12 14:37 ` Johannes Thumshirn
2020-08-13 13:55 ` David Sterba
2020-08-29 14:59 ` Anand Jain

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.