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

Commit 3a45bb20 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by David Sterba
Browse files

btrfs: remove root parameter from transaction commit/end routines



Now we only use the root parameter to print the root objectid in
a tracepoint.  We can use the root parameter from the transaction
handle for that.  It's also used to join the transaction with
async commits, so we remove the comment that it's just for checking.

Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent bf89d38f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2056,7 +2056,7 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
out:
	if (!search_commit_root) {
		btrfs_put_tree_mod_seq(fs_info, &tree_mod_seq_elem);
		btrfs_end_transaction(trans, fs_info->extent_root);
		btrfs_end_transaction(trans);
	} else {
		up_read(&fs_info->commit_root_sem);
	}
+2 −2
Original line number Diff line number Diff line
@@ -1280,7 +1280,7 @@ int btrfs_commit_inode_delayed_inode(struct inode *inode)
	btrfs_free_path(path);
	trans->block_rsv = block_rsv;
trans_out:
	btrfs_end_transaction(trans, delayed_node->root);
	btrfs_end_transaction(trans);
	btrfs_btree_balance_dirty(fs_info);
out:
	btrfs_release_delayed_node(delayed_node);
@@ -1345,7 +1345,7 @@ static void btrfs_async_run_delayed_root(struct btrfs_work *work)
	__btrfs_commit_inode_delayed_items(trans, path, delayed_node);

	trans->block_rsv = block_rsv;
	btrfs_end_transaction(trans, root);
	btrfs_end_transaction(trans);
	btrfs_btree_balance_dirty_nodelay(root->fs_info);

release_path:
+5 −5
Original line number Diff line number Diff line
@@ -335,7 +335,7 @@ int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info, char *tgtdev_name,
	 */
	trans = btrfs_attach_transaction(root);
	if (!IS_ERR(trans)) {
		ret = btrfs_commit_transaction(trans, root);
		ret = btrfs_commit_transaction(trans);
		if (ret)
			return ret;
	} else if (PTR_ERR(trans) != -ENOENT) {
@@ -397,7 +397,7 @@ int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info, char *tgtdev_name,
		goto leave;
	}

	ret = btrfs_commit_transaction(trans, root);
	ret = btrfs_commit_transaction(trans);
	WARN_ON(ret);

	/* the disk copy procedure reuses the scrub code */
@@ -513,7 +513,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
		mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
		return PTR_ERR(trans);
	}
	ret = btrfs_commit_transaction(trans, root);
	ret = btrfs_commit_transaction(trans);
	WARN_ON(ret);

	mutex_lock(&uuid_mutex);
@@ -603,7 +603,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
	/* write back the superblocks */
	trans = btrfs_start_transaction(root, 0);
	if (!IS_ERR(trans))
		btrfs_commit_transaction(trans, root);
		btrfs_commit_transaction(trans);

	mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);

@@ -718,7 +718,7 @@ static u64 __btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info)
		mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
		return PTR_ERR(trans);
	}
	ret = btrfs_commit_transaction(trans, root);
	ret = btrfs_commit_transaction(trans);
	WARN_ON(ret);
	if (tgt_device)
		btrfs_destroy_dev_replace_tgtdev(fs_info, tgt_device);
+4 −4
Original line number Diff line number Diff line
@@ -1913,7 +1913,7 @@ static int cleaner_kthread(void *arg)
	} else {
		int ret;

		ret = btrfs_commit_transaction(trans, root);
		ret = btrfs_commit_transaction(trans);
		if (ret)
			btrfs_err(fs_info,
				  "cleaner open transaction commit returned %d",
@@ -1965,9 +1965,9 @@ static int transaction_kthread(void *arg)
			goto sleep;
		}
		if (transid == trans->transid) {
			btrfs_commit_transaction(trans, root);
			btrfs_commit_transaction(trans);
		} else {
			btrfs_end_transaction(trans, root);
			btrfs_end_transaction(trans);
		}
sleep:
		wake_up_process(fs_info->cleaner_kthread);
@@ -3901,7 +3901,7 @@ int btrfs_commit_super(struct btrfs_fs_info *fs_info)
	trans = btrfs_join_transaction(root);
	if (IS_ERR(trans))
		return PTR_ERR(trans);
	return btrfs_commit_transaction(trans, root);
	return btrfs_commit_transaction(trans);
}

void close_ctree(struct btrfs_fs_info *fs_info)
+15 −16
Original line number Diff line number Diff line
@@ -2868,7 +2868,7 @@ static void delayed_ref_async_start(struct btrfs_work *work)
	if (ret)
		async->error = ret;
end:
	ret = btrfs_end_transaction(trans, async->root);
	ret = btrfs_end_transaction(trans);
	if (ret && !async->error)
		async->error = ret;
