Skip to content

Commit

Permalink
switch btrfs to inode->i_acl
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Jun 24, 2009
1 parent 290c263 commit 5affd88
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 27 deletions.
14 changes: 7 additions & 7 deletions fs/btrfs/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static void btrfs_update_cached_acl(struct inode *inode,
struct posix_acl *acl)
{
spin_lock(&inode->i_lock);
if (*p_acl && *p_acl != BTRFS_ACL_NOT_CACHED)
if (*p_acl && *p_acl != ACL_NOT_CACHED)
posix_acl_release(*p_acl);
*p_acl = posix_acl_dup(acl);
spin_unlock(&inode->i_lock);
Expand All @@ -50,11 +50,11 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
switch (type) {
case ACL_TYPE_ACCESS:
name = POSIX_ACL_XATTR_ACCESS;
p_acl = &BTRFS_I(inode)->i_acl;
p_acl = &inode->i_acl;
break;
case ACL_TYPE_DEFAULT:
name = POSIX_ACL_XATTR_DEFAULT;
p_acl = &BTRFS_I(inode)->i_default_acl;
p_acl = &inode->i_default_acl;
break;
default:
return ERR_PTR(-EINVAL);
Expand All @@ -67,11 +67,11 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)

spin_lock(&inode->i_lock);
acl = *p_acl;
if (acl != BTRFS_ACL_NOT_CACHED)
if (acl != ACL_NOT_CACHED)
acl = posix_acl_dup(acl);
spin_unlock(&inode->i_lock);

if (acl != BTRFS_ACL_NOT_CACHED)
if (acl != ACL_NOT_CACHED)
return acl;

size = __btrfs_getxattr(inode, name, "", 0);
Expand Down Expand Up @@ -141,13 +141,13 @@ static int btrfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
ret = 0;
inode->i_mode = mode;
name = POSIX_ACL_XATTR_ACCESS;
p_acl = &BTRFS_I(inode)->i_acl;
p_acl = &inode->i_acl;
break;
case ACL_TYPE_DEFAULT:
if (!S_ISDIR(inode->i_mode))
return acl ? -EINVAL : 0;
name = POSIX_ACL_XATTR_DEFAULT;
p_acl = &BTRFS_I(inode)->i_default_acl;
p_acl = &inode->i_default_acl;
break;
default:
return -EINVAL;
Expand Down
4 changes: 0 additions & 4 deletions fs/btrfs/btrfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ struct btrfs_inode {
/* used to order data wrt metadata */
struct btrfs_ordered_inode_tree ordered_tree;

/* standard acl pointers */
struct posix_acl *i_acl;
struct posix_acl *i_default_acl;

/* for keeping track of orphaned inodes */
struct list_head i_orphan;

Expand Down
2 changes: 0 additions & 2 deletions fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ struct btrfs_ordered_sum;

#define BTRFS_MAGIC "_BHRfS_M"

#define BTRFS_ACL_NOT_CACHED ((void *)-1)

#define BTRFS_MAX_LEVEL 8

#define BTRFS_COMPAT_EXTENT_TREE_V0
Expand Down
16 changes: 2 additions & 14 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2123,8 +2123,8 @@ static void btrfs_read_locked_inode(struct inode *inode)
*/
maybe_acls = acls_after_inode_item(leaf, path->slots[0], inode->i_ino);
if (!maybe_acls) {
BTRFS_I(inode)->i_acl = NULL;
BTRFS_I(inode)->i_default_acl = NULL;
inode->i_acl = NULL;
inode->i_default_acl = NULL;
}

BTRFS_I(inode)->block_group = btrfs_find_block_group(root, 0,
Expand Down Expand Up @@ -3141,9 +3141,6 @@ static noinline void init_btrfs_i(struct inode *inode)
{
struct btrfs_inode *bi = BTRFS_I(inode);

bi->i_acl = BTRFS_ACL_NOT_CACHED;
bi->i_default_acl = BTRFS_ACL_NOT_CACHED;

bi->generation = 0;
bi->sequence = 0;
bi->last_trans = 0;
Expand Down Expand Up @@ -4640,8 +4637,6 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
ei->last_trans = 0;
ei->logged_trans = 0;
btrfs_ordered_inode_tree_init(&ei->ordered_tree);
ei->i_acl = BTRFS_ACL_NOT_CACHED;
ei->i_default_acl = BTRFS_ACL_NOT_CACHED;
INIT_LIST_HEAD(&ei->i_orphan);
INIT_LIST_HEAD(&ei->ordered_operations);
return &ei->vfs_inode;
Expand All @@ -4655,13 +4650,6 @@ void btrfs_destroy_inode(struct inode *inode)
WARN_ON(!list_empty(&inode->i_dentry));
WARN_ON(inode->i_data.nrpages);

if (BTRFS_I(inode)->i_acl &&
BTRFS_I(inode)->i_acl != BTRFS_ACL_NOT_CACHED)
posix_acl_release(BTRFS_I(inode)->i_acl);
if (BTRFS_I(inode)->i_default_acl &&
BTRFS_I(inode)->i_default_acl != BTRFS_ACL_NOT_CACHED)
posix_acl_release(BTRFS_I(inode)->i_default_acl);

/*
* Make sure we're properly removed from the ordered operation
* lists.
Expand Down

0 comments on commit 5affd88

Please sign in to comment.