kill xfs_getattr
PATCH 1/1 kill xfs_getattr
It's currently used by the ACL code to read di_mode/di_uid, but these are simple 32bit scalar values we can just read directly without locking.
Signed-off-by Christoph Hellwig <[email protected]>
fs/xfs/xfs_acl.c +7 -33
@@ -238,15 +238,8 @@ xfs_acl_vget( error =EINVAL ; goto out; } -if (kind == _ACL_TYPE_ACCESS) { -bhv_vattr_t va; - - va.va_mask =XFS_AT_MODE ; - error =xfs_getattr (xfs_vtoi (vp), &va,0 ); -if (error) - goto out; -xfs_acl_sync_mode (va.va_mode, xfs_acl); - } +if (kind == _ACL_TYPE_ACCESS) +xfs_acl_sync_mode (xfs_vtoi (vp)->i_d.di_mode, xfs_acl); error = -posix_acl_xfs_to_xattr (xfs_acl, ext_acl, size); } out:
@@ -373,23 +366,15 @@ xfs_acl_allow_set( bhv_vnode_t *vp, int kind) { -xfs_inode_t *ip =xfs_vtoi (vp); -bhv_vattr_t va; -int error; -if (vp->i_flags & (S_IMMUTABLE |S_APPEND ))return EPERM ;if (kind == _ACL_TYPE_DEFAULT && !S_ISDIR (vp->i_mode))return ENOTDIR ;if (vp->i_sb->s_flags &MS_RDONLY )return EROFS ; - va.va_mask =XFS_AT_UID ; - error =xfs_getattr (ip, &va,0 ); -if (error) -return error; -if (va.va_uid != current->fsuid && !capable (CAP_FOWNER )) +if (xfs_vtoi (vp)->i_d.di_uid != current->fsuid && !capable (CAP_FOWNER ))return EPERM ; -return error; +return 0 ; }/*
@@ -644,7 +629,6 @@ xfs_acl_vtoacl( xfs_acl_t *access_acl, xfs_acl_t *default_acl) { -bhv_vattr_t va;int error =0 ;if (access_acl) {
@@ -653,16 +637,10 @@ xfs_acl_vtoacl(* be obtained for some reason, invalidate the access ACL. */ xfs_acl_get_attr (vp, access_acl, _ACL_TYPE_ACCESS,0 , &error); -if (!error) { -/* Got the ACL, need the mode... */ - va.va_mask =XFS_AT_MODE ; - error =xfs_getattr (xfs_vtoi (vp), &va,0 ); - } -if (error) access_acl->acl_cnt =XFS_ACL_NOT_PRESENT ;else /* We have a good ACL and the file mode, synchronize. */ -xfs_acl_sync_mode (va.va_mode, access_acl); +xfs_acl_sync_mode (xfs_vtoi (vp)->i_d.di_mode, access_acl); }if (default_acl) {
@@ -745,7 +723,7 @@ xfs_acl_setmode(bhv_vattr_t va;xfs_acl_entry_t *ap;xfs_acl_entry_t *gap =NULL ; -int i, error, nomask =1 ; +int i, nomask =1 ; *basicperms =1 ;
@@ -757,11 +735,7 @@ xfs_acl_setmode(* mode. The m:: bits take precedence over the g:: bits. */ va.va_mask =XFS_AT_MODE ; - error =xfs_getattr (xfs_vtoi (vp), &va,0 ); -if (error) -return error; - - va.va_mask =XFS_AT_MODE ; + va.va_mode =xfs_vtoi (vp)->i_d.di_mode; va.va_mode &= ~(S_IRWXU |S_IRWXG |S_IRWXO ); ap = acl->acl_entry;for (i =0 ; i < acl->acl_cnt; ++i) {
fs/xfs/xfs_vnodeops.c +0 -126
132 lines not on this page · raw message
fs/xfs/xfs_vnodeops.h +0 -1
@@ -15,7 +15,6 @@ struct xfs_iomap;int xfs_open (struct xfs_inode *ip); -int xfs_getattr (struct xfs_inode *ip,struct bhv_vattr *vap,int flags);int xfs_setattr (struct xfs_inode *ip,struct bhv_vattr *vap,int flags,struct cred *credp);int xfs_readlink (struct xfs_inode *ip,char *link);