diff mbox series

btrfs: zoned: Remove redundant assignment in btrfs_check_zoned_mode

Message ID 20220204091542.78118-1-p.raghav@samsung.com (mailing list archive)
State New, archived
Headers show
Series btrfs: zoned: Remove redundant assignment in btrfs_check_zoned_mode | expand

Commit Message

Pankaj Raghav Feb. 4, 2022, 9:15 a.m. UTC
Remove the redundant assignment to zone_info variable in
btrfs_check_zoned_mode function.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
 fs/btrfs/zoned.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Johannes Thumshirn Feb. 4, 2022, 10:42 a.m. UTC | #1
On 04/02/2022 10:15, Pankaj Raghav wrote:
> Remove the redundant assignment to zone_info variable in
> btrfs_check_zoned_mode function.
> 
> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
> ---
>  fs/btrfs/zoned.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index 3aad1970ee43..e3f6f24718d2 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -655,7 +655,6 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
>  			struct btrfs_zoned_device_info *zone_info =
>  				device->zone_info;
>  
> -			zone_info = device->zone_info;
>  			zoned_devices++;
>  			if (!zone_size) {
>  				zone_size = zone_info->zone_size;

Ack for the removal of the redundancy, but wouldn't this make to code look
nicer in the end:

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 3aad1970ee43..b7b5fac1c779 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -652,8 +652,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
                if (model == BLK_ZONED_HM ||
                    (model == BLK_ZONED_HA && incompat_zoned) ||
                    (model == BLK_ZONED_NONE && incompat_zoned)) {
-                       struct btrfs_zoned_device_info *zone_info =
-                               device->zone_info;
+                       struct btrfs_zoned_device_info *zone_info;
 
                        zone_info = device->zone_info;
                        zoned_devices++;
Pankaj Raghav Feb. 4, 2022, 11:55 a.m. UTC | #2
On 2022-02-04 11:42, Johannes Thumshirn wrote:
> On 04/02/2022 10:15, Pankaj Raghav wrote:
>> Remove the redundant assignment to zone_info variable in
>> btrfs_check_zoned_mode function.
>>
>> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
>> ---
>>  fs/btrfs/zoned.c | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
>> index 3aad1970ee43..e3f6f24718d2 100644
>> --- a/fs/btrfs/zoned.c
>> +++ b/fs/btrfs/zoned.c
>> @@ -655,7 +655,6 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
>>  			struct btrfs_zoned_device_info *zone_info =
>>  				device->zone_info;
>>  
>> -			zone_info = device->zone_info;
>>  			zoned_devices++;
>>  			if (!zone_size) {
>>  				zone_size = zone_info->zone_size;
> 
> Ack for the removal of the redundancy, but wouldn't this make to code look
> nicer in the end:
> 

I agree. I went with the initial patch to remain consistent with rest of the
code where zone_info was initialized. But given the formatting at this location
it is better to go with your suggestion.

I will send a v2 soon.
diff mbox series

Patch

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 3aad1970ee43..e3f6f24718d2 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -655,7 +655,6 @@  int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
 			struct btrfs_zoned_device_info *zone_info =
 				device->zone_info;
 
-			zone_info = device->zone_info;
 			zoned_devices++;
 			if (!zone_size) {
 				zone_size = zone_info->zone_size;