done:
@@ -4175,7 +4175,7 @@ int btrfs_alloc_data_chunk_ondemand(struct inode *inode, u64 bytes)

			ret = do_chunk_alloc(trans, fs_info, alloc_target,
					     CHUNK_ALLOC_NO_FORCE);
			btrfs_end_transaction(trans, root);
			btrfs_end_transaction(trans);
			if (ret < 0) {
				if (ret != -ENOSPC)
					return ret;
@@ -4220,7 +4220,7 @@ int btrfs_alloc_data_chunk_ondemand(struct inode *inode, u64 bytes)
			    test_bit(BTRFS_TRANS_HAVE_FREE_BGS,
				     &trans->transaction->flags) ||
			    need_commit > 0) {
				ret = btrfs_commit_transaction(trans, root);
				ret = btrfs_commit_transaction(trans);
				if (ret)
					return ret;
				/*
@@ -4232,7 +4232,7 @@ int btrfs_alloc_data_chunk_ondemand(struct inode *inode, u64 bytes)
				mutex_unlock(&fs_info->cleaner_delayed_iput_mutex);
				goto again;
			} else {
				btrfs_end_transaction(trans, root);
				btrfs_end_transaction(trans);
			}
		}

@@ -4824,7 +4824,7 @@ static int may_commit_transaction(struct btrfs_root *root,
	if (IS_ERR(trans))
		return -ENOSPC;

	return btrfs_commit_transaction(trans, root);
	return btrfs_commit_transaction(trans);
}

struct reserve_ticket {
@@ -4857,7 +4857,7 @@ static int flush_space(struct btrfs_root *root,
			break;
		}
		ret = btrfs_run_delayed_items_nr(trans, fs_info, nr);
		btrfs_end_transaction(trans, root);
		btrfs_end_transaction(trans);
		break;
	case FLUSH_DELALLOC:
	case FLUSH_DELALLOC_WAIT:
@@ -4873,7 +4873,7 @@ static int flush_space(struct btrfs_root *root,
		ret = do_chunk_alloc(trans, fs_info,
				     btrfs_get_alloc_profile(root, 0),
				     CHUNK_ALLOC_NO_FORCE);
		btrfs_end_transaction(trans, root);
		btrfs_end_transaction(trans);
		if (ret > 0 || ret == -ENOSPC)
			ret = 0;
		break;
@@ -7854,7 +7854,7 @@ static noinline int find_free_extent(struct btrfs_root *orig_root,
			else
				ret = 0;
			if (!exist)
				btrfs_end_transaction(trans, root);
				btrfs_end_transaction(trans);
			if (ret)
				goto out;
		}
@@ -9106,7 +9106,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
		}

		BUG_ON(wc->level == 0);
		if (btrfs_should_end_transaction(trans, tree_root) ||
		if (btrfs_should_end_transaction(trans) ||
		    (!for_reloc && btrfs_need_cleaner_sleep(fs_info))) {
			ret = btrfs_update_root(trans, tree_root,
						&root->root_key,
@@ -9117,7 +9117,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
				goto out_end_trans;
			}

			btrfs_end_transaction_throttle(trans, tree_root);
			btrfs_end_transaction_throttle(trans);
			if (!for_reloc && btrfs_need_cleaner_sleep(fs_info)) {
				btrfs_debug(fs_info,
					    "drop snapshot early exit");
@@ -9171,7 +9171,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
	}
	root_dropped = true;
out_end_trans:
	btrfs_end_transaction_throttle(trans, tree_root);
	btrfs_end_transaction_throttle(trans);
out_free:
	kfree(wc);
	btrfs_free_path(path);
@@ -9380,7 +9380,7 @@ int btrfs_inc_block_group_ro(struct btrfs_root *root,
		u64 transid = trans->transid;

		mutex_unlock(&fs_info->ro_block_group_mutex);
		btrfs_end_transaction(trans, root);
		btrfs_end_transaction(trans);

		ret = btrfs_wait_for_commit(fs_info, transid);
		if (ret)
@@ -9425,7 +9425,7 @@ int btrfs_inc_block_group_ro(struct btrfs_root *root,
	}
	mutex_unlock(&fs_info->ro_block_group_mutex);

	btrfs_end_transaction(trans, root);
	btrfs_end_transaction(trans);
	return ret;
}

@@ -9644,7 +9644,7 @@ int btrfs_can_relocate(struct btrfs_fs_info *fs_info, u64 bytenr)
			   "no space to allocate a new chunk for block group %llu",
			   block_group->key.objectid);
	mutex_unlock(&fs_info->chunk_mutex);
	btrfs_end_transaction(trans, root);
	btrfs_end_transaction(trans);
out:
	btrfs_put_block_group(block_group);
	return ret;
@@ -10596,7 +10596,6 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
{
	struct btrfs_block_group_cache *block_group;
	struct btrfs_space_info *space_info;
	struct btrfs_root *root = fs_info->extent_root;
	struct btrfs_trans_handle *trans;
	int ret = 0;

@@ -10747,7 +10746,7 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
			btrfs_get_block_group(block_group);
		}
end_trans:
		btrfs_end_transaction(trans, root);
		btrfs_end_transaction(trans);
next:
		mutex_unlock(&fs_info->delete_unused_bgs_mutex);
		btrfs_put_block_group(block_group);
Loading