All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 12/15] btrfs: sysfs, unexport btrfs_sysfs_add_mounted()
Date: Mon, 18 Nov 2019 16:46:53 +0800	[thread overview]
Message-ID: <20191118084656.3089-13-anand.jain@oracle.com> (raw)
In-Reply-To: <20191118084656.3089-1-anand.jain@oracle.com>

In open_ctree() we call btrfs_sysfs_add_fsid() to create
/sys/fs/btrfs/UUID kobject, and in the following line of code in
open_ctree() we call btrfs_sysfs_add_mounted() to create its attributes.
And there is no other users of btrfs_sysfs_add_mounted(). So let
btrfs_sysfs_add_fsid() also create its attributes and make
btrfs_sysfs_add_mounted() a local static function.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/disk-io.c | 8 --------
 fs/btrfs/sysfs.c   | 9 ++++++++-
 fs/btrfs/sysfs.h   | 1 -
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 85ec0a3d2019..8f6a08bef490 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3089,12 +3089,6 @@ int __cold open_ctree(struct super_block *sb,
 		goto fail_block_groups;
 	}
 
-	ret = btrfs_sysfs_add_mounted(fs_info);
-	if (ret) {
-		btrfs_err(fs_info, "failed to init sysfs interface: %d", ret);
-		goto fail_fsdev_sysfs;
-	}
-
 	ret = btrfs_init_space_info(fs_info);
 	if (ret) {
 		btrfs_err(fs_info, "failed to initialize space info: %d", ret);
@@ -3306,8 +3300,6 @@ int __cold open_ctree(struct super_block *sb,
 
 fail_sysfs:
 	btrfs_sysfs_remove_mounted(fs_info);
-
-fail_fsdev_sysfs:
 	btrfs_sysfs_remove_fsid(fs_info);
 
 fail_block_groups:
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 806676ef008a..2ea27c2d9ef1 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -998,7 +998,7 @@ void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info)
 	btrfs_sysfs_remove_device_info(fs_info->fs_devices, NULL);
 }
 
-int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
+static int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
 {
 	int error;
 	struct btrfs_fs_devices *fs_devs = fs_info->fs_devices;
@@ -1129,6 +1129,13 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_info *fs_info)
 		return -ENOMEM;
 	}
 
+	error = btrfs_sysfs_add_mounted(fs_info);
+	if (error) {
+		btrfs_err(fs_info, "failed to init sysfs interface: %d", error);
+		btrfs_sysfs_remove_fsid(fs_info);
+		return error;
+	}
+
 	return 0;
 }
 
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h
index 0648afbb40ca..a977fe3bec64 100644
--- a/fs/btrfs/sysfs.h
+++ b/fs/btrfs/sysfs.h
@@ -28,7 +28,6 @@ void btrfs_kobject_uevent(struct block_device *bdev, enum kobject_action action)
 
 int __init btrfs_init_sysfs(void);
 void __cold btrfs_exit_sysfs(void);
-int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info);
 void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info);
 void btrfs_sysfs_add_block_group_type(struct btrfs_block_group *cache);
 int btrfs_sysfs_add_space_info_type(struct btrfs_fs_info *fs_info,
-- 
2.23.0


  parent reply	other threads:[~2019-11-18  8:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18  8:46 [PATCH 00/15] btrfs: sysfs, cleanups Anand Jain
2019-11-18  8:46 ` [PATCH 01/15] btrfs: sysfs, rename device_link add,remove functions Anand Jain
2019-11-18  8:46 ` [PATCH 02/15] btrfs: sysfs, rename btrfs_sysfs_add_device() Anand Jain
2019-11-18  8:46 ` [PATCH 03/15] btrfs: sysfs, rename btrfs_device member device_dir_kobj Anand Jain
2019-11-18  8:46 ` [PATCH 04/15] btrfs: sysfs, move declared struct near its use Anand Jain
2019-11-18 15:40   ` David Sterba
2019-11-18  8:46 ` [PATCH 05/15] btrfs: sysfs, move /sys/fs/btrfs/UUID related functions together Anand Jain
2019-11-19  9:24   ` Nikolay Borisov
2019-11-19 10:58     ` David Sterba
2019-11-20  5:56       ` Anand Jain
2019-11-22 17:48         ` David Sterba
2019-11-25  3:18           ` Anand Jain
2019-11-18  8:46 ` [PATCH 06/15] btrfs: sysfs, move add remove _mounted function together Anand Jain
2019-11-18  8:46 ` [PATCH 07/15] btrfs: sysfs, delete code in a comment Anand Jain
2019-11-18 15:39   ` David Sterba
2019-11-18  8:46 ` [PATCH 08/15] btrfs: sysfs, btrfs_sysfs_add_fsid() drop unused argument parent Anand Jain
2019-11-18  8:46 ` [PATCH 09/15] btrfs: sysfs, merge btrfs_sysfs_add device_dir and fsid Anand Jain
2019-11-18  8:46 ` [PATCH 10/15] btrfs: volume, btrfs_free_stale_devices() cleanup unreachable code Anand Jain
2019-11-18  8:46 ` [PATCH 11/15] btrfs: sysfs, migrate fs_decvices::fsid_kobject to struct btrfs_fs_info Anand Jain
2019-11-18  8:46 ` Anand Jain [this message]
2019-11-18  8:46 ` [PATCH 13/15] btrfs: sysfs, cleanup btrfs_sysfs_remove_fsid() Anand Jain
2019-11-18  8:46 ` [PATCH 14/15] btrfs: sysfs, merge btrfs_sysfs_remove_fsid() helper function Anand Jain
2019-11-18  8:46 ` [PATCH 15/15] btrfs: sysfs, unexport btrfs_sysfs_remove_mounted() Anand Jain
2019-11-18 15:45 ` [PATCH 00/15] btrfs: sysfs, cleanups David Sterba
2019-11-19  6:44   ` Anand Jain
2019-11-19 12:37     ` David Sterba
2019-11-20  6:44       ` Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191118084656.3089-13-anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.