public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org,
	Christian Brauner <brauner@kernel.org>,
	Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH 5/5] btrfs: use the super_block as holder when mounting file systems
Date: Mon, 18 Dec 2023 05:49:33 +0100	[thread overview]
Message-ID: <20231218044933.706042-6-hch@lst.de> (raw)
In-Reply-To: <20231218044933.706042-1-hch@lst.de>

The file system type is not a very useful holder as it doesn't allow us
to go back to the actual file system instance.  Pass the super_block
instead which is useful when passed back to the file system driver.

This matches what is done for all other block device based file systems.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 62a933b47e03c3..2dfa2274b19387 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1831,7 +1831,7 @@ static int btrfs_get_tree_super(struct fs_context *fc)
 		struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
 
 		mutex_lock(&uuid_mutex);
-		ret = btrfs_open_devices(fs_devices, mode, &btrfs_fs_type);
+		ret = btrfs_open_devices(fs_devices, mode, sb);
 		mutex_unlock(&uuid_mutex);
 		if (ret)
 			goto error_deactivate;
@@ -1844,7 +1844,7 @@ static int btrfs_get_tree_super(struct fs_context *fc)
 		snprintf(sb->s_id, sizeof(sb->s_id), "%pg",
 			 fs_devices->latest_dev->bdev);
 		shrinker_debugfs_rename(sb->s_shrink, "sb-btrfs:%s", sb->s_id);
-		btrfs_sb(sb)->bdev_holder = &btrfs_fs_type;
+		btrfs_sb(sb)->bdev_holder = sb;
 		ret = btrfs_fill_super(sb, fs_devices, NULL);
 		if (ret)
 			goto error_deactivate;
-- 
2.39.2


  parent reply	other threads:[~2023-12-18  4:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18  4:49 use the super_block as bdev holder Christoph Hellwig
2023-12-18  4:49 ` [PATCH 1/5] btrfs: always open the device read-only in btrfs_scan_one_device Christoph Hellwig
2023-12-18  4:49 ` [PATCH 2/5] btrfs: call btrfs_close_devices from ->kill_sb Christoph Hellwig
2023-12-18 12:22   ` Christian Brauner
2023-12-27 17:09   ` Eric Biggers
2023-12-18  4:49 ` [PATCH 3/5] btrfs: split btrfs_fs_devices.opened Christoph Hellwig
2023-12-18 11:56   ` Johannes Thumshirn
2023-12-18 15:01     ` Christoph Hellwig
2023-12-18  4:49 ` [PATCH 4/5] btrfs: open block devices after superblock creation Christoph Hellwig
2023-12-18  4:49 ` Christoph Hellwig [this message]
2023-12-18 12:14   ` [PATCH 5/5] btrfs: use the super_block as holder when mounting file systems Johannes Thumshirn
2023-12-18 15:02     ` Christoph Hellwig
2023-12-19  5:33       ` Gao Xiang
2023-12-19 12:19         ` Christoph Hellwig
2023-12-19 13:48           ` Gao Xiang
2023-12-18 12:20 ` use the super_block as bdev holder Johannes Thumshirn
  -- strict thread matches above, loose matches on Subject: below --
2024-02-14 16:42 [PATCH 0/5] btrfs: " Johannes Thumshirn
2024-02-14 16:42 ` [PATCH 5/5] btrfs: use the super_block as holder when mounting file systems Johannes Thumshirn

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=20231218044933.706042-6-hch@lst.de \
    --to=hch@lst.de \
    --cc=brauner@kernel.org \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=ebiggers@kernel.org \
    --cc=josef@toxicpanda.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox