struct ocfs2_xattr_bucket {
struct buffer_head *bu_bhs[OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET];
- struct ocfs2_xattr_header *bu_xh;
};
#define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root))
#define bucket_blkno(_b) ((_b)->bu_bhs[0]->b_blocknr)
#define bucket_block(_b, _n) ((_b)->bu_bhs[(_n)]->b_data)
+#define bucket_xh(_b) ((struct ocfs2_xattr_header *)bucket_block((_b), 0))
static inline const char *ocfs2_xattr_prefix(int name_index)
{
if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) {
ret = ocfs2_xattr_bucket_get_name_value(inode,
- xs->bucket.bu_xh,
+ bucket_xh(&xs->bucket),
i,
&block_off,
&name_offset);
bh = NULL;
}
xs->bucket.bu_bhs[0] = lower_bh;
- xs->bucket.bu_xh = (struct ocfs2_xattr_header *)
- bucket_block(&xs->bucket, 0);
lower_bh = NULL;
- xs->header = xs->bucket.bu_xh;
+ xs->header = bucket_xh(&xs->bucket);
xs->base = bucket_block(&xs->bucket, 0);
xs->end = xs->base + inode->i_sb->s_blocksize;
goto out;
}
- bucket.bu_xh = (struct ocfs2_xattr_header *)bucket_block(&bucket, 0);
/*
* The real bucket num in this series of blocks is stored
* in the 1st bucket.
*/
if (i == 0)
- num_buckets = le16_to_cpu(bucket.bu_xh->xh_num_buckets);
+ num_buckets = le16_to_cpu(bucket_xh(&bucket)->xh_num_buckets);
mlog(0, "iterating xattr bucket %llu, first hash %u\n",
(unsigned long long)blkno,
- le32_to_cpu(bucket.bu_xh->xh_entries[0].xe_name_hash));
+ le32_to_cpu(bucket_xh(&bucket)->xh_entries[0].xe_name_hash));
if (func) {
ret = func(inode, &bucket, para);
if (ret) {
int i, block_off, new_offset;
const char *prefix, *name;
- for (i = 0 ; i < le16_to_cpu(bucket->bu_xh->xh_count); i++) {
- struct ocfs2_xattr_entry *entry = &bucket->bu_xh->xh_entries[i];
+ for (i = 0 ; i < le16_to_cpu(bucket_xh(bucket)->xh_count); i++) {
+ struct ocfs2_xattr_entry *entry = &bucket_xh(bucket)->xh_entries[i];
type = ocfs2_xattr_get_type(entry);
prefix = ocfs2_xattr_prefix(type);
if (prefix) {
ret = ocfs2_xattr_bucket_get_name_value(inode,
- bucket->bu_xh,
+ bucket_xh(bucket),
i,
&block_off,
&new_offset);
xs->bucket.bu_bhs[0] = new_bh;
get_bh(new_bh);
- xs->bucket.bu_xh = (struct ocfs2_xattr_header *)bucket_block(&xs->bucket, 0);
- xs->header = xs->bucket.bu_xh;
+ xs->header = bucket_xh(&xs->bucket);
xs->base = new_bh->b_data;
xs->end = xs->base + inode->i_sb->s_blocksize;
struct ocfs2_xattr_search *xs)
{
handle_t *handle = NULL;
- struct ocfs2_xattr_header *xh = xs->bucket.bu_xh;
+ struct ocfs2_xattr_header *xh = bucket_xh(&xs->bucket);
struct ocfs2_xattr_entry *last = &xh->xh_entries[
le16_to_cpu(xh->xh_count) - 1];
int ret = 0;
struct ocfs2_xattr_bucket *bucket,
const char *name)
{
- struct ocfs2_xattr_header *xh = bucket->bu_xh;
+ struct ocfs2_xattr_header *xh = bucket_xh(bucket);
u32 name_hash = ocfs2_xattr_name_hash(inode, name, strlen(name));
if (name_hash != le32_to_cpu(xh->xh_entries[0].xe_name_hash))
void *para)
{
int ret = 0;
- struct ocfs2_xattr_header *xh = bucket->bu_xh;
+ struct ocfs2_xattr_header *xh = bucket_xh(bucket);
u16 i;
struct ocfs2_xattr_entry *xe;