Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125785
b: refs/heads/master
c: 1c32a2f
h: refs/heads/master
i:
  125783: df20cc4
v: v3
  • Loading branch information
Tao Ma authored and Mark Fasheh committed Jan 5, 2009
1 parent dae31f5 commit bbee515
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 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: 02dbf38d19c19016f558fe0dc0c44f8041d3eb8e
refs/heads/master: 1c32a2fd46ddc01bd86bff56a8f5d98c815750f4
26 changes: 7 additions & 19 deletions trunk/fs/ocfs2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2898,7 +2898,6 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
size_t blocksize = inode->i_sb->s_blocksize;
handle_t *handle;
struct ocfs2_xattr_entry *xe;
struct ocfs2_xattr_bucket *wb = NULL;

/*
* In order to make the operation more efficient and generic,
Expand All @@ -2912,29 +2911,19 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
goto out;
}

wb = ocfs2_xattr_bucket_new(inode);
if (!wb) {
ret = -ENOMEM;
goto out;
}

ret = ocfs2_read_xattr_bucket(wb, blkno);
if (ret)
goto out;

buf = bucket_buf;
for (i = 0; i < wb->bu_blocks; i++, buf += blocksize)
memcpy(buf, bucket_block(wb, i), blocksize);
for (i = 0; i < bucket->bu_blocks; i++, buf += blocksize)
memcpy(buf, bucket_block(bucket, i), blocksize);

handle = ocfs2_start_trans((OCFS2_SB(inode->i_sb)), wb->bu_blocks);
handle = ocfs2_start_trans((OCFS2_SB(inode->i_sb)), bucket->bu_blocks);
if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
handle = NULL;
mlog_errno(ret);
goto out;
}

ret = ocfs2_xattr_bucket_journal_access(handle, wb,
ret = ocfs2_xattr_bucket_journal_access(handle, bucket,
OCFS2_JOURNAL_ACCESS_WRITE);
if (ret < 0) {
mlog_errno(ret);
Expand Down Expand Up @@ -3007,14 +2996,13 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
cmp_xe, swap_xe);

buf = bucket_buf;
for (i = 0; i < wb->bu_blocks; i++, buf += blocksize)
memcpy(bucket_block(wb, i), buf, blocksize);
ocfs2_xattr_bucket_journal_dirty(handle, wb);
for (i = 0; i < bucket->bu_blocks; i++, buf += blocksize)
memcpy(bucket_block(bucket, i), buf, blocksize);
ocfs2_xattr_bucket_journal_dirty(handle, bucket);

commit:
ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
out:
ocfs2_xattr_bucket_free(wb);
kfree(bucket_buf);
return ret;
}
Expand Down

0 comments on commit bbee515

Please sign in to comment.