ocfs2/xattr: Remove additional bucket allocation in bucket defragment.
Joel has refactored xattr bucket and make xattr bucket a general wrapper. So in ocfs2_defrag_xattr_bucket, we have already passed the bucket in, so there is no need to allocate a new one and read it. Signed-off-by: Tao Ma <tao.ma@oracle.com> Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
This commit is contained in:
Родитель
02dbf38d19
Коммит
1c32a2fd46
|
@ -2898,7 +2898,6 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
|
||||||
size_t blocksize = inode->i_sb->s_blocksize;
|
size_t blocksize = inode->i_sb->s_blocksize;
|
||||||
handle_t *handle;
|
handle_t *handle;
|
||||||
struct ocfs2_xattr_entry *xe;
|
struct ocfs2_xattr_entry *xe;
|
||||||
struct ocfs2_xattr_bucket *wb = NULL;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In order to make the operation more efficient and generic,
|
* In order to make the operation more efficient and generic,
|
||||||
|
@ -2912,21 +2911,11 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
|
||||||
goto out;
|
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;
|
buf = bucket_buf;
|
||||||
for (i = 0; i < wb->bu_blocks; i++, buf += blocksize)
|
for (i = 0; i < bucket->bu_blocks; i++, buf += blocksize)
|
||||||
memcpy(buf, bucket_block(wb, i), 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)) {
|
if (IS_ERR(handle)) {
|
||||||
ret = PTR_ERR(handle);
|
ret = PTR_ERR(handle);
|
||||||
handle = NULL;
|
handle = NULL;
|
||||||
|
@ -2934,7 +2923,7 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ocfs2_xattr_bucket_journal_access(handle, wb,
|
ret = ocfs2_xattr_bucket_journal_access(handle, bucket,
|
||||||
OCFS2_JOURNAL_ACCESS_WRITE);
|
OCFS2_JOURNAL_ACCESS_WRITE);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
mlog_errno(ret);
|
mlog_errno(ret);
|
||||||
|
@ -3007,14 +2996,13 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
|
||||||
cmp_xe, swap_xe);
|
cmp_xe, swap_xe);
|
||||||
|
|
||||||
buf = bucket_buf;
|
buf = bucket_buf;
|
||||||
for (i = 0; i < wb->bu_blocks; i++, buf += blocksize)
|
for (i = 0; i < bucket->bu_blocks; i++, buf += blocksize)
|
||||||
memcpy(bucket_block(wb, i), buf, blocksize);
|
memcpy(bucket_block(bucket, i), buf, blocksize);
|
||||||
ocfs2_xattr_bucket_journal_dirty(handle, wb);
|
ocfs2_xattr_bucket_journal_dirty(handle, bucket);
|
||||||
|
|
||||||
commit:
|
commit:
|
||||||
ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
|
ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
|
||||||
out:
|
out:
|
||||||
ocfs2_xattr_bucket_free(wb);
|
|
||||||
kfree(bucket_buf);
|
kfree(bucket_buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче