Skip to content

Commit cbee7e1

Browse files
author
Joel Becker
committed
ocfs2: ocfs2_add_clusters_in_btree() no longer needs struct inode.
One more function that doesn't need a struct inode to pass to its children. Signed-off-by: Joel Becker <joel.becker@oracle.com>
1 parent cc79d8c commit cbee7e1

4 files changed

Lines changed: 14 additions & 19 deletions

File tree

‎fs/ocfs2/alloc.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4758,13 +4758,11 @@ int ocfs2_insert_extent(handle_t *handle,
47584758
* it is not limited to the file storage. Any extent tree can use this
47594759
* function if it implements the proper ocfs2_extent_tree.
47604760
*/
4761-
int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,
4762-
struct inode *inode,
4761+
int ocfs2_add_clusters_in_btree(handle_t *handle,
4762+
struct ocfs2_extent_tree *et,
47634763
u32 *logical_offset,
47644764
u32 clusters_to_add,
47654765
int mark_unwritten,
4766-
struct ocfs2_extent_tree *et,
4767-
handle_t *handle,
47684766
struct ocfs2_alloc_context *data_ac,
47694767
struct ocfs2_alloc_context *meta_ac,
47704768
enum ocfs2_alloc_restarted *reason_ret)
@@ -4775,6 +4773,8 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,
47754773
u32 bit_off, num_bits;
47764774
u64 block;
47774775
u8 flags = 0;
4776+
struct ocfs2_super *osb =
4777+
OCFS2_SB(ocfs2_metadata_cache_get_super(et->et_ci));
47784778

47794779
BUG_ON(!clusters_to_add);
47804780

@@ -4826,8 +4826,9 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,
48264826
}
48274827

48284828
block = ocfs2_clusters_to_blocks(osb->sb, bit_off);
4829-
mlog(0, "Allocating %u clusters at block %u for inode %llu\n",
4830-
num_bits, bit_off, (unsigned long long)OCFS2_I(inode)->ip_blkno);
4829+
mlog(0, "Allocating %u clusters at block %u for owner %llu\n",
4830+
num_bits, bit_off,
4831+
(unsigned long long)ocfs2_metadata_cache_owner(et->et_ci));
48314832
status = ocfs2_insert_extent(handle, et, *logical_offset, block,
48324833
num_bits, flags, meta_ac);
48334834
if (status < 0) {

‎fs/ocfs2/alloc.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,11 @@ enum ocfs2_alloc_restarted {
103103
RESTART_TRANS,
104104
RESTART_META
105105
};
106-
int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,
107-
struct inode *inode,
106+
int ocfs2_add_clusters_in_btree(handle_t *handle,
107+
struct ocfs2_extent_tree *et,
108108
u32 *logical_offset,
109109
u32 clusters_to_add,
110110
int mark_unwritten,
111-
struct ocfs2_extent_tree *et,
112-
handle_t *handle,
113111
struct ocfs2_alloc_context *data_ac,
114112
struct ocfs2_alloc_context *meta_ac,
115113
enum ocfs2_alloc_restarted *reason_ret);

‎fs/ocfs2/file.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,10 +516,9 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,
516516
struct ocfs2_extent_tree et;
517517

518518
ocfs2_init_dinode_extent_tree(&et, inode, fe_bh);
519-
ret = ocfs2_add_clusters_in_btree(osb, inode, logical_offset,
520-
clusters_to_add, mark_unwritten,
521-
&et, handle,
522-
data_ac, meta_ac, reason_ret);
519+
ret = ocfs2_add_clusters_in_btree(handle, &et, logical_offset,
520+
clusters_to_add, mark_unwritten,
521+
data_ac, meta_ac, reason_ret);
523522

524523
return ret;
525524
}

‎fs/ocfs2/xattr.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,6 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode,
597597
int status = 0;
598598
handle_t *handle = ctxt->handle;
599599
enum ocfs2_alloc_restarted why;
600-
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
601600
u32 prev_clusters, logical_start = le32_to_cpu(vb->vb_xv->xr_clusters);
602601
struct ocfs2_extent_tree et;
603602

@@ -613,13 +612,11 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode,
613612
}
614613

615614
prev_clusters = le32_to_cpu(vb->vb_xv->xr_clusters);
616-
status = ocfs2_add_clusters_in_btree(osb,
617-
inode,
615+
status = ocfs2_add_clusters_in_btree(handle,
616+
&et,
618617
&logical_start,
619618
clusters_to_add,
620619
0,
621-
&et,
622-
handle,
623620
ctxt->data_ac,
624621
ctxt->meta_ac,
625622
&why);

0 commit comments

Comments
 (0)