Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc79d8c1 authored by Joel Becker's avatar Joel Becker
Browse files

ocfs2: ocfs2_insert_extent() no longer needs struct inode.



One more function down, no inode in the entire insert-extent chain.

Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
parent 92ba470c
Loading
Loading
Loading
Loading
+8 −11
Original line number Original line Diff line number Diff line
@@ -4681,13 +4681,11 @@ static int ocfs2_figure_insert_type(struct ocfs2_extent_tree *et,
}
}


/*
/*
 * Insert an extent into an inode btree.
 * Insert an extent into a btree.
 *
 *
 * The caller needs to update fe->i_clusters
 * The caller needs to update the owning btree's cluster count.
 */
 */
int ocfs2_insert_extent(struct ocfs2_super *osb,
int ocfs2_insert_extent(handle_t *handle,
			handle_t *handle,
			struct inode *inode,
			struct ocfs2_extent_tree *et,
			struct ocfs2_extent_tree *et,
			u32 cpos,
			u32 cpos,
			u64 start_blk,
			u64 start_blk,
@@ -4701,8 +4699,9 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
	struct ocfs2_insert_type insert = {0, };
	struct ocfs2_insert_type insert = {0, };
	struct ocfs2_extent_rec rec;
	struct ocfs2_extent_rec rec;


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


	memset(&rec, 0, sizeof(rec));
	memset(&rec, 0, sizeof(rec));
	rec.e_cpos = cpu_to_le32(cpos);
	rec.e_cpos = cpu_to_le32(cpos);
@@ -4829,8 +4828,7 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,
	block = ocfs2_clusters_to_blocks(osb->sb, bit_off);
	block = ocfs2_clusters_to_blocks(osb->sb, bit_off);
	mlog(0, "Allocating %u clusters at block %u for inode %llu\n",
	mlog(0, "Allocating %u clusters at block %u for inode %llu\n",
	     num_bits, bit_off, (unsigned long long)OCFS2_I(inode)->ip_blkno);
	     num_bits, bit_off, (unsigned long long)OCFS2_I(inode)->ip_blkno);
	status = ocfs2_insert_extent(osb, handle, inode, et,
	status = ocfs2_insert_extent(handle, et, *logical_offset, block,
				     *logical_offset, block,
				     num_bits, flags, meta_ac);
				     num_bits, flags, meta_ac);
	if (status < 0) {
	if (status < 0) {
		mlog_errno(status);
		mlog_errno(status);
@@ -7244,8 +7242,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
		 * the in-inode data from our pages.
		 * the in-inode data from our pages.
		 */
		 */
		ocfs2_init_dinode_extent_tree(&et, inode, di_bh);
		ocfs2_init_dinode_extent_tree(&et, inode, di_bh);
		ret = ocfs2_insert_extent(osb, handle, inode, &et,
		ret = ocfs2_insert_extent(handle, &et, 0, block, 1, 0, NULL);
					  0, block, 1, 0, NULL);
		if (ret) {
		if (ret) {
			mlog_errno(ret);
			mlog_errno(ret);
			goto out_commit;
			goto out_commit;
+1 −3
Original line number Original line Diff line number Diff line
@@ -90,9 +90,7 @@ int ocfs2_read_extent_block(struct ocfs2_caching_info *ci, u64 eb_blkno,
			    struct buffer_head **bh);
			    struct buffer_head **bh);


struct ocfs2_alloc_context;
struct ocfs2_alloc_context;
int ocfs2_insert_extent(struct ocfs2_super *osb,
int ocfs2_insert_extent(handle_t *handle,
			handle_t *handle,
			struct inode *inode,
			struct ocfs2_extent_tree *et,
			struct ocfs2_extent_tree *et,
			u32 cpos,
			u32 cpos,
			u64 start_blk,
			u64 start_blk,
+5 −7
Original line number Original line Diff line number Diff line
@@ -2591,7 +2591,6 @@ static int ocfs2_dx_dir_new_cluster(struct inode *dir,
{
{
	int ret;
	int ret;
	u64 phys_blkno;
	u64 phys_blkno;
	struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);


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


	ret = ocfs2_insert_extent(osb, handle, dir, et, cpos, phys_blkno, 1, 0,
	ret = ocfs2_insert_extent(handle, et, cpos, phys_blkno, 1, 0,
				  meta_ac);
				  meta_ac);
	if (ret)
	if (ret)
		mlog_errno(ret);
		mlog_errno(ret);
@@ -3094,7 +3093,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
	 * This should never fail as our extent list is empty and all
	 * This should never fail as our extent list is empty and all
	 * related blocks have been journaled already.
	 * related blocks have been journaled already.
	 */
	 */
	ret = ocfs2_insert_extent(osb, handle, dir, &et, 0, blkno, len,
	ret = ocfs2_insert_extent(handle, &et, 0, blkno, len,
				  0, NULL);
				  0, NULL);
	if (ret) {
	if (ret) {
		mlog_errno(ret);
		mlog_errno(ret);
@@ -3127,7 +3126,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
						      dirdata_bh);
						      dirdata_bh);
		} else {
		} else {
			ocfs2_init_dx_root_extent_tree(&dx_et, dir, dx_root_bh);
			ocfs2_init_dx_root_extent_tree(&dx_et, dir, dx_root_bh);
			ret = ocfs2_insert_extent(osb, handle, dir, &dx_et, 0,
			ret = ocfs2_insert_extent(handle, &dx_et, 0,
						  dx_insert_blkno, 1, 0, NULL);
						  dx_insert_blkno, 1, 0, NULL);
			if (ret)
			if (ret)
				mlog_errno(ret);
				mlog_errno(ret);
@@ -3147,7 +3146,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
		}
		}
		blkno = ocfs2_clusters_to_blocks(dir->i_sb, bit_off);
		blkno = ocfs2_clusters_to_blocks(dir->i_sb, bit_off);


		ret = ocfs2_insert_extent(osb, handle, dir, &et, 1,
		ret = ocfs2_insert_extent(handle, &et, 1,
					  blkno, len, 0, NULL);
					  blkno, len, 0, NULL);
		if (ret) {
		if (ret) {
			mlog_errno(ret);
			mlog_errno(ret);
@@ -4218,8 +4217,7 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir,
	/* This should never fail considering we start with an empty
	/* This should never fail considering we start with an empty
	 * dx_root. */
	 * dx_root. */
	ocfs2_init_dx_root_extent_tree(&et, dir, dx_root_bh);
	ocfs2_init_dx_root_extent_tree(&et, dir, dx_root_bh);
	ret = ocfs2_insert_extent(osb, handle, dir, &et, 0,
	ret = ocfs2_insert_extent(handle, &et, 0, insert_blkno, 1, 0, NULL);
				  insert_blkno, 1, 0, NULL);
	if (ret)
	if (ret)
		mlog_errno(ret);
		mlog_errno(ret);
	did_quota = 0;
	did_quota = 0;
+1 −1
Original line number Original line Diff line number Diff line
@@ -4325,7 +4325,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,


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