ocfs2: use ocfs2_alloc_dinode_update_counts() instead of open coding
ocfs2_search_chain() makes the same updates as ocfs2_alloc_dinode_update_counts to the alloc inode. Instead of open coding the bitmap update, use our helper function. Signed-off-by: Mark Fasheh <mfasheh@suse.com> Signed-off-by: Tao Ma <tao.ma@oracle.com>
This commit is contained in:
@@ -1719,7 +1719,6 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
|
|||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
u16 chain;
|
u16 chain;
|
||||||
u32 tmp_used;
|
|
||||||
u64 next_group;
|
u64 next_group;
|
||||||
struct inode *alloc_inode = ac->ac_inode;
|
struct inode *alloc_inode = ac->ac_inode;
|
||||||
struct buffer_head *group_bh = NULL;
|
struct buffer_head *group_bh = NULL;
|
||||||
@@ -1807,22 +1806,14 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ok, claim our bits now: set the info on dinode, chainlist
|
status = ocfs2_alloc_dinode_update_counts(alloc_inode, handle,
|
||||||
* and then the group */
|
ac->ac_bh, res->sr_bits,
|
||||||
status = ocfs2_journal_access_di(handle,
|
chain);
|
||||||
INODE_CACHE(alloc_inode),
|
if (status) {
|
||||||
ac->ac_bh,
|
|
||||||
OCFS2_JOURNAL_ACCESS_WRITE);
|
|
||||||
if (status < 0) {
|
|
||||||
mlog_errno(status);
|
mlog_errno(status);
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_used = le32_to_cpu(fe->id1.bitmap1.i_used);
|
|
||||||
fe->id1.bitmap1.i_used = cpu_to_le32(res->sr_bits + tmp_used);
|
|
||||||
le32_add_cpu(&cl->cl_recs[chain].c_free, -res->sr_bits);
|
|
||||||
ocfs2_journal_dirty(handle, ac->ac_bh);
|
|
||||||
|
|
||||||
status = ocfs2_block_group_set_bits(handle,
|
status = ocfs2_block_group_set_bits(handle,
|
||||||
alloc_inode,
|
alloc_inode,
|
||||||
bg,
|
bg,
|
||||||
|
Reference in New Issue
Block a user