linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Return value name unifications
@ 2025-06-18 11:29 David Sterba
  2025-06-18 11:29 ` [PATCH 1/5] btrfs: rename error to ret in btrfs_may_delete() David Sterba
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: David Sterba @ 2025-06-18 11:29 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Use 'ret' instead of 'error'.

David Sterba (5):
  btrfs: rename error to ret in btrfs_may_delete()
  btrfs: rename error to ret in btrfs_mksubvol()
  btrfs: rename error to ret in btrfs_sysfs_add_fsid()
  btrfs: rename error to ret in btrfs_sysfs_add_mounted()
  btrfs: rename error to ret in device_list_add()

 fs/btrfs/ioctl.c   | 35 ++++++++++++++--------------
 fs/btrfs/sysfs.c   | 57 +++++++++++++++++++++++-----------------------
 fs/btrfs/volumes.c | 10 ++++----
 3 files changed, 50 insertions(+), 52 deletions(-)

-- 
2.49.0


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

* [PATCH 1/5] btrfs: rename error to ret in btrfs_may_delete()
  2025-06-18 11:29 [PATCH 0/5] Return value name unifications David Sterba
@ 2025-06-18 11:29 ` David Sterba
  2025-06-18 11:29 ` [PATCH 2/5] btrfs: rename error to ret in btrfs_mksubvol() David Sterba
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2025-06-18 11:29 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Unify naming of return value to the preferred way.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ioctl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 00047367655968..7cd6ae0c12c994 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -841,7 +841,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
 static int btrfs_may_delete(struct mnt_idmap *idmap,
 			    struct inode *dir, struct dentry *victim, int isdir)
 {
-	int error;
+	int ret;
 
 	if (d_really_is_negative(victim))
 		return -ENOENT;
@@ -851,9 +851,9 @@ static int btrfs_may_delete(struct mnt_idmap *idmap,
 		return -EINVAL;
 	audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE);
 
-	error = inode_permission(idmap, dir, MAY_WRITE | MAY_EXEC);
-	if (error)
-		return error;
+	ret = inode_permission(idmap, dir, MAY_WRITE | MAY_EXEC);
+	if (ret)
+		return ret;
 	if (IS_APPEND(dir))
 		return -EPERM;
 	if (check_sticky(idmap, dir, d_inode(victim)) ||
-- 
2.49.0


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

* [PATCH 2/5] btrfs: rename error to ret in btrfs_mksubvol()
  2025-06-18 11:29 [PATCH 0/5] Return value name unifications David Sterba
  2025-06-18 11:29 ` [PATCH 1/5] btrfs: rename error to ret in btrfs_may_delete() David Sterba
