int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
struct btrfs_root *root, unsigned long count);
int btrfs_async_run_delayed_refs(struct btrfs_root *root,
- unsigned long count, u64 transid, int wait);
+ unsigned long count, int wait);
int btrfs_lookup_data_extent(struct btrfs_root *root, u64 start, u64 len);
int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
struct btrfs_root *root, u64 bytenr,
struct async_delayed_refs {
struct btrfs_root *root;
- u64 transid;
int count;
int error;
int sync;
async = container_of(work, struct async_delayed_refs, work);
- trans = btrfs_attach_transaction(async->root);
+ trans = btrfs_join_transaction(async->root);
if (IS_ERR(trans)) {
- if (PTR_ERR(trans) != -ENOENT)
- async->error = PTR_ERR(trans);
- goto done;
- }
-
- /* Don't bother flushing if we got into a different transaction */
- if (trans->transid != async->transid) {
- btrfs_end_transaction(trans, async->root);
+ async->error = PTR_ERR(trans);
goto done;
}
}
int btrfs_async_run_delayed_refs(struct btrfs_root *root,
- unsigned long count, u64 transid, int wait)
+ unsigned long count, int wait)
{
struct async_delayed_refs *async;
int ret;
async->root = root->fs_info->tree_root;
async->count = count;
async->error = 0;
- async->transid = transid;
if (wait)
async->sync = 1;
else
BUG_ON(ret);
if (btrfs_should_throttle_delayed_refs(trans, root))
btrfs_async_run_delayed_refs(root,
- trans->transid,
trans->delayed_ref_updates * 2, 0);
if (be_nice) {
if (truncate_space_check(trans, root,
{
struct btrfs_transaction *cur_trans = trans->transaction;
struct btrfs_fs_info *info = root->fs_info;
- u64 transid = trans->transid;
unsigned long cur = trans->delayed_ref_updates;
int lock = (trans->type != TRANS_JOIN_NOLOCK);
int err = 0;
kmem_cache_free(btrfs_trans_handle_cachep, trans);
if (must_run_delayed_refs) {
- btrfs_async_run_delayed_refs(root, cur, transid,
+ btrfs_async_run_delayed_refs(root, cur,
must_run_delayed_refs == 1);
}
return err;