Skip to content

Commit cc79d8c

Browse files
author
Joel Becker
committed
ocfs2: ocfs2_insert_extent() no longer needs struct inode.
One more function down, no inode in the entire insert-extent chain. Signed-off-by: Joel Becker <joel.becker@oracle.com>
1 parent 92ba470 commit cc79d8c

4 files changed

Lines changed: 15 additions & 22 deletions

File tree

‎fs/ocfs2/alloc.c‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4681,13 +4681,11 @@ static int ocfs2_figure_insert_type(struct ocfs2_extent_tree *et,
46814681
}
46824682

46834683
/*
4684-
* Insert an extent into an inode btree.
4684+
* Insert an extent into a btree.
46854685
*
4686-
* The caller needs to update fe->i_clusters
4686+
* The caller needs to update the owning btree's cluster count.
46874687
*/
4688-
int ocfs2_insert_extent(struct ocfs2_super *osb,
4689-
handle_t *handle,
4690-
struct inode *inode,
4688+
int ocfs2_insert_extent(handle_t *handle,
46914689
struct ocfs2_extent_tree *et,
46924690
u32 cpos,
46934691
u64 start_blk,
@@ -4701,8 +4699,9 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
47014699
struct ocfs2_insert_type insert = {0, };
47024700
struct ocfs2_extent_rec rec;
47034701

4704-
mlog(0, "add %u clusters at position %u to inode %llu\n",
4705-
new_clusters, cpos, (unsigned long long)OCFS2_I(inode)->ip_blkno);
4702+
mlog(0, "add %u clusters at position %u to owner %llu\n",
4703+
new_clusters, cpos,
4704+
(unsigned long long)ocfs2_metadata_cache_owner(et->et_ci));
47064705

47074706
memset(&rec, 0, sizeof(rec));
47084707
rec.e_cpos = cpu_to_le32(cpos);
@@ -4829,8 +4828,7 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,
48294828
block = ocfs2_clusters_to_blocks(osb->sb, bit_off);
48304829
mlog(0, "Allocating %u clusters at block %u for inode %llu\n",
48314830
num_bits, bit_off, (unsigned long long)OCFS2_I(inode)->ip_blkno);
4832-
status = ocfs2_insert_extent(osb, handle, inode, et,
4833-
*logical_offset, block,
4831+
status = ocfs2_insert_extent(handle, et, *logical_offset, block,
48344832
num_bits, flags, meta_ac);
48354833
if (status < 0) {
48364834
mlog_errno(status);
@@ -7244,8 +7242,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
72447242
* the in-inode data from our pages.
72457243
*/
72467244
ocfs2_init_dinode_extent_tree(&et, inode, di_bh);
7247-
ret = ocfs2_insert_extent(osb, handle, inode, &et,
7248-
0, block, 1, 0, NULL);
7245+
ret = ocfs2_insert_extent(handle, &et, 0, block, 1, 0, NULL);
72497246
if (ret) {
72507247
mlog_errno(ret);
72517248
goto out_commit;

‎fs/ocfs2/alloc.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ int ocfs2_read_extent_block(struct ocfs2_caching_info *ci, u64 eb_blkno,
9090
struct buffer_head **bh);
9191

9292
struct ocfs2_alloc_context;
93-
int ocfs2_insert_extent(struct ocfs2_super *osb,
94-
handle_t *handle,
95-
struct inode *inode,
93+
int ocfs2_insert_extent(handle_t *handle,
9694
struct ocfs2_extent_tree *et,
9795
u32 cpos,
9896
u64 start_blk,

‎fs/ocfs2/dir.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2591,7 +2591,6 @@ static int ocfs2_dx_dir_new_cluster(struct inode *dir,
25912591
{
25922592
int ret;
25932593
u64 phys_blkno;
2594-
struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
25952594

25962595
ret = __ocfs2_dx_dir_new_cluster(dir, cpos, handle, data_ac, dx_leaves,
25972596
num_dx_leaves, &phys_blkno);
@@ -2600,7 +2599,7 @@ static int ocfs2_dx_dir_new_cluster(struct inode *dir,
26002599
goto out;
26012600
}
26022601

2603-
ret = ocfs2_insert_extent(osb, handle, dir, et, cpos, phys_blkno, 1, 0,
2602+
ret = ocfs2_insert_extent(handle, et, cpos, phys_blkno, 1, 0,
26042603
meta_ac);
26052604
if (ret)
26062605
mlog_errno(ret);
@@ -3094,7 +3093,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
30943093
* This should never fail as our extent list is empty and all
30953094
* related blocks have been journaled already.
30963095
*/
3097-
ret = ocfs2_insert_extent(osb, handle, dir, &et, 0, blkno, len,
3096+
ret = ocfs2_insert_extent(handle, &et, 0, blkno, len,
30983097
0, NULL);
30993098
if (ret) {
31003099
mlog_errno(ret);
@@ -3127,7 +3126,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
31273126
dirdata_bh);
31283127
} else {
31293128
ocfs2_init_dx_root_extent_tree(&dx_et, dir, dx_root_bh);
3130-
ret = ocfs2_insert_extent(osb, handle, dir, &dx_et, 0,
3129+
ret = ocfs2_insert_extent(handle, &dx_et, 0,
31313130
dx_insert_blkno, 1, 0, NULL);
31323131
if (ret)
31333132
mlog_errno(ret);
@@ -3147,7 +3146,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
31473146
}
31483147
blkno = ocfs2_clusters_to_blocks(dir->i_sb, bit_off);
31493148

3150-
ret = ocfs2_insert_extent(osb, handle, dir, &et, 1,
3149+
ret = ocfs2_insert_extent(handle, &et, 1,
31513150
blkno, len, 0, NULL);
31523151
if (ret) {
31533152
mlog_errno(ret);
@@ -4218,8 +4217,7 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir,
42184217
/* This should never fail considering we start with an empty
42194218
* dx_root. */
42204219
ocfs2_init_dx_root_extent_tree(&et, dir, dx_root_bh);
4221-
ret = ocfs2_insert_extent(osb, handle, dir, &et, 0,
4222-
insert_blkno, 1, 0, NULL);
4220+
ret = ocfs2_insert_extent(handle, &et, 0, insert_blkno, 1, 0, NULL);
42234221
if (ret)
42244222
mlog_errno(ret);
42254223
did_quota = 0;

‎fs/ocfs2/xattr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4325,7 +4325,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,
43254325

43264326
mlog(0, "Insert %u clusters at block %llu for xattr at %u\n",
43274327
num_bits, (unsigned long long)block, v_start);
4328-
ret = ocfs2_insert_extent(osb, handle, inode, &et, v_start, block,
4328+
ret = ocfs2_insert_extent(handle, &et, v_start, block,
43294329
num_bits, 0, ctxt->meta_ac);
43304330
if (ret < 0) {
43314331
mlog_errno(ret);

0 commit comments

Comments
 (0)