mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-23 04:54:01 +08:00
virtiofs: simplify sb setup
Currently when acquiring an sb for virtiofs fuse_mount_get() is being called from virtio_fs_set_super() if a new sb is being filled and fuse_mount_put() is called unconditionally after sget_fc() returns. The exact same result can be obtained by checking whether fs_contex->s_fs_info was set to NULL (ref trasferred to sb->s_fs_info) and only calling fuse_mount_put() if the ref wasn't transferred (error or matching sb found). This allows getting rid of virtio_fs_set_super() and fuse_mount_get(). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
66ab33bf6d
commit
b19d3d00d6
@ -1024,11 +1024,6 @@ void fuse_conn_init(struct fuse_conn *fc, struct fuse_mount *fm,
|
|||||||
*/
|
*/
|
||||||
void fuse_conn_put(struct fuse_conn *fc);
|
void fuse_conn_put(struct fuse_conn *fc);
|
||||||
|
|
||||||
/**
|
|
||||||
* Acquire reference to fuse_mount
|
|
||||||
*/
|
|
||||||
struct fuse_mount *fuse_mount_get(struct fuse_mount *fm);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release reference to fuse_mount
|
* Release reference to fuse_mount
|
||||||
*/
|
*/
|
||||||
|
@ -742,13 +742,6 @@ void fuse_mount_put(struct fuse_mount *fm)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(fuse_mount_put);
|
EXPORT_SYMBOL_GPL(fuse_mount_put);
|
||||||
|
|
||||||
struct fuse_mount *fuse_mount_get(struct fuse_mount *fm)
|
|
||||||
{
|
|
||||||
refcount_inc(&fm->count);
|
|
||||||
return fm;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(fuse_mount_get);
|
|
||||||
|
|
||||||
static struct inode *fuse_get_root_inode(struct super_block *sb, unsigned mode)
|
static struct inode *fuse_get_root_inode(struct super_block *sb, unsigned mode)
|
||||||
{
|
{
|
||||||
struct fuse_attr attr;
|
struct fuse_attr attr;
|
||||||
|
@ -1402,18 +1402,6 @@ static int virtio_fs_test_super(struct super_block *sb,
|
|||||||
return fsc_fm->fc->iq.priv == sb_fm->fc->iq.priv;
|
return fsc_fm->fc->iq.priv == sb_fm->fc->iq.priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtio_fs_set_super(struct super_block *sb,
|
|
||||||
struct fs_context *fsc)
|
|
||||||
{
|
|
||||||
int err;
|
|
||||||
|
|
||||||
err = get_anon_bdev(&sb->s_dev);
|
|
||||||
if (!err)
|
|
||||||
fuse_mount_get(fsc->s_fs_info);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int virtio_fs_get_tree(struct fs_context *fsc)
|
static int virtio_fs_get_tree(struct fs_context *fsc)
|
||||||
{
|
{
|
||||||
struct virtio_fs *fs;
|
struct virtio_fs *fs;
|
||||||
@ -1456,8 +1444,9 @@ static int virtio_fs_get_tree(struct fs_context *fsc)
|
|||||||
fc->auto_submounts = true;
|
fc->auto_submounts = true;
|
||||||
|
|
||||||
fsc->s_fs_info = fm;
|
fsc->s_fs_info = fm;
|
||||||
sb = sget_fc(fsc, virtio_fs_test_super, virtio_fs_set_super);
|
sb = sget_fc(fsc, virtio_fs_test_super, set_anon_super_fc);
|
||||||
fuse_mount_put(fm);
|
if (fsc->s_fs_info)
|
||||||
|
fuse_mount_put(fm);
|
||||||
if (IS_ERR(sb))
|
if (IS_ERR(sb))
|
||||||
return PTR_ERR(sb);
|
return PTR_ERR(sb);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user