All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: ioctl: resize: Only how new size if size changed
@ 2020-02-11 13:55 Marcos Paulo de Souza
  2020-02-11 18:30 ` Johannes Thumshirn
  2020-02-11 19:34 ` David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Marcos Paulo de Souza @ 2020-02-11 13:55 UTC (permalink / raw)
  To: linux-btrfs, dsterba, nborisov, wqu; +Cc: Marcos Paulo de Souza

There is no point to inform the user about "new size" if didn't changed
at all.

Signed-off-by: Marcos Paulo de Souza <marcos@mpdesouza.com>
---
 fs/btrfs/ioctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index be5350582955..fa31a8021d24 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1712,9 +1712,6 @@ static noinline int btrfs_ioctl_resize(struct file *file,
 
 	new_size = round_down(new_size, fs_info->sectorsize);
 
-	btrfs_info_in_rcu(fs_info, "new size for %s is %llu",
-			  rcu_str_deref(device->name), new_size);
-
 	if (new_size > old_size) {
 		trans = btrfs_start_transaction(root, 0);
 		if (IS_ERR(trans)) {
@@ -1727,6 +1724,9 @@ static noinline int btrfs_ioctl_resize(struct file *file,
 		ret = btrfs_shrink_device(device, new_size);
 	} /* equal, nothing need to do */
 
+	if (ret == 0 && new_size != old_size)
+		btrfs_info_in_rcu(fs_info, "new size for %s is %llu",
+			  rcu_str_deref(device->name), new_size);
 out_free:
 	kfree(vol_args);
 out:
-- 
2.24.0


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

* Re: [PATCH] btrfs: ioctl: resize: Only how new size if size changed
  2020-02-11 13:55 [PATCH] btrfs: ioctl: resize: Only how new size if size changed Marcos Paulo de Souza
@ 2020-02-11 18:30 ` Johannes Thumshirn
  2020-02-11 19:34 ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2020-02-11 18:30 UTC (permalink / raw)
  To: Marcos Paulo de Souza, linux-btrfs, dsterba, nborisov, wqu

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshnirn@wdc.com>

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

* Re: [PATCH] btrfs: ioctl: resize: Only how new size if size changed
  2020-02-11 13:55 [PATCH] btrfs: ioctl: resize: Only how new size if size changed Marcos Paulo de Souza
  2020-02-11 18:30 ` Johannes Thumshirn
@ 2020-02-11 19:34 ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2020-02-11 19:34 UTC (permalink / raw)
  To: Marcos Paulo de Souza; +Cc: linux-btrfs, dsterba, nborisov, wqu

On Tue, Feb 11, 2020 at 10:55:26AM -0300, Marcos Paulo de Souza wrote:
> There is no point to inform the user about "new size" if didn't changed
> at all.

Makes sense. I'll also update the message to show the old and new sizes.

> Signed-off-by: Marcos Paulo de Souza <marcos@mpdesouza.com>
> ---
>  fs/btrfs/ioctl.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index be5350582955..fa31a8021d24 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -1712,9 +1712,6 @@ static noinline int btrfs_ioctl_resize(struct file *file,
>  
>  	new_size = round_down(new_size, fs_info->sectorsize);
>  
> -	btrfs_info_in_rcu(fs_info, "new size for %s is %llu",
> -			  rcu_str_deref(device->name), new_size);
> -
>  	if (new_size > old_size) {
>  		trans = btrfs_start_transaction(root, 0);
>  		if (IS_ERR(trans)) {
> @@ -1727,6 +1724,9 @@ static noinline int btrfs_ioctl_resize(struct file *file,
>  		ret = btrfs_shrink_device(device, new_size);
>  	} /* equal, nothing need to do */
>  
> +	if (ret == 0 && new_size != old_size)
> +		btrfs_info_in_rcu(fs_info, "new size for %s is %llu",
> +			  rcu_str_deref(device->name), new_size);

And maybe also print devid, other messages usually print both.

>  out_free:
>  	kfree(vol_args);
>  out:
> -- 
> 2.24.0

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

* [PATCH] btrfs: ioctl: resize: Only how new size if size changed
@ 2020-02-11 13:39 Marcos Paulo de Souza
  0 siblings, 0 replies; 4+ messages in thread
From: Marcos Paulo de Souza @ 2020-02-11 13:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: Marcos Paulo de Souza

There is no point to inform the user about "new size" if didn't changed
at all.

Signed-off-by: Marcos Paulo de Souza <marcos@mpdesouza.com>
---
 fs/btrfs/ioctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index be5350582955..fa31a8021d24 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1712,9 +1712,6 @@ static noinline int btrfs_ioctl_resize(struct file *file,
 
 	new_size = round_down(new_size, fs_info->sectorsize);
 
-	btrfs_info_in_rcu(fs_info, "new size for %s is %llu",
-			  rcu_str_deref(device->name), new_size);
-
 	if (new_size > old_size) {
 		trans = btrfs_start_transaction(root, 0);
 		if (IS_ERR(trans)) {
@@ -1727,6 +1724,9 @@ static noinline int btrfs_ioctl_resize(struct file *file,
 		ret = btrfs_shrink_device(device, new_size);
 	} /* equal, nothing need to do */
 
+	if (ret == 0 && new_size != old_size)
+		btrfs_info_in_rcu(fs_info, "new size for %s is %llu",
+			  rcu_str_deref(device->name), new_size);
 out_free:
 	kfree(vol_args);
 out:
-- 
2.24.0


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

end of thread, other threads:[~2020-02-11 19:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-11 13:55 [PATCH] btrfs: ioctl: resize: Only how new size if size changed Marcos Paulo de Souza
2020-02-11 18:30 ` Johannes Thumshirn
2020-02-11 19:34 ` David Sterba
  -- strict thread matches above, loose matches on Subject: below --
2020-02-11 13:39 Marcos Paulo de Souza

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.