|
@@ -3965,11 +3965,12 @@ static int ocfs2_cp_xattr_bucket(struct inode *inode,
|
|
/*
|
|
/*
|
|
* Hey, if we're overwriting t_bucket, what difference does
|
|
* Hey, if we're overwriting t_bucket, what difference does
|
|
* ACCESS_CREATE vs ACCESS_WRITE make? Well, if we allocated a new
|
|
* ACCESS_CREATE vs ACCESS_WRITE make? Well, if we allocated a new
|
|
- * cluster to fill, we came here from ocfs2_cp_xattr_cluster(), and
|
|
|
|
- * it is really new - ACCESS_CREATE is required. But we also
|
|
|
|
- * might have moved data out of t_bucket before extending back
|
|
|
|
- * into it. ocfs2_add_new_xattr_bucket() can do this - its call
|
|
|
|
- * to ocfs2_add_new_xattr_cluster() may have created a new extent
|
|
|
|
|
|
+ * cluster to fill, we came here from
|
|
|
|
+ * ocfs2_mv_xattr_buckets(), and it is really new -
|
|
|
|
+ * ACCESS_CREATE is required. But we also might have moved data
|
|
|
|
+ * out of t_bucket before extending back into it.
|
|
|
|
+ * ocfs2_add_new_xattr_bucket() can do this - its call to
|
|
|
|
+ * ocfs2_add_new_xattr_cluster() may have created a new extent
|
|
* and copied out the end of the old extent. Then it re-extends
|
|
* and copied out the end of the old extent. Then it re-extends
|
|
* the old extent back to create space for new xattrs. That's
|
|
* the old extent back to create space for new xattrs. That's
|
|
* how we get here, and the bucket isn't really new.
|
|
* how we get here, and the bucket isn't really new.
|
|
@@ -3992,17 +3993,16 @@ out:
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- * src_blk points to the last cluster of an existing extent. to_blk
|
|
|
|
- * points to a newly allocated extent. We copy the cluster over to the
|
|
|
|
- * new extent, initializing its xh_num_buckets. The old extent's
|
|
|
|
- * xh_num_buckets shrinks by the same amount.
|
|
|
|
|
|
+ * src_blk points to the start of an existing extent. last_blk points to
|
|
|
|
+ * last cluster in that extent. to_blk points to a newly allocated
|
|
|
|
+ * extent. We copy the buckets from cluster at last_blk to the new extent,
|
|
|
|
+ * initializing its xh_num_buckets. The old extent's xh_num_buckets
|
|
|
|
+ * shrinks by the same amount.
|
|
*/
|
|
*/
|
|
-static int ocfs2_cp_xattr_cluster(struct inode *inode,
|
|
|
|
|
|
+static int ocfs2_mv_xattr_buckets(struct inode *inode,
|
|
handle_t *handle,
|
|
handle_t *handle,
|
|
- struct buffer_head *first_bh,
|
|
|
|
- u64 src_blk,
|
|
|
|
- u64 to_blk,
|
|
|
|
- u32 *first_hash)
|
|
|
|
|
|
+ u64 src_blk, u64 last_blk,
|
|
|
|
+ u64 to_blk, u32 *first_hash)
|
|
{
|
|
{
|
|
int i, ret, credits;
|
|
int i, ret, credits;
|
|
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
|
|
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
|
|
@@ -4011,8 +4011,8 @@ static int ocfs2_cp_xattr_cluster(struct inode *inode,
|
|
int num_buckets = ocfs2_xattr_buckets_per_cluster(osb);
|
|
int num_buckets = ocfs2_xattr_buckets_per_cluster(osb);
|
|
struct ocfs2_xattr_bucket *old_first, *new_first;
|
|
struct ocfs2_xattr_bucket *old_first, *new_first;
|
|
|
|
|
|
- mlog(0, "cp xattrs from cluster %llu to %llu\n",
|
|
|
|
- (unsigned long long)src_blk, (unsigned long long)to_blk);
|
|
|
|
|
|
+ mlog(0, "mv xattrs from cluster %llu to %llu\n",
|
|
|
|
+ (unsigned long long)last_blk, (unsigned long long)to_blk);
|
|
|
|
|
|
/* The first bucket of the original extent */
|
|
/* The first bucket of the original extent */
|
|
old_first = ocfs2_xattr_bucket_new(inode);
|
|
old_first = ocfs2_xattr_bucket_new(inode);
|
|
@@ -4024,7 +4024,7 @@ static int ocfs2_cp_xattr_cluster(struct inode *inode,
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|
|
- ret = ocfs2_read_xattr_bucket(old_first, first_bh->b_blocknr);
|
|
|
|
|
|
+ ret = ocfs2_read_xattr_bucket(old_first, src_blk);
|
|
if (ret) {
|
|
if (ret) {
|
|
mlog_errno(ret);
|
|
mlog_errno(ret);
|
|
goto out;
|
|
goto out;
|
|
@@ -4050,7 +4050,7 @@ static int ocfs2_cp_xattr_cluster(struct inode *inode,
|
|
|
|
|
|
for (i = 0; i < num_buckets; i++) {
|
|
for (i = 0; i < num_buckets; i++) {
|
|
ret = ocfs2_cp_xattr_bucket(inode, handle,
|
|
ret = ocfs2_cp_xattr_bucket(inode, handle,
|
|
- src_blk + (i * blks_per_bucket),
|
|
|
|
|
|
+ last_blk + (i * blks_per_bucket),
|
|
to_blk + (i * blks_per_bucket),
|
|
to_blk + (i * blks_per_bucket),
|
|
1);
|
|
1);
|
|
if (ret) {
|
|
if (ret) {
|
|
@@ -4175,8 +4175,10 @@ static int ocfs2_adjust_xattr_cross_cluster(struct inode *inode,
|
|
u64 last_blk = prev_blk + bpc * (prev_clusters - 1);
|
|
u64 last_blk = prev_blk + bpc * (prev_clusters - 1);
|
|
|
|
|
|
if (prev_clusters > 1 && (*header_bh)->b_blocknr != last_blk)
|
|
if (prev_clusters > 1 && (*header_bh)->b_blocknr != last_blk)
|
|
- ret = ocfs2_cp_xattr_cluster(inode, handle, *first_bh,
|
|
|
|
- last_blk, new_blk,
|
|
|
|
|
|
+ ret = ocfs2_mv_xattr_buckets(inode, handle,
|
|
|
|
+ (*first_bh)->b_blocknr,
|
|
|
|
+ last_blk,
|
|
|
|
+ new_blk,
|
|
v_start);
|
|
v_start);
|
|
else {
|
|
else {
|
|
ret = ocfs2_divide_xattr_cluster(inode, handle,
|
|
ret = ocfs2_divide_xattr_cluster(inode, handle,
|