aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/xattr.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 5be99666f02c..c1f2e0690747 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -3965,11 +3965,12 @@ static int ocfs2_cp_xattr_bucket(struct inode *inode,
3965 /* 3965 /*
3966 * Hey, if we're overwriting t_bucket, what difference does 3966 * Hey, if we're overwriting t_bucket, what difference does
3967 * ACCESS_CREATE vs ACCESS_WRITE make? Well, if we allocated a new 3967 * ACCESS_CREATE vs ACCESS_WRITE make? Well, if we allocated a new
3968 * cluster to fill, we came here from ocfs2_cp_xattr_cluster(), and 3968 * cluster to fill, we came here from
3969 * it is really new - ACCESS_CREATE is required. But we also 3969 * ocfs2_mv_xattr_buckets(), and it is really new -
3970 * might have moved data out of t_bucket before extending back 3970 * ACCESS_CREATE is required. But we also might have moved data
3971 * into it. ocfs2_add_new_xattr_bucket() can do this - its call 3971 * out of t_bucket before extending back into it.
3972 * to ocfs2_add_new_xattr_cluster() may have created a new extent 3972 * ocfs2_add_new_xattr_bucket() can do this - its call to
3973 * ocfs2_add_new_xattr_cluster() may have created a new extent
3973 * and copied out the end of the old extent. Then it re-extends 3974 * and copied out the end of the old extent. Then it re-extends
3974 * the old extent back to create space for new xattrs. That's 3975 * the old extent back to create space for new xattrs. That's
3975 * how we get here, and the bucket isn't really new. 3976 * how we get here, and the bucket isn't really new.
@@ -3992,17 +3993,16 @@ out:
3992} 3993}
3993 3994
3994/* 3995/*
3995 * src_blk points to the last cluster of an existing extent. to_blk 3996 * src_blk points to the start of an existing extent. last_blk points to
3996 * points to a newly allocated extent. We copy the cluster over to the 3997 * last cluster in that extent. to_blk points to a newly allocated
3997 * new extent, initializing its xh_num_buckets. The old extent's 3998 * extent. We copy the buckets from cluster at last_blk to the new extent,
3998 * xh_num_buckets shrinks by the same amount. 3999 * initializing its xh_num_buckets. The old extent's xh_num_buckets
4000 * shrinks by the same amount.
3999 */ 4001 */
4000static int ocfs2_cp_xattr_cluster(struct inode *inode, 4002static int ocfs2_mv_xattr_buckets(struct inode *inode,
4001 handle_t *handle, 4003 handle_t *handle,
4002 struct buffer_head *first_bh, 4004 u64 src_blk, u64 last_blk,
4003 u64 src_blk, 4005 u64 to_blk, u32 *first_hash)
4004 u64 to_blk,
4005 u32 *first_hash)
4006{ 4006{
4007 int i, ret, credits; 4007 int i, ret, credits;
4008 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 4008 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
@@ -4011,8 +4011,8 @@ static int ocfs2_cp_xattr_cluster(struct inode *inode,
4011 int num_buckets = ocfs2_xattr_buckets_per_cluster(osb); 4011 int num_buckets = ocfs2_xattr_buckets_per_cluster(osb);
4012 struct ocfs2_xattr_bucket *old_first, *new_first; 4012 struct ocfs2_xattr_bucket *old_first, *new_first;
4013 4013
4014 mlog(0, "cp xattrs from cluster %llu to %llu\n", 4014 mlog(0, "mv xattrs from cluster %llu to %llu\n",
4015 (unsigned long long)src_blk, (unsigned long long)to_blk); 4015 (unsigned long long)last_blk, (unsigned long long)to_blk);
4016 4016
4017 /* The first bucket of the original extent */ 4017 /* The first bucket of the original extent */
4018 old_first = ocfs2_xattr_bucket_new(inode); 4018 old_first = ocfs2_xattr_bucket_new(inode);
@@ -4024,7 +4024,7 @@ static int ocfs2_cp_xattr_cluster(struct inode *inode,
4024 goto out; 4024 goto out;
4025 } 4025 }
4026 4026
4027 ret = ocfs2_read_xattr_bucket(old_first, first_bh->b_blocknr); 4027 ret = ocfs2_read_xattr_bucket(old_first, src_blk);
4028 if (ret) { 4028 if (ret) {
4029 mlog_errno(ret); 4029 mlog_errno(ret);
4030 goto out; 4030 goto out;
@@ -4050,7 +4050,7 @@ static int ocfs2_cp_xattr_cluster(struct inode *inode,
4050 4050
4051 for (i = 0; i < num_buckets; i++) { 4051 for (i = 0; i < num_buckets; i++) {
4052 ret = ocfs2_cp_xattr_bucket(inode, handle, 4052 ret = ocfs2_cp_xattr_bucket(inode, handle,
4053 src_blk + (i * blks_per_bucket), 4053 last_blk + (i * blks_per_bucket),
4054 to_blk + (i * blks_per_bucket), 4054 to_blk + (i * blks_per_bucket),
4055 1); 4055 1);
4056 if (ret) { 4056 if (ret) {
@@ -4175,8 +4175,10 @@ static int ocfs2_adjust_xattr_cross_cluster(struct inode *inode,
4175 u64 last_blk = prev_blk + bpc * (prev_clusters - 1); 4175 u64 last_blk = prev_blk + bpc * (prev_clusters - 1);
4176 4176
4177 if (prev_clusters > 1 && (*header_bh)->b_blocknr != last_blk) 4177 if (prev_clusters > 1 && (*header_bh)->b_blocknr != last_blk)
4178 ret = ocfs2_cp_xattr_cluster(inode, handle, *first_bh, 4178 ret = ocfs2_mv_xattr_buckets(inode, handle,
4179 last_blk, new_blk, 4179 (*first_bh)->b_blocknr,
4180 last_blk,
4181 new_blk,
4180 v_start); 4182 v_start);
4181 else { 4183 else {
4182 ret = ocfs2_divide_xattr_cluster(inode, handle, 4184 ret = ocfs2_divide_xattr_cluster(inode, handle,