linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] btrfs: make fs_devices to be a local variable
@ 2018-07-10 10:27 Gu Jinxiang
  2018-07-10 10:27 ` [PATCH v2 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device Gu Jinxiang
  2018-07-10 10:27 ` [PATCH " Gu Jinxiang
  0 siblings, 2 replies; 6+ messages in thread
From: Gu Jinxiang @ 2018-07-10 10:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: nborisov

fs_devices is always passed to btrfs_scan_one_device which
overrides it. And in the call stack below fs_devices is passed to
btrfs_scan_one_device from btrfs_mount_root.
And in btrfs_mount_root the output fs_devices of this call stack
is not used.
btrfs_mount_root
	-> btrfs_parse_early_options
		->btrfs_scan_one_device
So, there is no necessary to pass fs_devices from btrfs_mount_root,
use a local variable in btrfs_parse_early_options is enough.

Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
---
changelog:

v2: deal with Nikolay's comment, make changelog more clair.

 fs/btrfs/super.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index bf546d6c286c..4ee082e96d51 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -886,11 +886,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
  * only when we need to allocate a new super block.
  */
 static int btrfs_parse_early_options(const char *options, fmode_t flags,
-		void *holder, struct btrfs_fs_devices **fs_devices)
+		void *holder)
 {
 	substring_t args[MAX_OPT_ARGS];
 	char *device_name, *opts, *orig, *p;
 	int error = 0;
+	struct btrfs_fs_devices *fs_devices = NULL;
 
 	if (!options)
 		return 0;
@@ -918,7 +919,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
 				goto out;
 			}
 			error = btrfs_scan_one_device(device_name,
-					flags, holder, fs_devices);
+					flags, holder, &fs_devices);
 			kfree(device_name);
 			if (error)
 				goto out;
@@ -1526,8 +1527,7 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type,
 	if (!(flags & SB_RDONLY))
 		mode |= FMODE_WRITE;
 
-	error = btrfs_parse_early_options(data, mode, fs_type,
-					  &fs_devices);
+	error = btrfs_parse_early_options(data, mode, fs_type);
 	if (error) {
 		return ERR_PTR(error);
 	}
-- 
2.17.1




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

* [PATCH v2 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device
  2018-07-10 10:27 [PATCH v2 1/2] btrfs: make fs_devices to be a local variable Gu Jinxiang
@ 2018-07-10 10:27 ` Gu Jinxiang
  2018-07-10 13:24   ` [PATCH] btrfs: fix ptr_ret.cocci warnings kbuild test robot
  2018-07-10 13:24   ` [PATCH v2 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device kbuild test robot
  2018-07-10 10:27 ` [PATCH " Gu Jinxiang
  1 sibling, 2 replies; 6+ messages in thread
From: Gu Jinxiang @ 2018-07-10 10:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: nborisov

Instead of pointer to btrfs_fs_devices as an arg in
btrfs_scan_one_device, better to make it as a return value.

Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
---

changelog:
v2: as comment by Nikolay, use ERR_CAST instead of cast type manually.

 fs/btrfs/super.c   | 29 ++++++++++++++++++-----------
 fs/btrfs/volumes.c | 14 +++++++-------
 fs/btrfs/volumes.h |  4 ++--
 3 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 4ee082e96d51..a5ddeb6836e3 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -918,11 +918,13 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
 				error = -ENOMEM;
 				goto out;
 			}
-			error = btrfs_scan_one_device(device_name,
-					flags, holder, &fs_devices);
+			fs_devices = btrfs_scan_one_device(device_name,
+					flags, holder);
 			kfree(device_name);
-			if (error)
+			if (IS_ERR(fs_devices)) {
+				error = PTR_ERR(fs_devices);
 				goto out;
+			}
 		}
 	}
 
@@ -1539,9 +1541,11 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type,
 			return ERR_PTR(error);
 	}
 
