diff options
author | Brian Behlendorf <[email protected]> | 2011-02-08 11:16:06 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-02-10 09:27:21 -0800 |
commit | 3558fd73b5d863304102f6745c26e0b592aca60a (patch) | |
tree | b22e26afbf6c494d34032876fb9be4d21d4e8ed7 /include | |
parent | 6149f4c45fc905761a6f636ea9e14ff76ce6c842 (diff) |
Prototype/structure update for Linux
I appologize in advance why to many things ended up in this commit.
When it could be seperated in to a whole series of commits teasing
that all apart now would take considerable time and I'm not sure
there's much merrit in it. As such I'll just summerize the intent
of the changes which are all (or partly) in this commit. Broadly
the intent is to remove as much Solaris specific code as possible
and replace it with native Linux equivilants. More specifically:
1) Replace all instances of zfsvfs_t with zfs_sb_t. While the
type is largely the same calling it private super block data
rather than a zfsvfs is more consistent with how Linux names
this. While non critical it makes the code easier to read when
your thinking in Linux friendly VFS terms.
2) Replace vnode_t with struct inode. The Linux VFS doesn't have
the notion of a vnode and there's absolutely no good reason to
create one. There are in fact several good reasons to remove it.
It just adds overhead on Linux if we were to manage one, it
conplicates the code, and it likely will lead to bugs so there's
a good change it will be out of date. The code has been updated
to remove all need for this type.
3) Replace all vtype_t's with umode types. Along with this shift
all uses of types to mode bits. The Solaris code would pass a
vtype which is redundant with the Linux mode. Just update all the
code to use the Linux mode macros and remove this redundancy.
4) Remove using of vn_* helpers and replace where needed with
inode helpers. The big example here is creating iput_aync to
replace vn_rele_async. Other vn helpers will be addressed as
needed but they should be be emulated. They are a Solaris VFS'ism
and should simply be replaced with Linux equivilants.
5) Update znode alloc/free code. Under Linux it's common to
embed the inode specific data with the inode itself. This removes
the need for an extra memory allocation. In zfs this information
is called a znode and it now embeds the inode with it. Allocators
have been updated accordingly.
6) Minimal integration with the vfs flags for setting up the
super block and handling mount options has been added this
code will need to be refined but functionally it's all there.
This will be the first and last of these to large to review commits.
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/dsl_pool.h | 4 | ||||
-rw-r--r-- | include/sys/zfs_acl.h | 6 | ||||
-rw-r--r-- | include/sys/zfs_dir.h | 8 | ||||
-rw-r--r-- | include/sys/zfs_fuid.h | 18 | ||||
-rw-r--r-- | include/sys/zfs_vfsops.h | 46 | ||||
-rw-r--r-- | include/sys/zfs_vnops.h | 76 | ||||
-rw-r--r-- | include/sys/zfs_znode.h | 76 |
7 files changed, 120 insertions, 114 deletions
diff --git a/include/sys/dsl_pool.h b/include/sys/dsl_pool.h index 7d25bd7c0..99a131eec 100644 --- a/include/sys/dsl_pool.h +++ b/include/sys/dsl_pool.h @@ -75,7 +75,7 @@ typedef struct dsl_pool { struct dsl_dir *dp_free_dir; struct dsl_dataset *dp_origin_snap; uint64_t dp_root_dir_obj; - struct taskq *dp_vnrele_taskq; + struct taskq *dp_iput_taskq; /* No lock needed - sync context only */ blkptr_t dp_meta_rootbp; @@ -135,7 +135,7 @@ void dsl_pool_create_origin(dsl_pool_t *dp, dmu_tx_t *tx); void dsl_pool_upgrade_clones(dsl_pool_t *dp, dmu_tx_t *tx); void dsl_pool_upgrade_dir_clones(dsl_pool_t *dp, dmu_tx_t *tx); -taskq_t *dsl_pool_vnrele_taskq(dsl_pool_t *dp); +taskq_t *dsl_pool_iput_taskq(dsl_pool_t *dp); extern int dsl_pool_user_hold(dsl_pool_t *dp, uint64_t dsobj, const char *tag, uint64_t *now, dmu_tx_t *tx); diff --git a/include/sys/zfs_acl.h b/include/sys/zfs_acl.h index c1a0aeebd..6f7cef2ad 100644 --- a/include/sys/zfs_acl.h +++ b/include/sys/zfs_acl.h @@ -200,13 +200,13 @@ typedef struct zfs_acl_ids { #define ZFS_ACL_PASSTHROUGH_X 5 struct znode; -struct zfsvfs; +struct zfs_sb; #ifdef _KERNEL int zfs_acl_ids_create(struct znode *, int, vattr_t *, cred_t *, vsecattr_t *, zfs_acl_ids_t *); void zfs_acl_ids_free(zfs_acl_ids_t *); -boolean_t zfs_acl_ids_overquota(struct zfsvfs *, zfs_acl_ids_t *); +boolean_t zfs_acl_ids_overquota(struct zfs_sb *, zfs_acl_ids_t *); int zfs_getacl(struct znode *, vsecattr_t *, boolean_t, cred_t *); int zfs_setacl(struct znode *, vsecattr_t *, boolean_t, cred_t *); void zfs_acl_rele(void *); @@ -223,7 +223,7 @@ int zfs_zaccess_delete(struct znode *, struct znode *, cred_t *); int zfs_zaccess_rename(struct znode *, struct znode *, struct znode *, struct znode *, cred_t *cr); void zfs_acl_free(zfs_acl_t *); -int zfs_vsec_2_aclp(struct zfsvfs *, vtype_t, vsecattr_t *, cred_t *, +int zfs_vsec_2_aclp(struct zfs_sb *, umode_t, vsecattr_t *, cred_t *, struct zfs_fuid_info **, zfs_acl_t **); int zfs_aclset_common(struct znode *, zfs_acl_t *, cred_t *, dmu_tx_t *); uint64_t zfs_external_acl(struct znode *); diff --git a/include/sys/zfs_dir.h b/include/sys/zfs_dir.h index 349f8ef37..8610fbe08 100644 --- a/include/sys/zfs_dir.h +++ b/include/sys/zfs_dir.h @@ -54,7 +54,7 @@ extern void zfs_dirent_unlock(zfs_dirlock_t *); extern int zfs_link_create(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int); extern int zfs_link_destroy(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int, boolean_t *); -extern int zfs_dirlook(znode_t *, char *, vnode_t **, int, int *, +extern int zfs_dirlook(znode_t *, char *, struct inode **, int, int *, pathname_t *); extern void zfs_mknode(znode_t *, vattr_t *, dmu_tx_t *, cred_t *, uint_t, znode_t **, zfs_acl_ids_t *); @@ -62,10 +62,10 @@ extern void zfs_rmnode(znode_t *); extern void zfs_dl_name_switch(zfs_dirlock_t *dl, char *new, char **old); extern boolean_t zfs_dirempty(znode_t *); extern void zfs_unlinked_add(znode_t *, dmu_tx_t *); -extern void zfs_unlinked_drain(zfsvfs_t *zfsvfs); +extern void zfs_unlinked_drain(zfs_sb_t *); extern int zfs_sticky_remove_access(znode_t *, znode_t *, cred_t *cr); -extern int zfs_get_xattrdir(znode_t *, vnode_t **, cred_t *, int); -extern int zfs_make_xattrdir(znode_t *, vattr_t *, vnode_t **, cred_t *); +extern int zfs_get_xattrdir(znode_t *, struct inode **, cred_t *, int); +extern int zfs_make_xattrdir(znode_t *, vattr_t *, struct inode **, cred_t *); #ifdef __cplusplus } diff --git a/include/sys/zfs_fuid.h b/include/sys/zfs_fuid.h index 91650a22d..deaebcc82 100644 --- a/include/sys/zfs_fuid.h +++ b/include/sys/zfs_fuid.h @@ -100,24 +100,24 @@ typedef struct zfs_fuid_info { #ifdef _KERNEL struct znode; -extern uid_t zfs_fuid_map_id(zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t); +extern uid_t zfs_fuid_map_id(zfs_sb_t *, uint64_t, cred_t *, zfs_fuid_type_t); extern void zfs_fuid_node_add(zfs_fuid_info_t **, const char *, uint32_t, uint64_t, uint64_t, zfs_fuid_type_t); -extern void zfs_fuid_destroy(zfsvfs_t *); -extern uint64_t zfs_fuid_create_cred(zfsvfs_t *, zfs_fuid_type_t, +extern void zfs_fuid_destroy(zfs_sb_t *); +extern uint64_t zfs_fuid_create_cred(zfs_sb_t *, zfs_fuid_type_t, cred_t *, zfs_fuid_info_t **); -extern uint64_t zfs_fuid_create(zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t, +extern uint64_t zfs_fuid_create(zfs_sb_t *, uint64_t, cred_t *, zfs_fuid_type_t, zfs_fuid_info_t **); extern void zfs_fuid_map_ids(struct znode *zp, cred_t *cr, uid_t *uid, uid_t *gid); extern zfs_fuid_info_t *zfs_fuid_info_alloc(void); extern void zfs_fuid_info_free(zfs_fuid_info_t *); -extern boolean_t zfs_groupmember(zfsvfs_t *, uint64_t, cred_t *); -void zfs_fuid_sync(zfsvfs_t *, dmu_tx_t *); -extern int zfs_fuid_find_by_domain(zfsvfs_t *, const char *domain, +extern boolean_t zfs_groupmember(zfs_sb_t *, uint64_t, cred_t *); +void zfs_fuid_sync(zfs_sb_t *, dmu_tx_t *); +extern int zfs_fuid_find_by_domain(zfs_sb_t *, const char *domain, char **retdomain, boolean_t addok); -extern const char *zfs_fuid_find_by_idx(zfsvfs_t *zfsvfs, uint32_t idx); -extern void zfs_fuid_txhold(zfsvfs_t *zfsvfs, dmu_tx_t *tx); +extern const char *zfs_fuid_find_by_idx(zfs_sb_t *zsb, uint32_t idx); +extern void zfs_fuid_txhold(zfs_sb_t *zsb, dmu_tx_t *tx); #endif char *zfs_fuid_idx_domain(avl_tree_t *, uint32_t); diff --git a/include/sys/zfs_vfsops.h b/include/sys/zfs_vfsops.h index 34a871587..a2f00acf0 100644 --- a/include/sys/zfs_vfsops.h +++ b/include/sys/zfs_vfsops.h @@ -38,13 +38,15 @@ extern "C" { #endif -typedef struct zfsvfs zfsvfs_t; +struct zfs_sb; struct znode; -struct zfsvfs { - vfs_t *z_vfs; /* generic fs struct */ - zfsvfs_t *z_parent; /* parent fs */ +typedef struct zfs_sb { + struct vfsmount *z_vfs; /* generic vfs struct */ + struct super_block *z_sb; /* generic super_block */ + struct zfs_sb *z_parent; /* parent fs */ objset_t *z_os; /* objset reference */ + uint64_t z_flags; /* super_block flags */ uint64_t z_root; /* id of root znode */ uint64_t z_unlinkedobj; /* id of unlinked zapobj */ uint64_t z_max_blksz; /* maximum block size for files */ @@ -87,6 +89,8 @@ struct zfsvfs { #define ZFS_SUPER_MAGIC 0x2fc12fc1 +#define ZSB_XATTR_USER 0x0001 /* Enable user xattrs */ + /* * Minimal snapshot helpers, the bulk of the Linux snapshot implementation @@ -162,30 +166,30 @@ typedef struct zfid_long { extern uint_t zfs_fsyncer_key; -extern int zfs_suspend_fs(zfsvfs_t *zfsvfs); -extern int zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname); -extern int zfs_userspace_one(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, +extern int zfs_suspend_fs(zfs_sb_t *zsb); +extern int zfs_resume_fs(zfs_sb_t *zsb, const char *osname); +extern int zfs_userspace_one(zfs_sb_t *zsb, zfs_userquota_prop_t type, const char *domain, uint64_t rid, uint64_t *valuep); -extern int zfs_userspace_many(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, +extern int zfs_userspace_many(zfs_sb_t *zsb, zfs_userquota_prop_t type, uint64_t *cookiep, void *vbuf, uint64_t *bufsizep); -extern int zfs_set_userquota(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, +extern int zfs_set_userquota(zfs_sb_t *zsb, zfs_userquota_prop_t type, const char *domain, uint64_t rid, uint64_t quota); -extern boolean_t zfs_owner_overquota(zfsvfs_t *zfsvfs, struct znode *, +extern boolean_t zfs_owner_overquota(zfs_sb_t *zsb, struct znode *, boolean_t isgroup); -extern boolean_t zfs_fuid_overquota(zfsvfs_t *zfsvfs, boolean_t isgroup, +extern boolean_t zfs_fuid_overquota(zfs_sb_t *zsb, boolean_t isgroup, uint64_t fuid); -extern int zfs_set_version(zfsvfs_t *zfsvfs, uint64_t newvers); -extern int zfsvfs_create(const char *name, zfsvfs_t **zfvp); -extern void zfsvfs_free(zfsvfs_t *zfsvfs); +extern int zfs_set_version(zfs_sb_t *zsb, uint64_t newvers); +extern int zfs_sb_create(const char *name, zfs_sb_t **zsbp); +extern void zfs_sb_free(zfs_sb_t *zsb); extern int zfs_check_global_label(const char *dsname, const char *hexsl); -extern int zfs_register_callbacks(vfs_t *vfsp); -extern void zfs_unregister_callbacks(zfsvfs_t *zfsvfs); -extern int zfs_domount(vfs_t *vfsp, char *osname); -extern int zfs_umount(vfs_t *vfsp, int fflag, cred_t *cr); -extern int zfs_root(vfs_t *vfsp, vnode_t **vpp); -extern int zfs_statvfs(vfs_t *vfsp, struct statvfs64 *statp); -extern int zfs_vget(vfs_t *vfsp, vnode_t **vpp, fid_t *fidp); +extern int zfs_register_callbacks(zfs_sb_t *zsb); +extern void zfs_unregister_callbacks(zfs_sb_t *zsb); +extern int zfs_domount(struct super_block *sb, void *data, int silent); +extern int zfs_umount(struct super_block *sb); +extern int zfs_root(zfs_sb_t *zsb, struct inode **ipp); +extern int zfs_statvfs(struct dentry *dentry, struct kstatfs *statp); +extern int zfs_vget(struct vfsmount *vfsp, struct inode **ipp, fid_t *fidp); #ifdef __cplusplus } diff --git a/include/sys/zfs_vnops.h b/include/sys/zfs_vnops.h index 64e2210de..2cacb9c6f 100644 --- a/include/sys/zfs_vnops.h +++ b/include/sys/zfs_vnops.h @@ -28,50 +28,48 @@ #include <sys/vnode.h> #include <sys/uio.h> #include <sys/cred.h> +#include <sys/fcntl.h> +#include <sys/pathname.h> #ifdef __cplusplus extern "C" { #endif -extern int zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, - caller_context_t *ct); -extern int zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, - caller_context_t *ct); -extern int zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, - struct pathname *pnp, int flags, vnode_t *rdir, cred_t *cr, - caller_context_t *ct, int *direntflags, pathname_t *realpnp); -extern int zfs_create(vnode_t *dvp, char *name, vattr_t *vap, - int excl, int mode, vnode_t **vpp, cred_t *cr, int flag, - caller_context_t *ct, vsecattr_t *vsecp); -extern int zfs_remove(vnode_t *dvp, char *name, cred_t *cr, - caller_context_t *ct, int flags); -extern int zfs_mkdir(vnode_t *dvp, char *dirname, vattr_t *vap, - vnode_t **vpp, cred_t *cr, caller_context_t *ct, int flags, - vsecattr_t *vsecp); -extern int zfs_rmdir(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr, - caller_context_t *ct, int flags); -extern int zfs_fsync(vnode_t *vp, int syncflag, cred_t *cr, - caller_context_t *ct); -extern int zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, - caller_context_t *ct); -extern int zfs_setattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, - caller_context_t *ct); -extern int zfs_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, - cred_t *cr, caller_context_t *ct, int flags); -extern int zfs_symlink(vnode_t *dvp, char *name, vattr_t *vap, char *link, - cred_t *cr, caller_context_t *ct, int flags); -extern int zfs_readlink(vnode_t *vp, uio_t *uio, cred_t *cr, - caller_context_t *ct); -extern int zfs_link(vnode_t *tdvp, vnode_t *svp, char *name, cred_t *cr, - caller_context_t *ct, int flags); -extern void zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct); -extern int zfs_space(vnode_t *vp, int cmd, flock64_t *bfp, int flag, - offset_t offset, cred_t *cr, caller_context_t *ct); -extern int zfs_fid(vnode_t *vp, fid_t *fidp, caller_context_t *ct); -extern int zfs_getsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, - cred_t *cr, caller_context_t *ct); -extern int zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, - cred_t *cr, caller_context_t *ct); +extern int zfs_read(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr); +extern int zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr); +extern int zfs_access(struct inode *ip, int mode, int flag, cred_t *cr); +extern int zfs_lookup(struct inode *dip, char *nm, struct inode **ipp, + int flags, cred_t *cr, int *direntflags, pathname_t *realpnp); +extern int zfs_create(struct inode *dip, char *name, vattr_t *vap, int excl, + int mode, struct inode **ipp, cred_t *cr, int flag, vsecattr_t *vsecp); +extern int zfs_remove(struct inode *dip, char *name, cred_t *cr); +extern int zfs_mkdir(struct inode *dip, char *dirname, vattr_t *vap, + struct inode **ipp, cred_t *cr, int flags, vsecattr_t *vsecp); +extern int zfs_rmdir(struct inode *dip, char *name, struct inode *cwd, + cred_t *cr, int flags); +extern int zfs_readdir(struct inode *ip, void *dirent, filldir_t filldir, + loff_t *pos, cred_t *cr); +extern int zfs_fsync(struct inode *ip, int syncflag, cred_t *cr); +extern int zfs_getattr(struct inode *ip, struct kstat *stat, int flag, + cred_t *cr); +extern int zfs_setattr(struct inode *ip, struct iattr *attr, int flag, + cred_t *cr); +extern int zfs_rename(struct inode *sdip, char *snm, struct inode *tdip, + char *tnm, cred_t *cr, int flags); +extern int zfs_symlink(struct inode *dip, char *name, vattr_t *vap, + char *link, struct inode **ipp, cred_t *cr, int flags); +extern int zfs_follow_link(struct dentry *dentry, struct nameidata *nd); +extern int zfs_readlink(struct inode *ip, uio_t *uio, cred_t *cr); +extern int zfs_link(struct inode *tdip, struct inode *sip, + char *name, cred_t *cr); +extern void zfs_inactive(struct inode *ip); +extern int zfs_space(struct inode *ip, int cmd, flock64_t *bfp, int flag, + offset_t offset, cred_t *cr); +extern int zfs_fid(struct inode *ip, fid_t *fidp); +extern int zfs_getsecattr(struct inode *ip, vsecattr_t *vsecp, int flag, + cred_t *cr); +extern int zfs_setsecattr(struct inode *ip, vsecattr_t *vsecp, int flag, + cred_t *cr); #ifdef __cplusplus } diff --git a/include/sys/zfs_znode.h b/include/sys/zfs_znode.h index 4dbecb4b5..2f25cc7fe 100644 --- a/include/sys/zfs_znode.h +++ b/include/sys/zfs_znode.h @@ -69,7 +69,7 @@ extern "C" { pflags |= attr; \ else \ pflags &= ~attr; \ - VERIFY(0 == sa_update(zp->z_sa_hdl, SA_ZPL_FLAGS(zp->z_zfsvfs), \ + VERIFY(0 == sa_update(zp->z_sa_hdl, SA_ZPL_FLAGS(zp->z_sb), \ &pflags, sizeof (pflags), tx)); \ } @@ -181,8 +181,6 @@ typedef struct zfs_dirlock { } zfs_dirlock_t; typedef struct znode { - struct zfsvfs *z_zfsvfs; - vnode_t *z_vnode; uint64_t z_id; /* object ID for this znode */ kmutex_t z_lock; /* znode modification lock */ krwlock_t z_parent_lock; /* parent lock for directories */ @@ -235,48 +233,52 @@ typedef struct znode { /* * Convert between znode pointers and inode pointers */ -#define ZTOI(ZP) (&((ZP)->z_inode)) -#define ITOZ(IP) (container_of((IP), znode_t, z_inode)) - -/* XXX - REMOVE ME ONCE THE OTHER BUILD ISSUES ARE RESOLVED */ -#define ZTOV(ZP) ((ZP)->z_vnode) -#define VTOZ(VP) ((znode_t *)(VP)->v_data) +#define ZTOI(znode) (&((znode)->z_inode)) +#define ITOZ(inode) (container_of((inode), znode_t, z_inode)) +#define VTOZSB(vfs) ((zfs_sb_t *)((vfs)->mnt_sb->s_fs_info)) +#define ZTOZSB(znode) ((zfs_sb_t *)(ZTOI(znode)->i_sb->s_fs_info)) +#define ITOZSB(inode) ((zfs_sb_t *)((inode)->i_sb->s_fs_info)) +#define S_ISDEV(mode) (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode)) /* * ZFS_ENTER() is called on entry to each ZFS inode and vfs operation. * ZFS_EXIT() must be called before exitting the vop. * ZFS_VERIFY_ZP() verifies the znode is valid. */ -#define ZFS_ENTER(zfsvfs) \ +#define ZFS_ENTER(zsb) \ { \ - rrw_enter(&(zfsvfs)->z_teardown_lock, RW_READER, FTAG); \ - if ((zfsvfs)->z_unmounted) { \ - ZFS_EXIT(zfsvfs); \ + rrw_enter(&(zsb)->z_teardown_lock, RW_READER, FTAG); \ + if ((zsb)->z_unmounted) { \ + ZFS_EXIT(zsb); \ return (EIO); \ } \ } -#define ZFS_EXIT(zfsvfs) rrw_exit(&(zfsvfs)->z_teardown_lock, FTAG) +#define ZFS_EXIT(zsb) \ + { \ + rrw_exit(&(zsb)->z_teardown_lock, FTAG); \ + tsd_exit(); \ + } #define ZFS_VERIFY_ZP(zp) \ if ((zp)->z_sa_hdl == NULL) { \ - ZFS_EXIT((zp)->z_zfsvfs); \ + ZFS_EXIT(ZTOZSB(zp)); \ return (EIO); \ - } \ + } /* * Macros for dealing with dmu_buf_hold */ #define ZFS_OBJ_HASH(obj_num) ((obj_num) & (ZFS_OBJ_MTX_SZ - 1)) -#define ZFS_OBJ_MUTEX(zfsvfs, obj_num) \ - (&(zfsvfs)->z_hold_mtx[ZFS_OBJ_HASH(obj_num)]) -#define ZFS_OBJ_HOLD_ENTER(zfsvfs, obj_num) \ - mutex_enter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) -#define ZFS_OBJ_HOLD_TRYENTER(zfsvfs, obj_num) \ - mutex_tryenter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) -#define ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num) \ - mutex_exit(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) +#define ZFS_OBJ_MUTEX(zsb, obj_num) \ + (&(zsb)->z_hold_mtx[ZFS_OBJ_HASH(obj_num)]) +#define ZFS_OBJ_HOLD_ENTER(zsb, obj_num) \ + mutex_enter(ZFS_OBJ_MUTEX((zsb), (obj_num))) +#define ZFS_OBJ_HOLD_TRYENTER(zsb, obj_num) \ + mutex_tryenter(ZFS_OBJ_MUTEX((zsb), (obj_num))) +#define ZFS_OBJ_HOLD_EXIT(zsb, obj_num) \ + mutex_exit(ZFS_OBJ_MUTEX((zsb), (obj_num))) /* * Macros to encode/decode ZFS stored time values from/to struct timespec @@ -296,15 +298,15 @@ typedef struct znode { /* * Timestamp defines */ -#define ACCESSED (AT_ATIME) -#define STATE_CHANGED (AT_CTIME) -#define CONTENT_MODIFIED (AT_MTIME | AT_CTIME) +#define ACCESSED (ATTR_ATIME) +#define STATE_CHANGED (ATTR_CTIME) +#define CONTENT_MODIFIED (ATTR_MTIME | ATTR_CTIME) -#define ZFS_ACCESSTIME_STAMP(zfsvfs, zp) \ - if ((zfsvfs)->z_atime && !((zfsvfs)->z_vfs->vfs_flag & VFS_RDONLY)) \ +#define ZFS_ACCESSTIME_STAMP(zsb, zp) \ + if ((zsb)->z_atime && !((zsb)->z_vfs->mnt_flags & MNT_READONLY)) \ zfs_tstamp_update_setup(zp, ACCESSED, NULL, NULL, B_FALSE); -extern int zfs_init_fs(zfsvfs_t *, znode_t **); +extern int zfs_init_fs(zfs_sb_t *, znode_t **); extern void zfs_set_dataprop(objset_t *); extern void zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *, dmu_tx_t *tx); @@ -314,18 +316,19 @@ extern void zfs_grow_blocksize(znode_t *, uint64_t, dmu_tx_t *); extern int zfs_freesp(znode_t *, uint64_t, uint64_t, int, boolean_t); extern void zfs_znode_init(void); extern void zfs_znode_fini(void); -extern int zfs_zget(zfsvfs_t *, uint64_t, znode_t **); +extern int zfs_zget(zfs_sb_t *, uint64_t, znode_t **); extern int zfs_rezget(znode_t *); extern void zfs_zinactive(znode_t *); extern void zfs_znode_delete(znode_t *, dmu_tx_t *); -extern void zfs_znode_free(znode_t *); extern void zfs_remove_op_tables(void); extern int zfs_create_op_tables(void); -extern int zfs_sync(vfs_t *vfsp, short flag, cred_t *cr); +extern int zfs_sync(zfs_sb_t *, short, cred_t *); extern dev_t zfs_cmpldev(uint64_t); extern int zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value); extern int zfs_get_stats(objset_t *os, nvlist_t *nv); extern void zfs_znode_dmu_fini(znode_t *); +extern int zfs_inode_alloc(struct super_block *, struct inode **ip); +extern void zfs_inode_destroy(struct inode *); extern void zfs_inode_update(znode_t *); extern void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, @@ -347,12 +350,13 @@ extern void zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype, extern void zfs_log_truncate(zilog_t *zilog, dmu_tx_t *tx, int txtype, znode_t *zp, uint64_t off, uint64_t len); extern void zfs_log_setattr(zilog_t *zilog, dmu_tx_t *tx, int txtype, - znode_t *zp, vattr_t *vap, uint_t mask_applied, zfs_fuid_info_t *fuidp); + znode_t *zp, struct iattr *attr, uint_t mask_applied, + zfs_fuid_info_t *fuidp); extern void zfs_log_acl(zilog_t *zilog, dmu_tx_t *tx, znode_t *zp, vsecattr_t *vsecp, zfs_fuid_info_t *fuidp); extern void zfs_xvattr_set(znode_t *zp, xvattr_t *xvap, dmu_tx_t *tx); -extern void zfs_upgrade(zfsvfs_t *zfsvfs, dmu_tx_t *tx); -extern int zfs_create_share_dir(zfsvfs_t *zfsvfs, dmu_tx_t *tx); +extern void zfs_upgrade(zfs_sb_t *zsb, dmu_tx_t *tx); +extern int zfs_create_share_dir(zfs_sb_t *zsb, dmu_tx_t *tx); #if defined(HAVE_UIO_RW) extern caddr_t zfs_map_page(page_t *, enum seg_rw); |