linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] btrfs: remove unused variable
@ 2020-11-17  9:47 Zou Wei
  2020-11-27 19:49 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Zou Wei @ 2020-11-17  9:47 UTC (permalink / raw)
  To: clm, josef, dsterba; +Cc: linux-btrfs, linux-kernel, Zou Wei

Fix variable set but not used compilation warnings:

fs/btrfs/ctree.c:1581:6: warning: variable ‘parent_level’ set but not used [-Wunused-but-set-variable]
  int parent_level;
      ^~~~~~~~~~~~

fs/btrfs/zoned.c:503:6: warning: variable ‘zone_size’ set but not used [-Wunused-but-set-variable]
  u64 zone_size;
      ^~~~~~~~~

Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
 fs/btrfs/ctree.c | 3 ---
 fs/btrfs/zoned.c | 2 --
 2 files changed, 5 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 32a57a7..e5a0941 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1578,13 +1578,10 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
 	int end_slot;
 	int i;
 	int err = 0;
-	int parent_level;
 	u32 blocksize;
 	int progress_passed = 0;
 	struct btrfs_disk_key disk_key;
 
-	parent_level = btrfs_header_level(parent);
-
 	WARN_ON(trans->transaction != fs_info->running_transaction);
 	WARN_ON(trans->transid != fs_info->generation);
 
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index fa9cc61..742f088 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -500,7 +500,6 @@ int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw,
 	unsigned int zone_sectors;
 	u32 sb_zone;
 	int ret;
-	u64 zone_size;
 	u8 zone_sectors_shift;
 	sector_t nr_sectors = bdev->bd_part->nr_sects;
 	u32 nr_zones;
@@ -515,7 +514,6 @@ int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw,
 	zone_sectors = bdev_zone_sectors(bdev);
 	if (!is_power_of_2(zone_sectors))
 		return -EINVAL;
-	zone_size = zone_sectors << SECTOR_SHIFT;
 	zone_sectors_shift = ilog2(zone_sectors);
 	nr_zones = nr_sectors >> zone_sectors_shift;
 
-- 
2.6.2


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

* Re: [PATCH -next] btrfs: remove unused variable
  2020-11-17  9:47 [PATCH -next] btrfs: remove unused variable Zou Wei
@ 2020-11-27 19:49 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2020-11-27 19:49 UTC (permalink / raw)
  To: Zou Wei; +Cc: clm, josef, dsterba, linux-btrfs, linux-kernel

On Tue, Nov 17, 2020 at 05:47:43PM +0800, Zou Wei wrote:
> Fix variable set but not used compilation warnings:
> 
> fs/btrfs/ctree.c:1581:6: warning: variable ‘parent_level’ set but not used [-Wunused-but-set-variable]
>   int parent_level;
>       ^~~~~~~~~~~~
> 
> fs/btrfs/zoned.c:503:6: warning: variable ‘zone_size’ set but not used [-Wunused-but-set-variable]
>   u64 zone_size;
>       ^~~~~~~~~
> 
> Signed-off-by: Zou Wei <zou_wei@huawei.com>

> ---
>  fs/btrfs/ctree.c | 3 ---
>  fs/btrfs/zoned.c | 2 --
>  2 files changed, 5 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> index 32a57a7..e5a0941 100644
> --- a/fs/btrfs/ctree.c
> +++ b/fs/btrfs/ctree.c
> @@ -1578,13 +1578,10 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
>  	int end_slot;
>  	int i;
>  	int err = 0;
> -	int parent_level;
>  	u32 blocksize;
>  	int progress_passed = 0;
>  	struct btrfs_disk_key disk_key;
>  
> -	parent_level = btrfs_header_level(parent);

That one folded to the patch, thanks.

> -
>  	WARN_ON(trans->transaction != fs_info->running_transaction);
>  	WARN_ON(trans->transid != fs_info->generation);
>  
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index fa9cc61..742f088 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -500,7 +500,6 @@ int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw,
>  	unsigned int zone_sectors;
>  	u32 sb_zone;
>  	int ret;
> -	u64 zone_size;
>  	u8 zone_sectors_shift;
>  	sector_t nr_sectors = bdev->bd_part->nr_sects;
>  	u32 nr_zones;
> @@ -515,7 +514,6 @@ int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw,
>  	zone_sectors = bdev_zone_sectors(bdev);
>  	if (!is_power_of_2(zone_sectors))
>  		return -EINVAL;
> -	zone_size = zone_sectors << SECTOR_SHIFT;

That was intended to be used a few lines below, so that's not for
removal.

>  	zone_sectors_shift = ilog2(zone_sectors);
>  	nr_zones = nr_sectors >> zone_sectors_shift;
>  
> -- 
> 2.6.2

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

end of thread, other threads:[~2020-11-28 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-17  9:47 [PATCH -next] btrfs: remove unused variable Zou Wei
2020-11-27 19:49 ` 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).