-	error = btrfs_scan_one_device(device_name, mode, fs_type, &fs_devices);
-	if (error)
+	fs_devices = btrfs_scan_one_device(device_name, mode, fs_type);
+	if (IS_ERR(fs_devices)) {
+		error = PTR_ERR(fs_devices);
 		goto error_sec_opts;
+	}
 
 	/*
 	 * Setup a dummy root and fs_info for test/set super.  This is because
@@ -2222,7 +2226,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
 				unsigned long arg)
 {
 	struct btrfs_ioctl_vol_args *vol;
-	struct btrfs_fs_devices *fs_devices;
+	struct btrfs_fs_devices *fs_devices = NULL;
 	int ret = -ENOTTY;
 
 	if (!capable(CAP_SYS_ADMIN))
@@ -2234,14 +2238,17 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
 
 	switch (cmd) {
 	case BTRFS_IOC_SCAN_DEV:
-		ret = btrfs_scan_one_device(vol->name, FMODE_READ,
-					    &btrfs_root_fs_type, &fs_devices);
+		fs_devices = btrfs_scan_one_device(vol->name, FMODE_READ,
+					    &btrfs_root_fs_type);
+		ret = IS_ERR(fs_devices) ? PTR_ERR(fs_devices) : 0;
 		break;
 	case BTRFS_IOC_DEVICES_READY:
-		ret = btrfs_scan_one_device(vol->name, FMODE_READ,
-					    &btrfs_root_fs_type, &fs_devices);
-		if (ret)
+		fs_devices = btrfs_scan_one_device(vol->name, FMODE_READ,
+					    &btrfs_root_fs_type);
+		if (IS_ERR(fs_devices)) {
+			ret = PTR_ERR(fs_devices);
 			break;
+		}
 		ret = !(fs_devices->num_devices == fs_devices->total_devices);
 		break;
 	case BTRFS_IOC_GET_SUPPORTED_FEATURES:
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index b33bf29130b6..ea1ca4da413d 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1215,14 +1215,14 @@ static int btrfs_read_disk_super(struct block_device *bdev, u64 bytenr,
  * and we are not allowed to call set_blocksize during the scan. The superblock
  * is read via pagecache
  */
