mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 10:54:35 +03:00
linux/vfsops: add vfs_t allocator, make public
In a few commits, we're going to need to allocate and free vfs_t from zpl_super.c as well, so lets keep them uniform. Sponsored-by: TrueNAS Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <rob.norris@truenas.com> Closes #18377
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2013, 2018 by Delphix. All rights reserved.
|
* Copyright (c) 2013, 2018 by Delphix. All rights reserved.
|
||||||
|
* Copyright (c) 2026, TrueNAS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SYS_FS_ZFS_VFSOPS_H
|
#ifndef _SYS_FS_ZFS_VFSOPS_H
|
||||||
@@ -245,6 +246,9 @@ extern int zfsvfs_create_impl(zfsvfs_t **zfvp, zfsvfs_t *zfsvfs, objset_t *os);
|
|||||||
extern void zfsvfs_free(zfsvfs_t *zfsvfs);
|
extern void zfsvfs_free(zfsvfs_t *zfsvfs);
|
||||||
extern int zfs_check_global_label(const char *dsname, const char *hexsl);
|
extern int zfs_check_global_label(const char *dsname, const char *hexsl);
|
||||||
|
|
||||||
|
extern vfs_t *zfsvfs_vfs_alloc(void);
|
||||||
|
extern void zfsvfs_vfs_free(vfs_t *vfsp);
|
||||||
|
|
||||||
extern boolean_t zfs_is_readonly(zfsvfs_t *zfsvfs);
|
extern boolean_t zfs_is_readonly(zfsvfs_t *zfsvfs);
|
||||||
extern int zfs_domount(struct super_block *sb, zfs_mnt_t *zm, int silent);
|
extern int zfs_domount(struct super_block *sb, zfs_mnt_t *zm, int silent);
|
||||||
extern void zfs_preumount(struct super_block *sb);
|
extern void zfs_preumount(struct super_block *sb);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012, 2018 by Delphix. All rights reserved.
|
* Copyright (c) 2012, 2018 by Delphix. All rights reserved.
|
||||||
|
* Copyright (c) 2026, TrueNAS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Portions Copyright 2010 Robert Milkowski */
|
/* Portions Copyright 2010 Robert Milkowski */
|
||||||
@@ -110,7 +111,15 @@ static const match_table_t zpl_tokens = {
|
|||||||
{ TOKEN_LAST, NULL },
|
{ TOKEN_LAST, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
vfs_t *
|
||||||
|
zfsvfs_vfs_alloc(void)
|
||||||
|
{
|
||||||
|
vfs_t *vfsp = kmem_zalloc(sizeof (vfs_t), KM_SLEEP);
|
||||||
|
mutex_init(&vfsp->vfs_mntpt_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||||
|
return (vfsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
zfsvfs_vfs_free(vfs_t *vfsp)
|
zfsvfs_vfs_free(vfs_t *vfsp)
|
||||||
{
|
{
|
||||||
if (vfsp != NULL) {
|
if (vfsp != NULL) {
|
||||||
@@ -220,8 +229,7 @@ zfsvfs_parse_options(char *mntopts, vfs_t **vfsp)
|
|||||||
vfs_t *tmp_vfsp;
|
vfs_t *tmp_vfsp;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
tmp_vfsp = kmem_zalloc(sizeof (vfs_t), KM_SLEEP);
|
tmp_vfsp = zfsvfs_vfs_alloc();
|
||||||
mutex_init(&tmp_vfsp->vfs_mntpt_lock, NULL, MUTEX_DEFAULT, NULL);
|
|
||||||
|
|
||||||
if (mntopts != NULL) {
|
if (mntopts != NULL) {
|
||||||
substring_t args[MAX_OPT_ARGS];
|
substring_t args[MAX_OPT_ARGS];
|
||||||
|
|||||||
Reference in New Issue
Block a user