提交 1ed9b777 编写于 作者: J Joel Becker 提交者: Tao Ma

ocfs2: ocfs2_claim_*() don't need an ocfs2_super argument.

They all take an ocfs2_alloc_context, which has the allocation inode.
Signed-off-by: NJoel Becker <joel.becker@oracle.com>
Signed-off-by: NTao Ma <tao.ma@oracle.com>
上级 13e434cf
......@@ -1015,8 +1015,7 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle,
count = 0;
while (count < wanted) {
status = ocfs2_claim_metadata(osb,
handle,
status = ocfs2_claim_metadata(handle,
meta_ac,
wanted - count,
&suballoc_bit_start,
......@@ -4786,7 +4785,7 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
goto leave;
}
status = __ocfs2_claim_clusters(osb, handle, data_ac, 1,
status = __ocfs2_claim_clusters(handle, data_ac, 1,
clusters_to_add, &bit_off, &num_bits);
if (status < 0) {
if (status != -ENOSPC)
......@@ -7201,7 +7200,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv;
ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off,
ret = ocfs2_claim_clusters(handle, data_ac, 1, &bit_off,
&num);
if (ret) {
mlog_errno(ret);
......
......@@ -2402,7 +2402,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
struct ocfs2_dir_block_trailer *trailer =
ocfs2_trailer_from_bh(dirdata_bh, dir->i_sb);
ret = ocfs2_claim_metadata(osb, handle, meta_ac, 1, &dr_suballoc_bit,
ret = ocfs2_claim_metadata(handle, meta_ac, 1, &dr_suballoc_bit,
&num_bits, &dr_blkno);
if (ret) {
mlog_errno(ret);
......@@ -2544,7 +2544,7 @@ static int __ocfs2_dx_dir_new_cluster(struct inode *dir,
* chance of contiguousness as the directory grows in number
* of entries.
*/
ret = __ocfs2_claim_clusters(osb, handle, data_ac, 1, 1, &phys, &num);
ret = __ocfs2_claim_clusters(handle, data_ac, 1, 1, &phys, &num);
if (ret) {
mlog_errno(ret);
goto out;
......@@ -2979,7 +2979,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
*/
if (ocfs2_dir_resv_allowed(osb))
data_ac->ac_resv = &oi->ip_la_data_resv;
ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, &len);
ret = ocfs2_claim_clusters(handle, data_ac, 1, &bit_off, &len);
if (ret) {
mlog_errno(ret);
goto out_commit;
......@@ -3118,7 +3118,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
* pass. Claim the 2nd cluster as a separate extent.
*/
if (alloc > len) {
ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off,
ret = ocfs2_claim_clusters(handle, data_ac, 1, &bit_off,
&len);
if (ret) {
mlog_errno(ret);
......
......@@ -1161,7 +1161,7 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb,
/* we used the generic suballoc reserve function, but we set
* everything up nicely, so there's no reason why we can't use
* the more specific cluster api to claim bits. */
status = ocfs2_claim_clusters(osb, handle, ac, osb->local_alloc_bits,
status = ocfs2_claim_clusters(handle, ac, osb->local_alloc_bits,
&cluster_off, &cluster_count);
if (status == -ENOSPC) {
retry_enospc:
......@@ -1175,7 +1175,7 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb,
goto bail;
ac->ac_bits_wanted = osb->local_alloc_default_bits;
status = ocfs2_claim_clusters(osb, handle, ac,
status = ocfs2_claim_clusters(handle, ac,
osb->local_alloc_bits,
&cluster_off,
&cluster_count);
......
......@@ -478,7 +478,7 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
*new_fe_bh = NULL;
status = ocfs2_claim_new_inode(osb, handle, dir, parent_fe_bh,
status = ocfs2_claim_new_inode(handle, dir, parent_fe_bh,
inode_ac, &suballoc_bit, &fe_blkno);
if (status < 0) {
mlog_errno(status);
......
......@@ -597,7 +597,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode,
goto out_commit;
}
ret = ocfs2_claim_metadata(osb, handle, meta_ac, 1,
ret = ocfs2_claim_metadata(handle, meta_ac, 1,
&suballoc_bit_start, &num_got,
&first_blkno);
if (ret) {
......@@ -1297,7 +1297,7 @@ static int ocfs2_expand_inline_ref_root(handle_t *handle,
goto out;
}
ret = ocfs2_claim_metadata(OCFS2_SB(sb), handle, meta_ac, 1,
ret = ocfs2_claim_metadata(handle, meta_ac, 1,
&suballoc_bit_start, &num_got,
&blkno);
if (ret) {
......@@ -1547,7 +1547,7 @@ static int ocfs2_new_leaf_refcount_block(handle_t *handle,
goto out;
}
ret = ocfs2_claim_metadata(OCFS2_SB(sb), handle, meta_ac, 1,
ret = ocfs2_claim_metadata(handle, meta_ac, 1,
&suballoc_bit_start, &num_got,
&blkno);
if (ret) {
......@@ -3271,7 +3271,7 @@ static int ocfs2_make_clusters_writable(struct super_block *sb,
} else {
delete = 1;
ret = __ocfs2_claim_clusters(osb, handle,
ret = __ocfs2_claim_clusters(handle,
context->data_ac,
1, set_len,
&new_bit, &new_len);
......
......@@ -439,7 +439,7 @@ ocfs2_block_group_alloc_contig(struct ocfs2_super *osb, handle_t *handle,
struct buffer_head *bg_bh;
unsigned int alloc_rec = ocfs2_find_smallest_chain(cl);
status = ocfs2_claim_clusters(osb, handle, ac,
status = ocfs2_claim_clusters(handle, ac,
le16_to_cpu(cl->cl_cpg), &bit_off,
&num_bits);
if (status < 0) {
......@@ -481,7 +481,7 @@ static int ocfs2_block_group_claim_bits(struct ocfs2_super *osb,
int status;
while (min_bits) {
status = ocfs2_claim_clusters(osb, handle, ac, min_bits,
status = ocfs2_claim_clusters(handle, ac, min_bits,
bit_off, num_bits);
if (status != -ENOSPC)
break;
......@@ -1919,8 +1919,7 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac,
return status;
}
int ocfs2_claim_metadata(struct ocfs2_super *osb,
handle_t *handle,
int ocfs2_claim_metadata(handle_t *handle,
struct ocfs2_alloc_context *ac,
u32 bits_wanted,
u16 *suballoc_bit_start,
......@@ -1943,7 +1942,7 @@ int ocfs2_claim_metadata(struct ocfs2_super *osb,
mlog_errno(status);
goto bail;
}
atomic_inc(&osb->alloc_stats.bg_allocs);
atomic_inc(&OCFS2_SB(ac->ac_inode->i_sb)->alloc_stats.bg_allocs);
*suballoc_bit_start = res.sr_bit_offset;
*blkno_start = res.sr_bg_blkno + (u64)(res.sr_bit_offset);
......@@ -1986,8 +1985,7 @@ static inline void ocfs2_save_inode_ac_group(struct inode *dir,
OCFS2_I(dir)->ip_last_used_slot = ac->ac_alloc_slot;
}
int ocfs2_claim_new_inode(struct ocfs2_super *osb,
handle_t *handle,
int ocfs2_claim_new_inode(handle_t *handle,
struct inode *dir,
struct buffer_head *parent_fe_bh,
struct ocfs2_alloc_context *ac,
......@@ -2015,7 +2013,7 @@ int ocfs2_claim_new_inode(struct ocfs2_super *osb,
mlog_errno(status);
goto bail;
}
atomic_inc(&osb->alloc_stats.bg_allocs);
atomic_inc(&OCFS2_SB(ac->ac_inode->i_sb)->alloc_stats.bg_allocs);
BUG_ON(res.sr_bits != 1);
......@@ -2090,8 +2088,7 @@ static inline void ocfs2_block_to_cluster_group(struct inode *inode,
* contig. allocation, set to '1' to indicate we can deal with extents
* of any size.
*/
int __ocfs2_claim_clusters(struct ocfs2_super *osb,
handle_t *handle,
int __ocfs2_claim_clusters(handle_t *handle,
struct ocfs2_alloc_context *ac,
u32 min_clusters,
u32 max_clusters,
......@@ -2101,6 +2098,7 @@ int __ocfs2_claim_clusters(struct ocfs2_super *osb,
int status;
unsigned int bits_wanted = max_clusters;
struct ocfs2_suballoc_result res;
struct ocfs2_super *osb = OCFS2_SB(ac->ac_inode->i_sb);
mlog_entry_void();
......@@ -2161,8 +2159,7 @@ int __ocfs2_claim_clusters(struct ocfs2_super *osb,
return status;
}
int ocfs2_claim_clusters(struct ocfs2_super *osb,
handle_t *handle,
int ocfs2_claim_clusters(handle_t *handle,
struct ocfs2_alloc_context *ac,
u32 min_clusters,
u32 *cluster_start,
......@@ -2170,7 +2167,7 @@ int ocfs2_claim_clusters(struct ocfs2_super *osb,
{
unsigned int bits_wanted = ac->ac_bits_wanted - ac->ac_bits_given;
return __ocfs2_claim_clusters(osb, handle, ac, min_clusters,
return __ocfs2_claim_clusters(handle, ac, min_clusters,
bits_wanted, cluster_start, num_clusters);
}
......
......@@ -83,22 +83,19 @@ int ocfs2_reserve_clusters(struct ocfs2_super *osb,
u32 bits_wanted,
struct ocfs2_alloc_context **ac);
int ocfs2_claim_metadata(struct ocfs2_super *osb,
handle_t *handle,
int ocfs2_claim_metadata(handle_t *handle,
struct ocfs2_alloc_context *ac,
u32 bits_wanted,
u16 *suballoc_bit_start,
u32 *num_bits,
u64 *blkno_start);
int ocfs2_claim_new_inode(struct ocfs2_super *osb,
handle_t *handle,
int ocfs2_claim_new_inode(handle_t *handle,
struct inode *dir,
struct buffer_head *parent_fe_bh,
struct ocfs2_alloc_context *ac,
u16 *suballoc_bit,
u64 *fe_blkno);
int ocfs2_claim_clusters(struct ocfs2_super *osb,
handle_t *handle,
int ocfs2_claim_clusters(handle_t *handle,
struct ocfs2_alloc_context *ac,
u32 min_clusters,
u32 *cluster_start,
......@@ -107,8 +104,7 @@ int ocfs2_claim_clusters(struct ocfs2_super *osb,
* Use this variant of ocfs2_claim_clusters to specify a maxiumum
* number of clusters smaller than the allocation reserved.
*/
int __ocfs2_claim_clusters(struct ocfs2_super *osb,
handle_t *handle,
int __ocfs2_claim_clusters(handle_t *handle,
struct ocfs2_alloc_context *ac,
u32 min_clusters,
u32 max_clusters,
......
......@@ -2831,7 +2831,6 @@ static int ocfs2_create_xattr_block(struct inode *inode,
u32 num_got;
u64 first_blkno;
struct ocfs2_dinode *di = (struct ocfs2_dinode *)inode_bh->b_data;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
struct buffer_head *new_bh = NULL;
struct ocfs2_xattr_block *xblk;
......@@ -2842,7 +2841,7 @@ static int ocfs2_create_xattr_block(struct inode *inode,
goto end;
}
ret = ocfs2_claim_metadata(osb, ctxt->handle, ctxt->meta_ac, 1,
ret = ocfs2_claim_metadata(ctxt->handle, ctxt->meta_ac, 1,
&suballoc_bit_start, &num_got,
&first_blkno);
if (ret < 0) {
......@@ -2867,7 +2866,8 @@ static int ocfs2_create_xattr_block(struct inode *inode,
strcpy((void *)xblk, OCFS2_XATTR_BLOCK_SIGNATURE);
xblk->xb_suballoc_slot = cpu_to_le16(ctxt->meta_ac->ac_alloc_slot);
xblk->xb_suballoc_bit = cpu_to_le16(suballoc_bit_start);
xblk->xb_fs_generation = cpu_to_le32(osb->fs_generation);
xblk->xb_fs_generation =
cpu_to_le32(OCFS2_SB(inode->i_sb)->fs_generation);
xblk->xb_blkno = cpu_to_le64(first_blkno);
if (indexed) {
struct ocfs2_xattr_tree_root *xr = &xblk->xb_attrs.xb_root;
......@@ -4229,7 +4229,6 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,
u32 bit_off, len;
u64 blkno;
handle_t *handle = ctxt->handle;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
struct ocfs2_inode_info *oi = OCFS2_I(inode);
struct buffer_head *xb_bh = xs->xattr_bh;
struct ocfs2_xattr_block *xb =
......@@ -4257,7 +4256,7 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,
goto out;
}
ret = __ocfs2_claim_clusters(osb, handle, ctxt->data_ac,
ret = __ocfs2_claim_clusters(handle, ctxt->data_ac,
1, 1, &bit_off, &len);
if (ret) {
mlog_errno(ret);
......@@ -5078,7 +5077,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,
goto leave;
}
ret = __ocfs2_claim_clusters(osb, handle, ctxt->data_ac, 1,
ret = __ocfs2_claim_clusters(handle, ctxt->data_ac, 1,
clusters_to_add, &bit_off, &num_bits);
if (ret < 0) {
if (ret != -ENOSPC)
......@@ -6906,7 +6905,7 @@ static int ocfs2_reflink_xattr_rec(struct inode *inode,
goto out;
}
ret = ocfs2_claim_clusters(osb, handle, data_ac,
ret = ocfs2_claim_clusters(handle, data_ac,
len, &p_cluster, &num_clusters);
if (ret) {
mlog_errno(ret);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册