-int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
-			  struct btrfs_fs_devices **fs_devices_ret)
+struct btrfs_fs_devices *btrfs_scan_one_device(const char *path, fmode_t flags,
+		void *holder)
 {
 	struct btrfs_super_block *disk_super;
 	struct btrfs_device *device;
 	struct block_device *bdev;
 	struct page *page;
-	int ret = 0;
+	struct btrfs_fs_devices *ret = NULL;
 	u64 bytenr;
 
 	/*
@@ -1236,19 +1236,19 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
 
 	bdev = blkdev_get_by_path(path, flags, holder);
 	if (IS_ERR(bdev))
-		return PTR_ERR(bdev);
+		return ERR_CAST(bdev);
 
 	if (btrfs_read_disk_super(bdev, bytenr, &page, &disk_super)) {
-		ret = -EINVAL;
+		ret = ERR_PTR(-EINVAL);
 		goto error_bdev_put;
 	}
 
 	mutex_lock(&uuid_mutex);
 	device = device_list_add(path, disk_super);
 	if (IS_ERR(device))
-		ret = PTR_ERR(device);
+		ret = ERR_CAST(device);
 	else
-		*fs_devices_ret = device->fs_devices;
+		ret = device->fs_devices;
 	mutex_unlock(&uuid_mutex);
 
 	btrfs_release_disk_super(page);
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 77e6004b6cb9..f867f07be963 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -406,8 +406,8 @@ blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
 			   int mirror_num, int async_submit);
 int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
 		       fmode_t flags, void *holder);
-int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
-			  struct btrfs_fs_devices **fs_devices_ret);
+struct btrfs_fs_devices *btrfs_scan_one_device(const char *path, fmode_t flags,
+		void *holder);
 int btrfs_close_devices(struct btrfs_fs_devices *fs_devices);
 void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices, int step);
 void btrfs_assign_next_active_device(struct btrfs_fs_info *fs_info,
-- 
2.17.1




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

* [PATCH 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device
  2018-07-10 10:27 [PATCH v2 1/2] btrfs: make fs_devices to be a local variable Gu Jinxiang
  2018-07-10 10:27 ` [PATCH v2 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device Gu Jinxiang
@ 2018-07-10 10:27 ` Gu Jinxiang
  2018-07-10 10:30   ` Gu, Jinxiang
  1 sibling, 1 reply; 6+ messages in thread
From: Gu Jinxiang @ 2018-07-10 10:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: nborisov

Instead of pointer to btrfs_fs_devices as an arg in
btrfs_scan_one_device, better to make it as a return value.

Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
---
 fs/btrfs/super.c   | 29 ++++++++++++++++++-----------
 fs/btrfs/volumes.c | 14 +++++++-------
 fs/btrfs/volumes.h |  4 ++--
 3 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 4ee082e96d51..a5ddeb6836e3 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -918,11 +918,13 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
 				error = -ENOMEM;
 				goto out;
 			}
-			error = btrfs_scan_one_device(device_name,
-					flags, holder, &fs_devices);
+			fs_devices = btrfs_scan_one_device(device_name,
+					flags, holder);
 			kfree(device_name);
-			if (error)
+			if (IS_ERR(fs_devices)) {
+				error = PTR_ERR(fs_devices);
 				goto out;
+			}
 		}
 	}
 
@@ -1539,9 +1541,11 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type,
 			return ERR_PTR(error);
 	}
 
-	error = btrfs_scan_one_device(device_name, mode, fs_type, &fs_devices);
-	if (error)
+	fs_devices = btrfs_scan_one_device(device_name, mode, fs_type);
+	if (IS_ERR(fs_devices)) {
+		error = PTR_ERR(fs_devices);
 		goto error_sec_opts;
+	}
 
 	/*
 	 * Setup a dummy root and fs_info for test/set super.  This is because
@@ -2222,7 +2226,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
 				unsigned long arg)
 {
 	struct btrfs_ioctl_vol_args *vol;
-	struct btrfs_fs_devices *fs_devices;
+	struct btrfs_fs_devices *fs_devices = NULL;
 	int ret = -ENOTTY;
 
 	if (!capable(CAP_SYS_ADMIN))
@@ -2234,14 +2238,17 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
 
 	switch (cmd) {
 	case BTRFS_IOC_SCAN_DEV:
-		ret = btrfs_scan_one_device(vol->name, FMODE_READ,
-					    &btrfs_root_fs_type, &fs_devices);
+		fs_devices = btrfs_scan_one_device(vol->name, FMODE_READ,
+					    &btrfs_root_fs_type);
+		ret = IS_ERR(fs_devices) ? PTR_ERR(fs_devices) : 0;
 		break;
 	case BTRFS_IOC_DEVICES_READY:
-		ret = btrfs_scan_one_device(vol->name, FMODE_READ,
-					    &btrfs_root_fs_type, &fs_devices);
-		if (ret)
+		fs_devices = btrfs_scan_one_device(vol->name, FMODE_READ,
+					    &btrfs_root_fs_type);
+		if (IS_ERR(fs_devices)) {
+			ret = PTR_ERR(fs_devices);
 			break;
+		}
 		ret = !(fs_devices->num_devices == fs_devices->total_devices);
 		break;
 	case BTRFS_IOC_GET_SUPPORTED_FEATURES:
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index b33bf29130b6..ea1ca4da413d 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1215,14 +1215,14 @@ static int btrfs_read_disk_super(struct block_device *bdev, u64 bytenr,
  * and we are not allowed to call set_blocksize during the scan. The superblock
  * is read via pagecache
  */
-int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
-			  struct btrfs_fs_devices **fs_devices_ret)
+struct btrfs_fs_devices *btrfs_scan_one_device(const char *path, fmode_t flags,
+		void *holder)
 {
 	struct btrfs_super_block *disk_super;
 	struct btrfs_device *device;
 	struct block_device *bdev;
 	struct page *page;
-	int ret = 0;
+	struct btrfs_fs_devices *ret = NULL;
 	u64 bytenr;
 
 	/*
@@ -1236,19 +1236,19 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
 
 	bdev = blkdev_get_by_path(path, flags, holder);
 	if (IS_ERR(bdev))
-		return PTR_ERR(bdev);
+		return ERR_CAST(bdev);
 
 	if (btrfs_read_disk_super(bdev, bytenr, &page, &disk_super)) {
-		ret = -EINVAL;
+		ret = ERR_PTR(-EINVAL);
 		goto error_bdev_put;
 	}
 
 	mutex_lock(&uuid_mutex);
 	device = device_list_add(path, disk_super);
 	if (IS_ERR(device))
-		ret = PTR_ERR(device);
+		ret = ERR_CAST(device);
 	else
-		*fs_devices_ret = device->fs_devices;
+		ret = device->fs_devices;
 	mutex_unlock(&uuid_mutex);
 
 	btrfs_release_disk_super(page);
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 77e6004b6cb9..f867f07be963 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -406,8 +406,8 @@ blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
 			   int mirror_num, int async_submit);
 int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
 		       fmode_t flags, void *holder);
-int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
-			  struct btrfs_fs_devices **fs_devices_ret);
+struct btrfs_fs_devices *btrfs_scan_one_device(const char *path, fmode_t flags,
+		void *holder);
 int btrfs_close_devices(struct btrfs_fs_devices *fs_devices);
 void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices, int step);
 void btrfs_assign_next_active_device(struct btrfs_fs_info *fs_info,
-- 
2.17.1




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

* RE: [PATCH 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device
  2018-07-10 10:27 ` [PATCH " Gu Jinxiang
@ 2018-07-10 10:30   ` Gu, Jinxiang
  0 siblings, 0 replies; 6+ messages in thread
From: Gu, Jinxiang @ 2018-07-10 10:30 UTC (permalink / raw)
  To: Gu, Jinxiang, linux-btrfs@vger.kernel.org; +Cc: nborisov@suse.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 5687 bytes --]

Duplicate one, please ignore this.

> -----Original Message-----
> From: linux-btrfs-owner@vger.kernel.org [mailto:linux-btrfs-owner@vger.kernel.org] On Behalf Of Gu Jinxiang
> Sent: Tuesday, July 10, 2018 6:27 PM
> To: linux-btrfs@vger.kernel.org
> Cc: nborisov@suse.com
> Subject: [PATCH 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device
> 
> Instead of pointer to btrfs_fs_devices as an arg in
> btrfs_scan_one_device, better to make it as a return value.
> 
> Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
> ---
>  fs/btrfs/super.c   | 29 ++++++++++++++++++-----------
>  fs/btrfs/volumes.c | 14 +++++++-------
>  fs/btrfs/volumes.h |  4 ++--
>  3 files changed, 27 insertions(+), 20 deletions(-)
> 
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 4ee082e96d51..a5ddeb6836e3 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -918,11 +918,13 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
>  				error = -ENOMEM;
>  				goto out;
>  			}
> -			error = btrfs_scan_one_device(device_name,
> -					flags, holder, &fs_devices);
> +			fs_devices = btrfs_scan_one_device(device_name,
> +					flags, holder);
>  			kfree(device_name);
> -			if (error)
> +			if (IS_ERR(fs_devices)) {
> +				error = PTR_ERR(fs_devices);
>  				goto out;
> +			}
>  		}
>  	}
> 
> @@ -1539,9 +1541,11 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type,
>  			return ERR_PTR(error);
>  	}
> 
> -	error = btrfs_scan_one_device(device_name, mode, fs_type, &fs_devices);
> -	if (error)
> +	fs_devices = btrfs_scan_one_device(device_name, mode, fs_type);
> +	if (IS_ERR(fs_devices)) {
> +		error = PTR_ERR(fs_devices);
>  		goto error_sec_opts;
> +	}
> 
>  	/*
>  	 * Setup a dummy root and fs_info for test/set super.  This is because
> @@ -2222,7 +2226,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
>  				unsigned long arg)
>  {
>  	struct btrfs_ioctl_vol_args *vol;
> -	struct btrfs_fs_devices *fs_devices;
> +	struct btrfs_fs_devices *fs_devices = NULL;
>  	int ret = -ENOTTY;
> 
>  	if (!capable(CAP_SYS_ADMIN))
> @@ -2234,14 +2238,17 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
> 
>  	switch (cmd) {
>  	case BTRFS_IOC_SCAN_DEV:
> -		ret = btrfs_scan_one_device(vol->name, FMODE_READ,
> -					    &btrfs_root_fs_type, &fs_devices);
> +		fs_devices = btrfs_scan_one_device(vol->name, FMODE_READ,
> +					    &btrfs_root_fs_type);
> +		ret = IS_ERR(fs_devices) ? PTR_ERR(fs_devices) : 0;
>  		break;
>  	case BTRFS_IOC_DEVICES_READY:
> -		ret = btrfs_scan_one_device(vol->name, FMODE_READ,
> -					    &btrfs_root_fs_type, &fs_devices);
> -		if (ret)
> +		fs_devices = btrfs_scan_one_device(vol->name, FMODE_READ,
> +					    &btrfs_root_fs_type);
> +		if (IS_ERR(fs_devices)) {
> +			ret = PTR_ERR(fs_devices);
>  			break;
> +		}
>  		ret = !(fs_devices->num_devices == fs_devices->total_devices);
>  		break;
>  	case BTRFS_IOC_GET_SUPPORTED_FEATURES:
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index b33bf29130b6..ea1ca4da413d 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -1215,14 +1215,14 @@ static int btrfs_read_disk_super(struct block_device *bdev, u64 bytenr,
>   * and we are not allowed to call set_blocksize during the scan. The superblock
>   * is read via pagecache
>   */
> -int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
> -			  struct btrfs_fs_devices **fs_devices_ret)
> +struct btrfs_fs_devices *btrfs_scan_one_device(const char *path, fmode_t flags,
> +		void *holder)
>  {
>  	struct btrfs_super_block *disk_super;
>  	struct btrfs_device *device;
>  	struct block_device *bdev;
>  	struct page *page;
> -	int ret = 0;
> +	struct btrfs_fs_devices *ret = NULL;
>  	u64 bytenr;
> 
>  	/*
> @@ -1236,19 +1236,19 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
> 
>  	bdev = blkdev_get_by_path(path, flags, holder);
>  	if (IS_ERR(bdev))
> -		return PTR_ERR(bdev);
> +		return ERR_CAST(bdev);
> 
>  	if (btrfs_read_disk_super(bdev, bytenr, &page, &disk_super)) {
> -		ret = -EINVAL;
> +		ret = ERR_PTR(-EINVAL);
>  		goto error_bdev_put;
>  	}
> 
>  	mutex_lock(&uuid_mutex);
>  	device = device_list_add(path, disk_super);
>  	if (IS_ERR(device))
> -		ret = PTR_ERR(device);
> +		ret = ERR_CAST(device);
>  	else
> -		*fs_devices_ret = device->fs_devices;
> +		ret = device->fs_devices;
>  	mutex_unlock(&uuid_mutex);
> 
>  	btrfs_release_disk_super(page);
> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
> index 77e6004b6cb9..f867f07be963 100644
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -406,8 +406,8 @@ blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
>  			   int mirror_num, int async_submit);
>  int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
>  		       fmode_t flags, void *holder);
> -int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
> -			  struct btrfs_fs_devices **fs_devices_ret);
> +struct btrfs_fs_devices *btrfs_scan_one_device(const char *path, fmode_t flags,
> +		void *holder);
>  int btrfs_close_devices(struct btrfs_fs_devices *fs_devices);
>  void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices, int step);
>  void btrfs_assign_next_active_device(struct btrfs_fs_info *fs_info,
> --
> 2.17.1
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±ý»k~ÏâžØ^n‡r¡ö¦zË\x1aëh™¨è­Ú&£ûàz¿äz¹Þ—ú+€Ê+zf£¢·hšˆ§~†­†Ûiÿÿïêÿ‘êçz_è®\x0fæj:+v‰¨þ)ߣøm

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

* [PATCH] btrfs: fix ptr_ret.cocci warnings
  2018-07-10 10:27 ` [PATCH v2 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device Gu Jinxiang
@ 2018-07-10 13:24   ` kbuild test robot
  2018-07-10 13:24   ` [PATCH v2 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device kbuild test robot
  1 sibling, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2018-07-10 13:24 UTC (permalink / raw)
  To: Gu Jinxiang; +Cc: kbuild-all, linux-btrfs, nborisov

From: kbuild test robot <fengguang.wu@intel.com>

fs/btrfs/super.c:2243:8-14: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 193ea416dc5e ("btrfs: get fs_devices pointer form btrfs_scan_one_device")
CC: Gu Jinxiang <gujx@cn.fujitsu.com>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
---

 super.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2240,7 +2240,7 @@ static long btrfs_control_ioctl(struct f
 	case BTRFS_IOC_SCAN_DEV:
 		fs_devices = btrfs_scan_one_device(vol->name, FMODE_READ,
 					    &btrfs_root_fs_type);
-		ret = IS_ERR(fs_devices) ? PTR_ERR(fs_devices) : 0;
+		ret = PTR_ERR_OR_ZERO(fs_devices);
 		break;
 	case BTRFS_IOC_DEVICES_READY:
 		fs_devices = btrfs_scan_one_device(vol->name, FMODE_READ,

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

* Re: [PATCH v2 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device
  2018-07-10 10:27 ` [PATCH v2 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device Gu Jinxiang
  2018-07-10 13:24   ` [PATCH] btrfs: fix ptr_ret.cocci warnings kbuild test robot
@ 2018-07-10 13:24   ` kbuild test robot
  1 sibling, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2018-07-10 13:24 UTC (permalink / raw)
  To: Gu Jinxiang; +Cc: kbuild-all, linux-btrfs, nborisov

Hi Gu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v4.18-rc4]
[cannot apply to btrfs/next next-20180709]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Gu-Jinxiang/btrfs-make-fs_devices-to-be-a-local-variable/20180710-191730


coccinelle warnings: (new ones prefixed by >>)

>> fs/btrfs/super.c:2243:8-14: WARNING: PTR_ERR_OR_ZERO can be used

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

end of thread, other threads:[~2018-07-10 13:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-10 10:27 [PATCH v2 1/2] btrfs: make fs_devices to be a local variable Gu Jinxiang
2018-07-10 10:27 ` [PATCH v2 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device Gu Jinxiang
2018-07-10 13:24   ` [PATCH] btrfs: fix ptr_ret.cocci warnings kbuild test robot
2018-07-10 13:24   ` [PATCH v2 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device kbuild test robot
2018-07-10 10:27 ` [PATCH " Gu Jinxiang
2018-07-10 10:30   ` Gu, Jinxiang

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