};
struct ocfs2_xattr_info {
- int name_index;
- const char *name;
- const void *value;
- size_t value_len;
+ int xi_name_index;
+ const char *xi_name;
+ const void *xi_value;
+ size_t xi_value_len;
};
struct ocfs2_xattr_search {
size_t offs)
{
int ret = 0;
- size_t name_len = strlen(xi->name);
+ size_t name_len = strlen(xi->xi_name);
void *val = xs->base + offs;
size_t size = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_ROOT_SIZE;
}
xs->here->xe_name_offset = cpu_to_le16(offs);
- xs->here->xe_value_size = cpu_to_le64(xi->value_len);
- if (xi->value_len <= OCFS2_XATTR_INLINE_SIZE)
+ xs->here->xe_value_size = cpu_to_le64(xi->xi_value_len);
+ if (xi->xi_value_len <= OCFS2_XATTR_INLINE_SIZE)
ocfs2_xattr_set_local(xs->here, 1);
else
ocfs2_xattr_set_local(xs->here, 0);
struct ocfs2_xattr_value_buf *vb,
size_t offs)
{
- size_t name_len = strlen(xi->name);
+ size_t name_len = strlen(xi->xi_name);
void *val = xs->base + offs;
struct ocfs2_xattr_value_root *xv = NULL;
size_t size = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_ROOT_SIZE;
int ret = 0;
memset(val, 0, size);
- memcpy(val, xi->name, name_len);
+ memcpy(val, xi->xi_name, name_len);
xv = (struct ocfs2_xattr_value_root *)
(val + OCFS2_XATTR_SIZE(name_len));
xv->xr_clusters = 0;
xv->xr_list.l_next_free_rec = 0;
vb->vb_xv = xv;
- ret = ocfs2_xattr_value_truncate(inode, vb, xi->value_len, ctxt);
+ ret = ocfs2_xattr_value_truncate(inode, vb, xi->xi_value_len, ctxt);
if (ret < 0) {
mlog_errno(ret);
return ret;
return ret;
}
ret = __ocfs2_xattr_set_value_outside(inode, ctxt->handle, vb,
- xi->value, xi->value_len);
+ xi->xi_value, xi->xi_value_len);
if (ret < 0)
mlog_errno(ret);
struct ocfs2_xattr_entry *last,
size_t min_offs)
{
- size_t name_len = strlen(xi->name);
+ size_t name_len = strlen(xi->xi_name);
struct ocfs2_xa_loc loc;
if (xs->xattr_bh == xs->inode_bh)
else
ocfs2_init_xattr_block_xa_loc(&loc, xs->xattr_bh,
xs->not_found ? NULL : xs->here);
- if (xi->value && xs->not_found) {
+ if (xi->xi_value && xs->not_found) {
/* Insert the new xattr entry. */
le16_add_cpu(&xs->header->xh_count, 1);
- ocfs2_xattr_set_type(last, xi->name_index);
+ ocfs2_xattr_set_type(last, xi->xi_name_index);
ocfs2_xattr_set_local(last, 1);
last->xe_name_len = name_len;
} else {
size = OCFS2_XATTR_SIZE(name_len) +
OCFS2_XATTR_SIZE(le64_to_cpu(xs->here->xe_value_size));
- if (xi->value && size == OCFS2_XATTR_SIZE(name_len) +
- OCFS2_XATTR_SIZE(xi->value_len)) {
+ if (xi->xi_value && size == OCFS2_XATTR_SIZE(name_len) +
+ OCFS2_XATTR_SIZE(xi->xi_value_len)) {
/* The old and the new value have the
same size. Just replace the value. */
ocfs2_xattr_set_local(xs->here, 1);
- xs->here->xe_value_size = cpu_to_le64(xi->value_len);
+ xs->here->xe_value_size = cpu_to_le64(xi->xi_value_len);
/* Clear value bytes. */
memset(val + OCFS2_XATTR_SIZE(name_len),
0,
- OCFS2_XATTR_SIZE(xi->value_len));
+ OCFS2_XATTR_SIZE(xi->xi_value_len));
memcpy(val + OCFS2_XATTR_SIZE(name_len),
- xi->value,
- xi->value_len);
+ xi->xi_value,
+ xi->xi_value_len);
return;
}
- if (!xi->value)
+ if (!xi->xi_value)
ocfs2_xa_remove_entry(&loc);
else
ocfs2_xa_wipe_namevalue(&loc);
min_offs += size;
}
- if (xi->value) {
+ if (xi->xi_value) {
/* Insert the new name+value. */
size_t size = OCFS2_XATTR_SIZE(name_len) +
- OCFS2_XATTR_SIZE(xi->value_len);
+ OCFS2_XATTR_SIZE(xi->xi_value_len);
void *val = xs->base + min_offs - size;
xs->here->xe_name_offset = cpu_to_le16(min_offs - size);
memset(val, 0, size);
- memcpy(val, xi->name, name_len);
+ memcpy(val, xi->xi_name, name_len);
memcpy(val + OCFS2_XATTR_SIZE(name_len),
- xi->value,
- xi->value_len);
- xs->here->xe_value_size = cpu_to_le64(xi->value_len);
+ xi->xi_value,
+ xi->xi_value_len);
+ xs->here->xe_value_size = cpu_to_le64(xi->xi_value_len);
ocfs2_xattr_set_local(xs->here, 1);
ocfs2_xattr_hash_entry(inode, xs->header, xs->here);
}
struct ocfs2_xattr_entry *last;
struct ocfs2_inode_info *oi = OCFS2_I(inode);
struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data;
- size_t min_offs = xs->end - xs->base, name_len = strlen(xi->name);
+ size_t min_offs = xs->end - xs->base, name_len = strlen(xi->xi_name);
size_t size_l = 0;
handle_t *handle = ctxt->handle;
int free, i, ret;
struct ocfs2_xattr_info xi_l = {
- .name_index = xi->name_index,
- .name = xi->name,
- .value = xi->value,
- .value_len = xi->value_len,
+ .xi_name_index = xi->xi_name_index,
+ .xi_name = xi->xi_name,
+ .xi_value = xi->xi_value,
+ .xi_value_len = xi->xi_value_len,
};
struct ocfs2_xattr_value_buf vb = {
.vb_bh = xs->xattr_bh,
free += (size + sizeof(struct ocfs2_xattr_entry));
}
/* Check free space in inode or block */
- if (xi->value && xi->value_len > OCFS2_XATTR_INLINE_SIZE) {
+ if (xi->xi_value && xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE) {
if (free < sizeof(struct ocfs2_xattr_entry) +
OCFS2_XATTR_SIZE(name_len) +
OCFS2_XATTR_ROOT_SIZE) {
goto out;
}
size_l = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_ROOT_SIZE;
- xi_l.value = (void *)&def_xv;
- xi_l.value_len = OCFS2_XATTR_ROOT_SIZE;
- } else if (xi->value) {
+ xi_l.xi_value = (void *)&def_xv;
+ xi_l.xi_value_len = OCFS2_XATTR_ROOT_SIZE;
+ } else if (xi->xi_value) {
if (free < sizeof(struct ocfs2_xattr_entry) +
OCFS2_XATTR_SIZE(name_len) +
- OCFS2_XATTR_SIZE(xi->value_len)) {
+ OCFS2_XATTR_SIZE(xi->xi_value_len)) {
ret = -ENOSPC;
goto out;
}
vb.vb_xv = (struct ocfs2_xattr_value_root *)
(val + OCFS2_XATTR_SIZE(name_len));
- if (xi->value_len > OCFS2_XATTR_INLINE_SIZE) {
+ if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE) {
/*
* If new value need set outside also,
* first truncate old value to new value,
* then set new value with set_value_outside().
*/
ret = ocfs2_xattr_value_truncate(inode,
- &vb,
- xi->value_len,
- ctxt);
+ &vb,
+ xi->xi_value_len,
+ ctxt);
if (ret < 0) {
mlog_errno(ret);
goto out;
}
ret = __ocfs2_xattr_set_value_outside(inode,
- handle,
- &vb,
- xi->value,
- xi->value_len);
+ handle,
+ &vb,
+ xi->xi_value,
+ xi->xi_value_len);
if (ret < 0)
mlog_errno(ret);
goto out;
if (ret < 0)
mlog_errno(ret);
- if (!ret && xi->value_len > OCFS2_XATTR_INLINE_SIZE) {
+ if (!ret && xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE) {
/*
* Set value outside in B tree.
* This is the second step for value size > INLINE_SIZE.
BUG_ON(!xs->not_found);
- if (xi->value_len > OCFS2_XATTR_INLINE_SIZE)
+ if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE)
value_size = OCFS2_XATTR_ROOT_SIZE;
else
- value_size = OCFS2_XATTR_SIZE(xi->value_len);
+ value_size = OCFS2_XATTR_SIZE(xi->xi_value_len);
if (free >= sizeof(struct ocfs2_xattr_entry) +
- OCFS2_XATTR_SIZE(strlen(xi->name)) + value_size)
+ OCFS2_XATTR_SIZE(strlen(xi->xi_name)) + value_size)
return 1;
return 0;
char *base = NULL;
int name_offset, name_len = 0;
u32 new_clusters = ocfs2_clusters_for_bytes(inode->i_sb,
- xi->value_len);
+ xi->xi_value_len);
u64 value_size;
/*
* No matter whether we replace an old one or add a new one,
* we need this for writing.
*/
- if (xi->value_len > OCFS2_XATTR_INLINE_SIZE)
+ if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE)
credits += new_clusters *
ocfs2_clusters_to_blocks(inode->i_sb, 1);
if (xis->not_found && xbs->not_found) {
credits += ocfs2_blocks_per_xattr_bucket(inode->i_sb);
- if (xi->value_len > OCFS2_XATTR_INLINE_SIZE) {
+ if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE) {
clusters_add += new_clusters;
credits += ocfs2_calc_extend_credits(inode->i_sb,
&def_xv.xv.xr_list,
* The credits for removing the value tree will be extended
* by ocfs2_remove_extent itself.
*/
- if (!xi->value) {
+ if (!xi->xi_value) {
if (!ocfs2_xattr_is_local(xe))
credits += ocfs2_remove_extent_credits(inode->i_sb);
}
}
- if (xi->value_len > OCFS2_XATTR_INLINE_SIZE) {
+ if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE) {
/* the new values will be stored outside. */
u32 old_clusters = 0;
* value, we don't need any allocation, otherwise we have
* to guess metadata allocation.
*/
- if ((ocfs2_xattr_is_local(xe) && value_size >= xi->value_len) ||
+ if ((ocfs2_xattr_is_local(xe) &&
+ (value_size >= xi->xi_value_len)) ||
(!ocfs2_xattr_is_local(xe) &&
- OCFS2_XATTR_ROOT_SIZE >= xi->value_len))
+ OCFS2_XATTR_ROOT_SIZE >= xi->xi_value_len))
goto out;
}
meta_add += extra_meta;
mlog(0, "Set xattr %s, reserve meta blocks = %d, clusters = %d, "
- "credits = %d\n", xi->name, meta_add, clusters_add, *credits);
+ "credits = %d\n", xi->xi_name, meta_add, clusters_add, *credits);
if (meta_add) {
ret = ocfs2_reserve_new_metadata_blocks(osb, meta_add,
{
int ret = 0, credits, old_found;
- if (!xi->value) {
+ if (!xi->xi_value) {
/* Remove existing extended attribute */
if (!xis->not_found)
ret = ocfs2_xattr_ibody_set(inode, xi, xis, ctxt);
* If succeed and that extended attribute existing in
* external block, then we will remove it.
*/
- xi->value = NULL;
- xi->value_len = 0;
+ xi->xi_value = NULL;
+ xi->xi_value_len = 0;
old_found = xis->not_found;
xis->not_found = -ENODATA;
} else if (ret == -ENOSPC) {
if (di->i_xattr_loc && !xbs->xattr_bh) {
ret = ocfs2_xattr_block_find(inode,
- xi->name_index,
- xi->name, xbs);
+ xi->xi_name_index,
+ xi->xi_name, xbs);
if (ret)
goto out;
* If succeed and that extended attribute
* existing in inode, we will remove it.
*/
- xi->value = NULL;
- xi->value_len = 0;
+ xi->xi_value = NULL;
+ xi->xi_value_len = 0;
xbs->not_found = -ENODATA;
ret = ocfs2_calc_xattr_set_need(inode,
di,
int ret;
struct ocfs2_xattr_info xi = {
- .name_index = name_index,
- .name = name,
- .value = value,
- .value_len = value_len,
+ .xi_name_index = name_index,
+ .xi_name = name,
+ .xi_value = value,
+ .xi_value_len = value_len,
};
struct ocfs2_xattr_search xis = {
struct ocfs2_refcount_tree *ref_tree = NULL;
struct ocfs2_xattr_info xi = {
- .name_index = name_index,
- .name = name,
- .value = value,
- .value_len = value_len,
+ .xi_name_index = name_index,
+ .xi_name = name,
+ .xi_value = value,
+ .xi_value_len = value_len,
};
struct ocfs2_xattr_search xis = {
int local)
{
struct ocfs2_xattr_entry *last, *xe;
- int name_len = strlen(xi->name);
+ int name_len = strlen(xi->xi_name);
struct ocfs2_xattr_header *xh = xs->header;
u16 count = le16_to_cpu(xh->xh_count), start;
size_t blocksize = inode->i_sb->s_blocksize;
OCFS2_XATTR_SIZE(OCFS2_XATTR_ROOT_SIZE);
/*
- * If the new value will be stored outside, xi->value has been
- * initalized as an empty ocfs2_xattr_value_root, and the same
- * goes with xi->value_len, so we can set new_size safely here.
+ * If the new value will be stored outside, xi->xi_value has
+ * been initalized as an empty ocfs2_xattr_value_root, and
+ * the same goes with xi->xi_value_len, so we can set
+ * new_size safely here.
* See ocfs2_xattr_set_in_bucket.
*/
new_size = OCFS2_XATTR_SIZE(name_len) +
- OCFS2_XATTR_SIZE(xi->value_len);
+ OCFS2_XATTR_SIZE(xi->xi_value_len);
- if (xi->value) {
+ if (xi->xi_value) {
ocfs2_xa_wipe_namevalue(&loc);
if (new_size > size)
goto set_new_name_value;
/* Now replace the old value with new one. */
if (local)
- xe->xe_value_size = cpu_to_le64(xi->value_len);
+ xe->xe_value_size =
+ cpu_to_le64(xi->xi_value_len);
else
xe->xe_value_size = 0;
xs->bucket, offs);
memset(val + OCFS2_XATTR_SIZE(name_len), 0,
size - OCFS2_XATTR_SIZE(name_len));
- if (OCFS2_XATTR_SIZE(xi->value_len) > 0)
+ if (OCFS2_XATTR_SIZE(xi->xi_value_len) > 0)
memcpy(val + OCFS2_XATTR_SIZE(name_len),
- xi->value, xi->value_len);
+ xi->xi_value, xi->xi_value_len);
le16_add_cpu(&xh->xh_name_value_len, new_size);
ocfs2_xattr_set_local(xe, local);
memset(xe, 0, sizeof(struct ocfs2_xattr_entry));
xe->xe_name_hash = cpu_to_le32(name_hash);
xe->xe_name_len = name_len;
- ocfs2_xattr_set_type(xe, xi->name_index);
+ ocfs2_xattr_set_type(xe, xi->xi_name_index);
}
set_new_name_value:
/* Insert the new name+value. */
- size = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_SIZE(xi->value_len);
+ size = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_SIZE(xi->xi_value_len);
/*
* We must make sure that the name/value pair
xe->xe_name_offset = cpu_to_le16(offs - size);
memset(val, 0, size);
- memcpy(val, xi->name, name_len);
- memcpy(val + OCFS2_XATTR_SIZE(name_len), xi->value, xi->value_len);
+ memcpy(val, xi->xi_name, name_len);
+ memcpy(val + OCFS2_XATTR_SIZE(name_len), xi->xi_value,
+ xi->xi_value_len);
- xe->xe_value_size = cpu_to_le64(xi->value_len);
+ xe->xe_value_size = cpu_to_le64(xi->xi_value_len);
ocfs2_xattr_set_local(xe, local);
xs->here = xe;
le16_add_cpu(&xh->xh_free_start, -size);
u64 blkno;
mlog(0, "Set xattr entry len = %lu index = %d in bucket %llu\n",
- (unsigned long)xi->value_len, xi->name_index,
+ (unsigned long)xi->xi_value_len, xi->xi_name_index,
(unsigned long long)bucket_blkno(xs->bucket));
if (!xs->bucket->bu_bhs[1]) {
{
int ret, local = 1;
size_t value_len;
- char *val = (char *)xi->value;
+ char *val = (char *)xi->xi_value;
struct ocfs2_xattr_entry *xe = xs->here;
- u32 name_hash = ocfs2_xattr_name_hash(inode, xi->name,
- strlen(xi->name));
+ u32 name_hash = ocfs2_xattr_name_hash(inode, xi->xi_name,
+ strlen(xi->xi_name));
if (!xs->not_found && !ocfs2_xattr_is_local(xe)) {
/*
* the modification to the xattr block will be done
* by following steps.
*/
- if (xi->value_len > OCFS2_XATTR_INLINE_SIZE)
- value_len = xi->value_len;
+ if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE)
+ value_len = xi->xi_value_len;
else
value_len = 0;
goto set_value_outside;
}
- value_len = xi->value_len;
+ value_len = xi->xi_value_len;
/* So we have to handle the inside block change now. */
if (value_len > OCFS2_XATTR_INLINE_SIZE) {
/*
* initalize a new empty value root and insert it first.
*/
local = 0;
- xi->value = &def_xv;
- xi->value_len = OCFS2_XATTR_ROOT_SIZE;
+ xi->xi_value = &def_xv;
+ xi->xi_value_len = OCFS2_XATTR_ROOT_SIZE;
}
ret = ocfs2_xattr_set_entry_in_bucket(inode, ctxt->handle, xi, xs,
struct ocfs2_xattr_entry *xe;
u16 count, header_size, xh_free_start;
int free, max_free, need, old;
- size_t value_size = 0, name_len = strlen(xi->name);
+ size_t value_size = 0, name_len = strlen(xi->xi_name);
size_t blocksize = inode->i_sb->s_blocksize;
int ret, allocation = 0;
- mlog_entry("Set xattr %s in xattr index block\n", xi->name);
+ mlog_entry("Set xattr %s in xattr index block\n", xi->xi_name);
try_again:
xh = xs->header;
(unsigned long long)bucket_blkno(xs->bucket),
header_size);
- if (xi->value && xi->value_len > OCFS2_XATTR_INLINE_SIZE)
+ if (xi->xi_value && xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE)
value_size = OCFS2_XATTR_ROOT_SIZE;
- else if (xi->value)
- value_size = OCFS2_XATTR_SIZE(xi->value_len);
+ else if (xi->xi_value)
+ value_size = OCFS2_XATTR_SIZE(xi->xi_value_len);
if (xs->not_found)
need = sizeof(struct ocfs2_xattr_entry) +
*/
ret = ocfs2_check_xattr_bucket_collision(inode,
xs->bucket,
- xi->name);
+ xi->xi_name);
if (ret) {
mlog_errno(ret);
goto out;
*/
ocfs2_xattr_bucket_relse(xs->bucket);
ret = ocfs2_xattr_index_block_find(inode, xs->xattr_bh,
- xi->name_index,
- xi->name, xs);
+ xi->xi_name_index,
+ xi->xi_name, xs);
if (ret && ret != -ENODATA)
goto out;
xs->not_found = ret;
* refcount tree, and make the original extent become 3. So we will need
* 2 * cluster more extent recs at most.
*/
- if (!xi->value || xi->value_len <= OCFS2_XATTR_INLINE_SIZE) {
+ if (!xi->xi_value || xi->xi_value_len <= OCFS2_XATTR_INLINE_SIZE) {
ret = ocfs2_refcounted_xattr_delete_need(inode,
&(*ref_tree)->rf_ci,