};
struct ocfs2_xattr_bucket {
- struct buffer_head *bhs[OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET];
- struct ocfs2_xattr_header *xh;
+ 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))
if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) {
ret = ocfs2_xattr_bucket_get_name_value(inode,
- xs->bucket.xh,
+ xs->bucket.bu_xh,
i,
&block_off,
&name_offset);
- xs->base = xs->bucket.bhs[block_off]->b_data;
+ xs->base = xs->bucket.bu_bhs[block_off]->b_data;
}
if (ocfs2_xattr_is_local(xs->here)) {
memcpy(buffer, (void *)xs->base +
ret = size;
cleanup:
for (i = 0; i < OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET; i++)
- brelse(xs->bucket.bhs[i]);
+ brelse(xs->bucket.bu_bhs[i]);
memset(&xs->bucket, 0, sizeof(xs->bucket));
brelse(xs->xattr_bh);
brelse(di_bh);
brelse(xbs.xattr_bh);
for (i = 0; i < blk_per_bucket; i++)
- brelse(xbs.bucket.bhs[i]);
+ brelse(xbs.bucket.bu_bhs[i]);
return ret;
}
lower_bh = bh;
bh = NULL;
}
- xs->bucket.bhs[0] = lower_bh;
- xs->bucket.xh = (struct ocfs2_xattr_header *)
- xs->bucket.bhs[0]->b_data;
+ xs->bucket.bu_bhs[0] = lower_bh;
+ xs->bucket.bu_xh = (struct ocfs2_xattr_header *)
+ xs->bucket.bu_bhs[0]->b_data;
lower_bh = NULL;
- xs->header = xs->bucket.xh;
- xs->base = xs->bucket.bhs[0]->b_data;
+ xs->header = xs->bucket.bu_xh;
+ xs->base = xs->bucket.bu_bhs[0]->b_data;
xs->end = xs->base + inode->i_sb->s_blocksize;
if (found) {
* If we have found the xattr enty, read all the blocks in
* this bucket.
*/
- ret = ocfs2_read_blocks(inode, xs->bucket.bhs[0]->b_blocknr + 1,
- blk_per_bucket - 1, &xs->bucket.bhs[1],
+ ret = ocfs2_read_blocks(inode, xs->bucket.bu_bhs[0]->b_blocknr + 1,
+ blk_per_bucket - 1, &xs->bucket.bu_bhs[1],
0);
if (ret) {
mlog_errno(ret);
xs->here = &xs->header->xh_entries[index];
mlog(0, "find xattr %s in bucket %llu, entry = %u\n", name,
- (unsigned long long)xs->bucket.bhs[0]->b_blocknr, index);
+ (unsigned long long)xs->bucket.bu_bhs[0]->b_blocknr, index);
} else
ret = -ENODATA;
for (i = 0; i < num_buckets; i++, blkno += blk_per_bucket) {
ret = ocfs2_read_blocks(inode, blkno, blk_per_bucket,
- bucket.bhs, 0);
+ bucket.bu_bhs, 0);
if (ret) {
mlog_errno(ret);
goto out;
}
- bucket.xh = (struct ocfs2_xattr_header *)bucket.bhs[0]->b_data;
+ bucket.bu_xh = (struct ocfs2_xattr_header *)bucket.bu_bhs[0]->b_data;
/*
* The real bucket num in this series of blocks is stored
* in the 1st bucket.
*/
if (i == 0)
- num_buckets = le16_to_cpu(bucket.xh->xh_num_buckets);
+ num_buckets = le16_to_cpu(bucket.bu_xh->xh_num_buckets);
mlog(0, "iterating xattr bucket %llu, first hash %u\n",
(unsigned long long)blkno,
- le32_to_cpu(bucket.xh->xh_entries[0].xe_name_hash));
+ le32_to_cpu(bucket.bu_xh->xh_entries[0].xe_name_hash));
if (func) {
ret = func(inode, &bucket, para);
if (ret) {
}
for (j = 0; j < blk_per_bucket; j++)
- brelse(bucket.bhs[j]);
+ brelse(bucket.bu_bhs[j]);
memset(&bucket, 0, sizeof(bucket));
}
out:
for (j = 0; j < blk_per_bucket; j++)
- brelse(bucket.bhs[j]);
+ brelse(bucket.bu_bhs[j]);
return ret;
}
int i, block_off, new_offset;
const char *prefix, *name;
- for (i = 0 ; i < le16_to_cpu(bucket->xh->xh_count); i++) {
- struct ocfs2_xattr_entry *entry = &bucket->xh->xh_entries[i];
+ for (i = 0 ; i < le16_to_cpu(bucket->bu_xh->xh_count); i++) {
+ struct ocfs2_xattr_entry *entry = &bucket->bu_xh->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->xh,
+ bucket->bu_xh,
i,
&block_off,
&new_offset);
if (ret)
break;
- name = (const char *)bucket->bhs[block_off]->b_data +
+ name = (const char *)bucket->bu_bhs[block_off]->b_data +
new_offset;
ret = ocfs2_xattr_list_entry(xl->buffer,
xl->buffer_size,
int i, blocksize = inode->i_sb->s_blocksize;
u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
- xs->bucket.bhs[0] = new_bh;
+ xs->bucket.bu_bhs[0] = new_bh;
get_bh(new_bh);
- xs->bucket.xh = (struct ocfs2_xattr_header *)xs->bucket.bhs[0]->b_data;
- xs->header = xs->bucket.xh;
+ xs->bucket.bu_xh = (struct ocfs2_xattr_header *)xs->bucket.bu_bhs[0]->b_data;
+ xs->header = xs->bucket.bu_xh;
xs->base = new_bh->b_data;
xs->end = xs->base + inode->i_sb->s_blocksize;
if (!xs->not_found) {
if (OCFS2_XATTR_BUCKET_SIZE != blocksize) {
ret = ocfs2_read_blocks(inode,
- xs->bucket.bhs[0]->b_blocknr + 1,
- blk_per_bucket - 1, &xs->bucket.bhs[1],
+ xs->bucket.bu_bhs[0]->b_blocknr + 1,
+ blk_per_bucket - 1, &xs->bucket.bu_bhs[1],
0);
if (ret) {
mlog_errno(ret);
size_t end, offset, len, value_len;
struct ocfs2_xattr_header *xh;
char *entries, *buf, *bucket_buf = NULL;
- u64 blkno = bucket->bhs[0]->b_blocknr;
+ u64 blkno = bucket->bu_bhs[0]->b_blocknr;
u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
u16 xh_free_start;
size_t blocksize = inode->i_sb->s_blocksize;
int block_off = offs >> inode->i_sb->s_blocksize_bits;
offs = offs % inode->i_sb->s_blocksize;
- return bucket->bhs[block_off]->b_data + offs;
+ return bucket->bu_bhs[block_off]->b_data + offs;
}
/*
mlog(0, "Set xattr entry len = %lu index = %d in bucket %llu\n",
(unsigned long)xi->value_len, xi->name_index,
- (unsigned long long)xs->bucket.bhs[0]->b_blocknr);
+ (unsigned long long)xs->bucket.bu_bhs[0]->b_blocknr);
- if (!xs->bucket.bhs[1]) {
+ if (!xs->bucket.bu_bhs[1]) {
ret = ocfs2_read_blocks(inode,
- xs->bucket.bhs[0]->b_blocknr + 1,
- blk_per_bucket - 1, &xs->bucket.bhs[1],
+ xs->bucket.bu_bhs[0]->b_blocknr + 1,
+ blk_per_bucket - 1, &xs->bucket.bu_bhs[1],
0);
if (ret) {
mlog_errno(ret);
}
for (i = 0; i < blk_per_bucket; i++) {
- ret = ocfs2_journal_access(handle, inode, xs->bucket.bhs[i],
+ ret = ocfs2_journal_access(handle, inode, xs->bucket.bu_bhs[i],
OCFS2_JOURNAL_ACCESS_WRITE);
if (ret < 0) {
mlog_errno(ret);
/*Only dirty the blocks we have touched in set xattr. */
ret = ocfs2_xattr_bucket_handle_journal(inode, handle, xs,
- xs->bucket.bhs, blk_per_bucket);
+ xs->bucket.bu_bhs, blk_per_bucket);
if (ret)
mlog_errno(ret);
out:
struct ocfs2_xattr_entry *xe = xs->here;
struct ocfs2_xattr_header *xh = (struct ocfs2_xattr_header *)xs->base;
- BUG_ON(!xs->bucket.bhs[0] || !xe || ocfs2_xattr_is_local(xe));
+ BUG_ON(!xs->bucket.bu_bhs[0] || !xe || ocfs2_xattr_is_local(xe));
offset = xe - xh->xh_entries;
- ret = ocfs2_xattr_bucket_value_truncate(inode, xs->bucket.bhs[0],
+ ret = ocfs2_xattr_bucket_value_truncate(inode, xs->bucket.bu_bhs[0],
offset, len);
if (ret)
mlog_errno(ret);
struct ocfs2_xattr_search *xs)
{
handle_t *handle = NULL;
- struct ocfs2_xattr_header *xh = xs->bucket.xh;
+ struct ocfs2_xattr_header *xh = xs->bucket.bu_xh;
struct ocfs2_xattr_entry *last = &xh->xh_entries[
le16_to_cpu(xh->xh_count) - 1];
int ret = 0;
return;
}
- ret = ocfs2_journal_access(handle, inode, xs->bucket.bhs[0],
+ ret = ocfs2_journal_access(handle, inode, xs->bucket.bu_bhs[0],
OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) {
mlog_errno(ret);
memset(last, 0, sizeof(struct ocfs2_xattr_entry));
le16_add_cpu(&xh->xh_count, -1);
- ret = ocfs2_journal_dirty(handle, xs->bucket.bhs[0]);
+ ret = ocfs2_journal_dirty(handle, xs->bucket.bu_bhs[0]);
if (ret < 0)
mlog_errno(ret);
out_commit:
struct ocfs2_xattr_bucket *bucket,
const char *name)
{
- struct ocfs2_xattr_header *xh = bucket->xh;
+ struct ocfs2_xattr_header *xh = bucket->bu_xh;
u32 name_hash = ocfs2_xattr_name_hash(inode, name, strlen(name));
if (name_hash != le32_to_cpu(xh->xh_entries[0].xe_name_hash))
xh->xh_entries[0].xe_name_hash) {
mlog(ML_ERROR, "Too much hash collision in xattr bucket %llu, "
"hash = %u\n",
- (unsigned long long)bucket->bhs[0]->b_blocknr,
+ (unsigned long long)bucket->bu_bhs[0]->b_blocknr,
le32_to_cpu(xh->xh_entries[0].xe_name_hash));
return -ENOSPC;
}
mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size "
"of %u which exceed block size\n",
- (unsigned long long)xs->bucket.bhs[0]->b_blocknr,
+ (unsigned long long)xs->bucket.bu_bhs[0]->b_blocknr,
header_size);
if (xi->value && xi->value_len > OCFS2_XATTR_INLINE_SIZE)
mlog(0, "xs->not_found = %d, in xattr bucket %llu: free = %d, "
"need = %d, max_free = %d, xh_free_start = %u, xh_name_value_len ="
" %u\n", xs->not_found,
- (unsigned long long)xs->bucket.bhs[0]->b_blocknr,
+ (unsigned long long)xs->bucket.bu_bhs[0]->b_blocknr,
free, need, max_free, le16_to_cpu(xh->xh_free_start),
le16_to_cpu(xh->xh_name_value_len));
ret = ocfs2_add_new_xattr_bucket(inode,
xs->xattr_bh,
- xs->bucket.bhs[0]);
+ xs->bucket.bu_bhs[0]);
if (ret) {
mlog_errno(ret);
goto out;
}
for (i = 0; i < blk_per_bucket; i++)
- brelse(xs->bucket.bhs[i]);
+ brelse(xs->bucket.bu_bhs[i]);
memset(&xs->bucket, 0, sizeof(xs->bucket));
void *para)
{
int ret = 0;
- struct ocfs2_xattr_header *xh = bucket->xh;
+ struct ocfs2_xattr_header *xh = bucket->bu_xh;
u16 i;
struct ocfs2_xattr_entry *xe;
continue;
ret = ocfs2_xattr_bucket_value_truncate(inode,
- bucket->bhs[0],
+ bucket->bu_bhs[0],
i, 0);
if (ret) {
mlog_errno(ret);