Btrfs: cleanup redundant code in __btrfs_close_devices()
PATCH 1/1 Btrfs: cleanup redundant code in __btrfs_close_devices()
--- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/volumes.c +1 -1
@@ -644,7 +644,7 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)/* Safe because we are under uuid_mutex */ if (device->name) { name =rcu_string_strdup (device->name->str,GFP_NOFS ); -BUG_ON (device->name && !name);/* -ENOMEM */ +BUG_ON (!name);/* -ENOMEM */ rcu_assign_pointer (new_device->name, name); } new_device->bdev =NULL ;
Signature · 1 line
1.7.10.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Wang Shilong
Quoted 6 lines · Azat Khuzhin
Signed-off-by Azat Khuzhin <[email protected]>--- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
fs/btrfs/volumes.c static int __btrfs_close_devices(struct · line 649
Quoted 12 lines
fs/btrfs/volumes.c +1
-1@@ -644,7 +644,7 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)/* Safe because we are under uuid_mutex */ if (device->name) { name =rcu_string_strdup (device->name->str,GFP_NOFS ); -BUG_ON (device->name && !name);/* -ENOMEM */ +BUG_ON (!name);/* -ENOMEM * Nice catch! out of memory should not trigger
BUG_ON().. Maybe we can handle it gracefully.
Maybe return -ENOMEM ?
Quoted 9 lines
Thanks,
WangQuoted 3 lines
fs/btrfs/volumes.c +0
-0rcu_assign_pointer (new_device->name, name);} new_device->bdev = NULL;
Signature · 2 lines
Respectfully Azat Khuzhin
Quoted 24 lines · Wang Shilong
Quoted 7 lines · Azat Khuzhin
Quoted 6 lines
Signed-off-by Azat Khuzhin <[email protected]>--- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 15 lines
fs/btrfs/volumes.c static int __btrfs_close_devices(struct · line 649
Quoted 12 lines
fs/btrfs/volumes.c +1
-1@@ -644,7 +644,7 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)/* Safe because we are under uuid_mutex */ if (device->name) { name =rcu_string_strdup (device->name->str,GFP_NOFS ); -BUG_ON (device->name && !name);/* -ENOMEM */ +BUG_ON (!name);/* -ENOMEM * Nice catch! out of memory should not trigger
BUG_ON().. Maybe we can handle it gracefully.
Quoted 1 line
Maybe return
-ENOMEM?
Yeah, BUG_On is really unfriendly. And here ENOMEM triggers BUG_ON() is a lazy approach.
I think we can return -ENOMEM rather than BUG_ON(), the caller can handle this.
Thanks,
Wang
Quoted 20 lines
Quoted 10 lines
Thanks,
WangQuoted 3 lines
fs/btrfs/volumes.c +0
-0rcu_assign_pointer (new_device->name, name);} new_device->bdev = NULL;Signature · 6 lines
Respectfully Azat Khuzhin -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 24 lines · Wang Shilong
Quoted 24 lines · Wang Shilong
Quoted 22 lines · Azat Khuzhin
Quoted 11 lines
Signed-off-by Azat Khuzhin <[email protected]>--- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/btrfs/volumes.c +0
-0fs/btrfs/volumes.c static int __btrfs_close_devices(struct · line 649
Quoted 7 lines
fs/btrfs/volumes.c +1
-1@@ -644,7 +644,7 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)/* Safe because we are under uuid_mutex */ if (device->name) { name =rcu_string_strdup (device->name->str,GFP_NOFS ); -BUG_ON (device->name && !name);/* -ENOMEM */ +BUG_ON (!name);/* -ENOMEM * Nice catch! out of memory should not trigger
BUG_ON().. Maybe we can handle it gracefully.
Quoted 6 lines
Quoted 1 line
Maybe return
-ENOMEM?Yeah,
BUG_Onis really unfriendly. And here ENOMEM triggersBUG_ON()is a lazy approach.I think we can return
-ENOMEMrather thanBUG_ON(), the caller can handle this.
I will write a patch, when this one will be merged, to avoid conflicts, and also because the issue that this patch solves is different from BUG_ON().
Quoted 24 lines
Thanks,
WangQuoted 20 lines
Quoted 10 lines
Thanks,
WangQuoted 3 lines
fs/btrfs/volumes.c +0
-0rcu_assign_pointer (new_device->name, name);} new_device->bdev = NULL;--
Respectfully
Azat Khuzhin
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Respectfully Azat Khuzhin