Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114382
b: refs/heads/master
c: 8154da3
h: refs/heads/master
v: v3
  • Loading branch information
Tiger Yang authored and Mark Fasheh committed Oct 13, 2008
1 parent 8e6d947 commit 7c8a761
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a394425643e1e9c3a624d629fc8ba5633d8474c6
refs/heads/master: 8154da3d2114241cf3edb108b43e2172be86d483
7 changes: 7 additions & 0 deletions trunk/fs/ocfs2/ocfs2.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,13 @@ static inline int ocfs2_supports_inline_data(struct ocfs2_super *osb)
return 0;
}

static inline int ocfs2_supports_xattr(struct ocfs2_super *osb)
{
if (osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR)
return 1;
return 0;
}

/* set / clear functions because cluster events can make these happen
* in parallel so we want the transitions to be atomic. this also
* means that any future flags osb_flags must be protected by spinlock
Expand Down
19 changes: 13 additions & 6 deletions trunk/fs/ocfs2/ocfs2_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
| OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC \
| OCFS2_FEATURE_INCOMPAT_INLINE_DATA \
| OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP \
| OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK)
| OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK \
| OCFS2_FEATURE_INCOMPAT_XATTR)
#define OCFS2_FEATURE_RO_COMPAT_SUPP OCFS2_FEATURE_RO_COMPAT_UNWRITTEN

/*
Expand Down Expand Up @@ -128,10 +129,6 @@
/* Support for data packed into inode blocks */
#define OCFS2_FEATURE_INCOMPAT_INLINE_DATA 0x0040

/* Support for the extended slot map */
#define OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP 0x100


/*
* Support for alternate, userspace cluster stacks. If set, the superblock
* field s_cluster_info contains a tag for the alternate stack in use as
Expand All @@ -143,6 +140,12 @@
*/
#define OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK 0x0080

/* Support for the extended slot map */
#define OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP 0x100

/* Support for extended attributes */
#define OCFS2_FEATURE_INCOMPAT_XATTR 0x0200

/*
* backup superblock flag is used to indicate that this volume
* has backup superblocks.
Expand Down Expand Up @@ -578,7 +581,11 @@ struct ocfs2_super_block {
/*A0*/ struct ocfs2_cluster_info s_cluster_info; /* Selected userspace
stack. Only valid
with INCOMPAT flag. */
/*B8*/ __le64 s_reserved2[17]; /* Fill out superblock */
/*B8*/ __le16 s_xattr_inline_size; /* extended attribute inline size
for this fs*/
__le16 s_reserved0;
__le32 s_reserved1;
/*C0*/ __le64 s_reserved2[16]; /* Fill out superblock */
/*140*/

/*
Expand Down
3 changes: 2 additions & 1 deletion trunk/fs/ocfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,8 @@ static int ocfs2_initialize_super(struct super_block *sb,

osb->slot_num = OCFS2_INVALID_SLOT;

osb->s_xattr_inline_size = OCFS2_MIN_XATTR_INLINE_SIZE;
osb->s_xattr_inline_size = le16_to_cpu(
di->id2.i_super.s_xattr_inline_size);

osb->local_alloc_state = OCFS2_LA_UNUSED;
osb->local_alloc_bh = NULL;
Expand Down
12 changes: 12 additions & 0 deletions trunk/fs/ocfs2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,9 @@ ssize_t ocfs2_listxattr(struct dentry *dentry,
struct ocfs2_dinode *di = NULL;
struct ocfs2_inode_info *oi = OCFS2_I(dentry->d_inode);

if (!ocfs2_supports_xattr(OCFS2_SB(dentry->d_sb)))
return -EOPNOTSUPP;

if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL))
return ret;

Expand Down Expand Up @@ -843,6 +846,9 @@ int ocfs2_xattr_get(struct inode *inode,
.not_found = -ENODATA,
};

if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
return -EOPNOTSUPP;

if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL))
ret = -ENODATA;

Expand Down Expand Up @@ -1541,6 +1547,9 @@ int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh)
handle_t *handle;
int ret;

if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
return 0;

if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL))
return 0;

Expand Down Expand Up @@ -1977,6 +1986,9 @@ int ocfs2_xattr_set(struct inode *inode,
.not_found = -ENODATA,
};

if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
return -EOPNOTSUPP;

ret = ocfs2_inode_lock(inode, &di_bh, 1);
if (ret < 0) {
mlog_errno(ret);
Expand Down

0 comments on commit 7c8a761

Please sign in to comment.