Skip to content

Commit

Permalink
switch reiserfs to usual conventions for caching ACLs
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 e68888b commit 7a77b15
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
12 changes: 6 additions & 6 deletions fs/reiserfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,8 @@ static void init_once(void *foo)
INIT_LIST_HEAD(&ei->i_prealloc_list);
inode_init_once(&ei->vfs_inode);
#ifdef CONFIG_REISERFS_FS_POSIX_ACL
ei->i_acl_access = NULL;
ei->i_acl_default = NULL;
ei->i_acl_access = ACL_NOT_CACHED;
ei->i_acl_default = ACL_NOT_CACHED;
#endif
}

Expand Down Expand Up @@ -586,14 +586,14 @@ static void reiserfs_clear_inode(struct inode *inode)
struct posix_acl *acl;

acl = REISERFS_I(inode)->i_acl_access;
if (acl && !IS_ERR(acl))
if (acl && acl != ACL_NOT_CACHED)
posix_acl_release(acl);
REISERFS_I(inode)->i_acl_access = NULL;
REISERFS_I(inode)->i_acl_access = ACL_NOT_CACHED;

acl = REISERFS_I(inode)->i_acl_default;
if (acl && !IS_ERR(acl))
if (acl && acl != ACL_NOT_CACHED)
posix_acl_release(acl);
REISERFS_I(inode)->i_acl_default = NULL;
REISERFS_I(inode)->i_acl_default = ACL_NOT_CACHED;
}
#else
#define reiserfs_clear_inode NULL
Expand Down
21 changes: 8 additions & 13 deletions fs/reiserfs/xattr_acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,19 @@ static inline void iset_acl(struct inode *inode, struct posix_acl **i_acl,
struct posix_acl *acl)
{
spin_lock(&inode->i_lock);
if (*i_acl != ERR_PTR(-ENODATA))
if (*i_acl != ACL_NOT_CACHED)
posix_acl_release(*i_acl);
*i_acl = acl ? posix_acl_dup(acl) : ERR_PTR(-ENODATA);
*i_acl = posix_acl_dup(acl);
spin_unlock(&inode->i_lock);
}

static inline struct posix_acl *iget_acl(struct inode *inode,
struct posix_acl **i_acl)
{
struct posix_acl *acl = ERR_PTR(-ENODATA);
struct posix_acl *acl = ACL_NOT_CACHED;

spin_lock(&inode->i_lock);
if (*i_acl != ERR_PTR(-ENODATA))
if (*i_acl != ACL_NOT_CACHED)
acl = posix_acl_dup(*i_acl);
spin_unlock(&inode->i_lock);

Expand Down Expand Up @@ -239,15 +239,13 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
}

acl = iget_acl(inode, p_acl);
if (acl && !IS_ERR(acl))
if (acl != ACL_NOT_CACHED)
return acl;
else if (PTR_ERR(acl) == -ENODATA)
return NULL;

size = reiserfs_xattr_get(inode, name, NULL, 0);
if (size < 0) {
if (size == -ENODATA || size == -ENOSYS) {
*p_acl = ERR_PTR(-ENODATA);
*p_acl = NULL;
return NULL;
}
return ERR_PTR(size);
Expand All @@ -262,7 +260,7 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
/* This shouldn't actually happen as it should have
been caught above.. but just in case */
acl = NULL;
*p_acl = ERR_PTR(-ENODATA);
*p_acl = acl;
} else if (retval < 0) {
acl = ERR_PTR(retval);
} else {
Expand Down Expand Up @@ -379,11 +377,8 @@ reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
}

acl = reiserfs_get_acl(dir, ACL_TYPE_DEFAULT);
if (IS_ERR(acl)) {
if (PTR_ERR(acl) == -ENODATA)
goto apply_umask;
if (IS_ERR(acl))
return PTR_ERR(acl);
}

if (acl) {
struct posix_acl *acl_copy;
Expand Down
4 changes: 2 additions & 2 deletions include/linux/reiserfs_acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ extern struct xattr_handler reiserfs_posix_acl_access_handler;

static inline void reiserfs_init_acl_access(struct inode *inode)
{
REISERFS_I(inode)->i_acl_access = NULL;
REISERFS_I(inode)->i_acl_access = ACL_NOT_CACHED;
}

static inline void reiserfs_init_acl_default(struct inode *inode)
{
REISERFS_I(inode)->i_acl_default = NULL;
REISERFS_I(inode)->i_acl_default = ACL_NOT_CACHED;
}
#else

Expand Down

0 comments on commit 7a77b15

Please sign in to comment.