From: Andrew Price <anprice@redhat.com>
To: cluster-devel@redhat.com
Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org
Subject: [PATCH v2 2/2] gfs2: Convert gfs2meta to fs_context
Date: Tue, 19 Mar 2019 16:04:36 +0000 [thread overview]
Message-ID: <20190319160436.20817-3-anprice@redhat.com> (raw)
In-Reply-To: <20190319160436.20817-1-anprice@redhat.com>
Signed-off-by: Andrew Price <anprice@redhat.com>
---
fs/gfs2/ops_fstype.c | 54 ++++++++++++++++++++++++++------------------
1 file changed, 32 insertions(+), 22 deletions(-)
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index ad2c98a37bd4..460d31403a7c 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1629,48 +1629,58 @@ static int gfs2_init_fs_context(struct fs_context *fc)
return 0;
}
-static int set_meta_super(struct super_block *s, void *ptr)
+static int set_meta_super(struct super_block *s, struct fs_context *fc)
{
return -EINVAL;
}
-static int test_meta_super(struct super_block *s, void *ptr)
-{
- struct block_device *bdev = ptr;
- return (bdev == s->s_bdev);
-}
-
-
-static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
- int flags, const char *dev_name, void *data)
+static int gfs2_meta_get_tree(struct fs_context *fc)
{
+ struct gfs2_args *args = fc->fs_private;
struct super_block *s;
struct gfs2_sbd *sdp;
struct path path;
int error;
- if (!dev_name || !*dev_name)
- return ERR_PTR(-EINVAL);
+ if (!fc->source || !*fc->source)
+ return -EINVAL;
- error = kern_path(dev_name, LOOKUP_FOLLOW, &path);
+ error = kern_path(fc->source, LOOKUP_FOLLOW, &path);
if (error) {
pr_warn("path_lookup on %s returned error %d\n",
- dev_name, error);
- return ERR_PTR(error);
+ fc->source, error);
+ return error;
}
- s = sget(&gfs2_fs_type, test_meta_super, set_meta_super, flags,
- path.dentry->d_sb->s_bdev);
+ fc->fs_type = &gfs2_fs_type;
+ args->ar_bdev = path.dentry->d_sb->s_bdev;
+ s = sget_fc(fc, test_gfs2_super, set_meta_super);
path_put(&path);
if (IS_ERR(s)) {
pr_warn("gfs2 mount does not exist\n");
- return ERR_CAST(s);
+ return PTR_ERR(s);
}
- if ((flags ^ s->s_flags) & SB_RDONLY) {
+ if ((fc->sb_flags ^ s->s_flags) & SB_RDONLY) {
deactivate_locked_super(s);
- return ERR_PTR(-EBUSY);
+ return -EBUSY;
}
sdp = s->s_fs_info;
- return dget(sdp->sd_master_dir);
+ fc->root = dget(sdp->sd_master_dir);
+ return 0;
+}
+
+static const struct fs_context_operations gfs2_meta_context_ops = {
+ .get_tree = gfs2_meta_get_tree,
+};
+
+static int gfs2_meta_init_fs_context(struct fs_context *fc)
+{
+ int ret = gfs2_init_fs_context(fc);
+
+ if (ret)
+ return ret;
+
+ fc->ops = &gfs2_meta_context_ops;
+ return 0;
}
static void gfs2_kill_sb(struct super_block *sb)
@@ -1705,7 +1715,7 @@ MODULE_ALIAS_FS("gfs2");
struct file_system_type gfs2meta_fs_type = {
.name = "gfs2meta",
.fs_flags = FS_REQUIRES_DEV,
- .mount = gfs2_mount_meta,
+ .init_fs_context = gfs2_meta_init_fs_context,
.owner = THIS_MODULE,
};
MODULE_ALIAS_FS("gfs2meta");
--
2.20.1
next prev parent reply other threads:[~2019-03-19 16:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-19 16:04 [PATCH v2 0/2] gfs2: Switch to the new mount API Andrew Price
2019-03-19 16:04 ` [PATCH v2 1/2] gfs2: Convert gfs2 to fs_context Andrew Price
2019-03-19 16:04 ` Andrew Price [this message]
2019-03-19 17:05 ` David Howells
2019-03-19 17:53 ` Andrew Price
2019-03-21 12:57 ` Andrew Price
2019-03-21 17:08 ` David Howells
2019-03-21 17:26 ` [PATCH] vfs: Allow selection of fs root independent of sb Andrew Price
2019-03-21 18:36 ` Matthew Wilcox
2019-03-21 17:59 ` David Howells
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=20190319160436.20817-3-anprice@redhat.com \
--to=anprice@redhat.com \
--cc=cluster-devel@redhat.com \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).