@ 2025-06-18 11:29 ` David Sterba
  2025-06-18 11:29 ` [PATCH 3/5] btrfs: rename error to ret in btrfs_sysfs_add_fsid() David Sterba
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2025-06-18 11:29 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Unify naming of return value to the preferred way.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ioctl.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 7cd6ae0c12c994..b38acf43ebb563 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -903,28 +903,27 @@ static noinline int btrfs_mksubvol(const struct path *parent,
 	struct btrfs_fs_info *fs_info = inode_to_fs_info(dir);
 	struct dentry *dentry;
 	struct fscrypt_str name_str = FSTR_INIT((char *)name, namelen);
-	int error;
+	int ret;
 
-	error = down_write_killable_nested(&dir->i_rwsem, I_MUTEX_PARENT);
-	if (error == -EINTR)
-		return error;
+	ret = down_write_killable_nested(&dir->i_rwsem, I_MUTEX_PARENT);
+	if (ret == -EINTR)
+		return ret;
 
 	dentry = lookup_one(idmap, &QSTR_LEN(name, namelen), parent->dentry);
-	error = PTR_ERR(dentry);
+	ret = PTR_ERR(dentry);
 	if (IS_ERR(dentry))
 		goto out_unlock;
 
-	error = btrfs_may_create(idmap, dir, dentry);
-	if (error)
+	ret = btrfs_may_create(idmap, dir, dentry);
+	if (ret)
 		goto out_dput;
 
 	/*
 	 * even if this name doesn't exist, we may get hash collisions.
 	 * check for them now when we can safely fail
 	 */
-	error = btrfs_check_dir_item_collision(BTRFS_I(dir)->root,
-					       dir->i_ino, &name_str);
-	if (error)
+	ret = btrfs_check_dir_item_collision(BTRFS_I(dir)->root, dir->i_ino, &name_str);
+	if (ret)
 		goto out_dput;
 
 	down_read(&fs_info->subvol_sem);
@@ -933,11 +932,11 @@ static noinline int btrfs_mksubvol(const struct path *parent,
 		goto out_up_read;
 
 	if (snap_src)
-		error = create_snapshot(snap_src, dir, dentry, readonly, inherit);
+		ret = create_snapshot(snap_src, dir, dentry, readonly, inherit);
 	else
-		error = create_subvol(idmap, dir, dentry, inherit);
+		ret = create_subvol(idmap, dir, dentry, inherit);
 
-	if (!error)
+	if (!ret)
 		fsnotify_mkdir(dir, dentry);
 out_up_read:
 	up_read(&fs_info->subvol_sem);
@@ -945,7 +944,7 @@ static noinline int btrfs_mksubvol(const struct path *parent,
 	dput(dentry);
 out_unlock:
 	btrfs_inode_unlock(BTRFS_I(dir), 0);
-	return error;
+	return ret;
 }
 
 static noinline int btrfs_mksnapshot(const struct path *parent,
-- 
2.49.0


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

* [PATCH 3/5] btrfs: rename error to ret in btrfs_sysfs_add_fsid()
  2025-06-18 11:29 [PATCH 0/5] Return value name unifications David Sterba
  2025-06-18 11:29 ` [PATCH 1/5] btrfs: rename error to ret in btrfs_may_delete() David Sterba
  2025-06-18 11:29 ` [PATCH 2/5] btrfs: rename error to ret in btrfs_mksubvol() David Sterba
@ 2025-06-18 11:29 ` David Sterba
  2025-06-18 11:29 ` [PATCH 4/5] btrfs: rename error to ret in btrfs_sysfs_add_mounted() David Sterba
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2025-06-18 11:29 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Unify naming of return value to the preferred way.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/sysfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index b860470cffc4c8..db3495481fe684 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -2290,15 +2290,15 @@ static struct kset *btrfs_kset;
  */
 int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs)
 {
-	int error;
+	int ret;
 
 	init_completion(&fs_devs->kobj_unregister);
 	fs_devs->fsid_kobj.kset = btrfs_kset;
-	error = kobject_init_and_add(&fs_devs->fsid_kobj, &btrfs_ktype, NULL,
-				     "%pU", fs_devs->fsid);
-	if (error) {
+	ret = kobject_init_and_add(&fs_devs->fsid_kobj, &btrfs_ktype, NULL,
+				   "%pU", fs_devs->fsid);
+	if (ret) {
 		kobject_put(&fs_devs->fsid_kobj);
-		return error;
+		return ret;
 	}
 
 	fs_devs->devices_kobj = kobject_create_and_add("devices",
-- 
2.49.0


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

* [PATCH 4/5] btrfs: rename error to ret in btrfs_sysfs_add_mounted()
  2025-06-18 11:29 [PATCH 0/5] Return value name unifications David Sterba
                   ` (2 preceding siblings ...)
  2025-06-18 11:29 ` [PATCH 3/5] btrfs: rename error to ret in btrfs_sysfs_add_fsid() David Sterba
@ 2025-06-18 11:29 ` David Sterba
  2025-06-18 11:29 ` [PATCH 5/5] btrfs: rename error to ret in device_list_add() David Sterba
  2025-06-23 14:20 ` [PATCH 0/5] Return value name unifications Daniel Vacek
  5 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2025-06-18 11:29 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Unify naming of return value to the preferred way.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/sysfs.c | 47 +++++++++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index db3495481fe684..6471fb53ca2af3 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -2324,71 +2324,70 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs)
 
 int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
 {
-	int error;
+	int ret;
 	struct btrfs_fs_devices *fs_devs = fs_info->fs_devices;
 	struct kobject *fsid_kobj = &fs_devs->fsid_kobj;
 
-	error = btrfs_sysfs_add_fs_devices(fs_devs);
-	if (error)
-		return error;
+	ret = btrfs_sysfs_add_fs_devices(fs_devs);
+	if (ret)
+		return ret;
 
-	error = sysfs_create_files(fsid_kobj, btrfs_attrs);
-	if (error) {
+	ret = sysfs_create_files(fsid_kobj, btrfs_attrs);
+	if (ret) {
 		btrfs_sysfs_remove_fs_devices(fs_devs);
-		return error;
+		return ret;
 	}
 
-	error = sysfs_create_group(fsid_kobj,
-				   &btrfs_feature_attr_group);
-	if (error)
+	ret = sysfs_create_group(fsid_kobj, &btrfs_feature_attr_group);
+	if (ret)
 		goto failure;
 
 #ifdef CONFIG_BTRFS_DEBUG
 	fs_info->debug_kobj = kobject_create_and_add("debug", fsid_kobj);
 	if (!fs_info->debug_kobj) {
-		error = -ENOMEM;
+		ret = -ENOMEM;
 		goto failure;
 	}
 
-	error = sysfs_create_files(fs_info->debug_kobj, btrfs_debug_mount_attrs);
-	if (error)
+	ret = sysfs_create_files(fs_info->debug_kobj, btrfs_debug_mount_attrs);
+	if (ret)
 		goto failure;
 #endif
 
 	/* Discard directory */
 	fs_info->discard_kobj = kobject_create_and_add("discard", fsid_kobj);
 	if (!fs_info->discard_kobj) {
-		error = -ENOMEM;
+		ret = -ENOMEM;
 		goto failure;
 	}
 
-	error = sysfs_create_files(fs_info->discard_kobj, discard_attrs);
-	if (error)
+	ret = sysfs_create_files(fs_info->discard_kobj, discard_attrs);
+	if (ret)
 		goto failure;
 
-	error = addrm_unknown_feature_attrs(fs_info, true);
-	if (error)
+	ret = addrm_unknown_feature_attrs(fs_info, true);
+	if (ret)
 		goto failure;
 
-	error = sysfs_create_link(fsid_kobj, &fs_info->sb->s_bdi->dev->kobj, "bdi");
-	if (error)
+	ret = sysfs_create_link(fsid_kobj, &fs_info->sb->s_bdi->dev->kobj, "bdi");
+	if (ret)
 		goto failure;
 
 	fs_info->space_info_kobj = kobject_create_and_add("allocation",
 						  fsid_kobj);
 	if (!fs_info->space_info_kobj) {
-		error = -ENOMEM;
+		ret = -ENOMEM;
 		goto failure;
 	}
 
-	error = sysfs_create_files(fs_info->space_info_kobj, allocation_attrs);
-	if (error)
+	ret = sysfs_create_files(fs_info->space_info_kobj, allocation_attrs);
+	if (ret)
 		goto failure;
 
 	return 0;
 failure:
 	btrfs_sysfs_remove_mounted(fs_info);
-	return error;
+	return ret;
 }
 
 static ssize_t qgroup_enabled_show(struct kobject *qgroups_kobj,
-- 
2.49.0


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

* [PATCH 5/5] btrfs: rename error to ret in device_list_add()
  2025-06-18 11:29 [PATCH 0/5] Return value name unifications David Sterba
                   ` (3 preceding siblings ...)
  2025-06-18 11:29 ` [PATCH 4/5] btrfs: rename error to ret in btrfs_sysfs_add_mounted() David Sterba
@ 2025-06-18 11:29 ` David Sterba
  2025-06-23 14:20 ` [PATCH 0/5] Return value name unifications Daniel Vacek
  5 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2025-06-18 11:29 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Unify naming of return value to the preferred way.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/volumes.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 134b7754347ef3..8c598a04b4a3f0 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -787,7 +787,7 @@ static noinline struct btrfs_device *device_list_add(const char *path,
 	u64 found_transid = btrfs_super_generation(disk_super);
 	u64 devid = btrfs_stack_device_id(&disk_super->dev_item);
 	dev_t path_devt;
-	int error;
+	int ret;
 	bool same_fsid_diff_dev = false;
 	bool has_metadata_uuid = (btrfs_super_incompat_flags(disk_super) &
 		BTRFS_FEATURE_INCOMPAT_METADATA_UUID);
@@ -799,11 +799,11 @@ static noinline struct btrfs_device *device_list_add(const char *path,
 		return ERR_PTR(-EAGAIN);
 	}
 
-	error = lookup_bdev(path, &path_devt);
-	if (error) {
+	ret = lookup_bdev(path, &path_devt);
+	if (ret) {
 		btrfs_err(NULL, "failed to lookup block device for path %s: %d",
-			  path, error);
-		return ERR_PTR(error);
+			  path, ret);
+		return ERR_PTR(ret);
 	}
 
 	fs_devices = find_fsid_by_device(disk_super, path_devt, &same_fsid_diff_dev);
-- 
2.49.0


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

* Re: [PATCH 0/5] Return value name unifications
  2025-06-18 11:29 [PATCH 0/5] Return value name unifications David Sterba
                   ` (4 preceding siblings ...)
  2025-06-18 11:29 ` [PATCH 5/5] btrfs: rename error to ret in device_list_add() David Sterba
@ 2025-06-23 14:20 ` Daniel Vacek
  5 siblings, 0 replies; 7+ messages in thread
From: Daniel Vacek @ 2025-06-23 14:20 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

On Wed, 18 Jun 2025 at 13:29, David Sterba <dsterba@suse.com> wrote:
>
> Use 'ret' instead of 'error'.
>
> David Sterba (5):
>   btrfs: rename error to ret in btrfs_may_delete()
>   btrfs: rename error to ret in btrfs_mksubvol()
>   btrfs: rename error to ret in btrfs_sysfs_add_fsid()
>   btrfs: rename error to ret in btrfs_sysfs_add_mounted()
>   btrfs: rename error to ret in device_list_add()

The series LGTM.

Reviewed-by: Daniel Vacek <neelx@suse.com>

>  fs/btrfs/ioctl.c   | 35 ++++++++++++++--------------
>  fs/btrfs/sysfs.c   | 57 +++++++++++++++++++++++-----------------------
>  fs/btrfs/volumes.c | 10 ++++----
>  3 files changed, 50 insertions(+), 52 deletions(-)
>
> --
> 2.49.0
>
>

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

end of thread, other threads:[~2025-06-23 14:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-18 11:29 [PATCH 0/5] Return value name unifications David Sterba
2025-06-18 11:29 ` [PATCH 1/5] btrfs: rename error to ret in btrfs_may_delete() David Sterba
2025-06-18 11:29 ` [PATCH 2/5] btrfs: rename error to ret in btrfs_mksubvol() David Sterba
2025-06-18 11:29 ` [PATCH 3/5] btrfs: rename error to ret in btrfs_sysfs_add_fsid() David Sterba
2025-06-18 11:29 ` [PATCH 4/5] btrfs: rename error to ret in btrfs_sysfs_add_mounted() David Sterba
2025-06-18 11:29 ` [PATCH 5/5] btrfs: rename error to ret in device_list_add() David Sterba
2025-06-23 14:20 ` [PATCH 0/5] Return value name unifications Daniel Vacek

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).