* [PATCH] btrfs: optimize check_raid_min_devices drop ret
@ 2021-07-27 23:03 Anand Jain
2021-07-28 12:49 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Anand Jain @ 2021-07-27 23:03 UTC (permalink / raw)
To: linux-btrfs
Function btrfs_check_raid_min_devices() returns error code from the enum
btrfs_err_code and it starts from 1. So there is no need to check if ret
is > 0. So drop this check and also drop the local variable ret.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/volumes.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 887e574266d5..391d5e8cd847 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1961,12 +1961,8 @@ static int btrfs_check_raid_min_devices(struct btrfs_fs_info *fs_info,
if (!(all_avail & btrfs_raid_array[i].bg_flag))
continue;
- if (num_devices < btrfs_raid_array[i].devs_min) {
- int ret = btrfs_raid_array[i].mindev_error;
-
- if (ret)
- return ret;
- }
+ if (num_devices < btrfs_raid_array[i].devs_min)
+ return btrfs_raid_array[i].mindev_error;
}
return 0;
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: optimize check_raid_min_devices drop ret
2021-07-27 23:03 [PATCH] btrfs: optimize check_raid_min_devices drop ret Anand Jain
@ 2021-07-28 12:49 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2021-07-28 12:49 UTC (permalink / raw)
To: Anand Jain; +Cc: linux-btrfs
On Wed, Jul 28, 2021 at 07:03:05AM +0800, Anand Jain wrote:
> Function btrfs_check_raid_min_devices() returns error code from the enum
> btrfs_err_code and it starts from 1. So there is no need to check if ret
> is > 0. So drop this check and also drop the local variable ret.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-28 12:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 23:03 [PATCH] btrfs: optimize check_raid_min_devices drop ret Anand Jain
2021-07-28 12:49 ` David Sterba
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.