Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125866
b: refs/heads/master
c: 92cf3ad
h: refs/heads/master
v: v3
  • Loading branch information
Joel Becker authored and Mark Fasheh committed Jan 5, 2009
1 parent 23aeb52 commit 22402a1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c58b6032f93358871361a92d7743dbc85d27084e
refs/heads/master: 92cf3adf48097b7561a3c83f800ed3b2b25b18d4
44 changes: 37 additions & 7 deletions trunk/fs/ocfs2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4111,40 +4111,70 @@ static int ocfs2_adjust_xattr_cross_cluster(struct inode *inode,
u32 *v_start,
int *extend)
{
int ret = 0;
int bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1);
int ret;
struct ocfs2_xattr_bucket *first, *target;

mlog(0, "adjust xattrs from cluster %llu len %u to %llu\n",
(unsigned long long)prev_blk, prev_clusters,
(unsigned long long)new_blk);

/* The first bucket of the original extent */
first = ocfs2_xattr_bucket_new(inode);
/* The target bucket for insert */
target = ocfs2_xattr_bucket_new(inode);
if (!first || !target) {
ret = -ENOMEM;
mlog_errno(ret);
goto out;
}

BUG_ON(prev_blk != (*first_bh)->b_blocknr);
ret = ocfs2_read_xattr_bucket(first, prev_blk);
if (ret) {
mlog_errno(ret);
goto out;
}

ret = ocfs2_read_xattr_bucket(target, (*header_bh)->b_blocknr);
if (ret) {
mlog_errno(ret);
goto out;
}

if (ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb)) > 1)
ret = ocfs2_mv_xattr_bucket_cross_cluster(inode,
handle,
first_bh,
header_bh,
new_blk,
prev_blk,
bucket_blkno(first),
prev_clusters,
v_start);
else {
u64 last_blk = prev_blk + bpc * (prev_clusters - 1);
/* The start of the last cluster in the first extent */
u64 last_blk = bucket_blkno(first) +
((prev_clusters - 1) *
ocfs2_clusters_to_blocks(inode->i_sb, 1));

if (prev_clusters > 1 && (*header_bh)->b_blocknr != last_blk)
if (prev_clusters > 1 && bucket_blkno(target) != last_blk)
ret = ocfs2_mv_xattr_buckets(inode, handle,
(*first_bh)->b_blocknr,
bucket_blkno(first),
last_blk, new_blk, 0,
v_start);
else {
ret = ocfs2_divide_xattr_cluster(inode, handle,
last_blk, new_blk,
v_start);

if ((*header_bh)->b_blocknr == last_blk && extend)
if ((bucket_blkno(target) == last_blk) && extend)
*extend = 0;
}
}

out:
ocfs2_xattr_bucket_free(first);
ocfs2_xattr_bucket_free(target);

return ret;
}

Expand Down

0 comments on commit 22402a1

Please sign in to comment.