|
@@ -351,6 +351,7 @@ again:
|
|
|
h->bytes_reserved = 0;
|
|
|
h->delayed_ref_updates = 0;
|
|
|
h->use_count = 1;
|
|
|
+ h->adding_csums = 0;
|
|
|
h->block_rsv = NULL;
|
|
|
h->orig_rsv = NULL;
|
|
|
h->aborted = 0;
|
|
@@ -473,7 +474,6 @@ int btrfs_should_end_transaction(struct btrfs_trans_handle *trans,
|
|
|
struct btrfs_root *root)
|
|
|
{
|
|
|
struct btrfs_transaction *cur_trans = trans->transaction;
|
|
|
- struct btrfs_block_rsv *rsv = trans->block_rsv;
|
|
|
int updates;
|
|
|
int err;
|
|
|
|
|
@@ -481,12 +481,6 @@ int btrfs_should_end_transaction(struct btrfs_trans_handle *trans,
|
|
|
if (cur_trans->blocked || cur_trans->delayed_refs.flushing)
|
|
|
return 1;
|
|
|
|
|
|
- /*
|
|
|
- * We need to do this in case we're deleting csums so the global block
|
|
|
- * rsv get's used instead of the csum block rsv.
|
|
|
- */
|
|
|
- trans->block_rsv = NULL;
|
|
|
-
|
|
|
updates = trans->delayed_ref_updates;
|
|
|
trans->delayed_ref_updates = 0;
|
|
|
if (updates) {
|
|
@@ -495,8 +489,6 @@ int btrfs_should_end_transaction(struct btrfs_trans_handle *trans,
|
|
|
return err;
|
|
|
}
|
|
|
|
|
|
- trans->block_rsv = rsv;
|
|
|
-
|
|
|
return should_end_transaction(trans, root);
|
|
|
}
|
|
|
|
|
@@ -513,8 +505,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- btrfs_trans_release_metadata(trans, root);
|
|
|
- trans->block_rsv = NULL;
|
|
|
while (count < 2) {
|
|
|
unsigned long cur = trans->delayed_ref_updates;
|
|
|
trans->delayed_ref_updates = 0;
|
|
@@ -527,6 +517,8 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
|
|
|
}
|
|
|
count++;
|
|
|
}
|
|
|
+ btrfs_trans_release_metadata(trans, root);
|
|
|
+ trans->block_rsv = NULL;
|
|
|
|
|
|
if (lock && !atomic_read(&root->fs_info->open_ioctl_trans) &&
|
|
|
should_end_transaction(trans, root)) {
|
|
@@ -1269,9 +1261,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
|
|
|
|
|
|
btrfs_run_ordered_operations(root, 0);
|
|
|
|
|
|
- btrfs_trans_release_metadata(trans, root);
|
|
|
- trans->block_rsv = NULL;
|
|
|
-
|
|
|
if (cur_trans->aborted)
|
|
|
goto cleanup_transaction;
|
|
|
|
|
@@ -1282,6 +1271,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
|
|
|
if (ret)
|
|
|
goto cleanup_transaction;
|
|
|
|
|
|
+ btrfs_trans_release_metadata(trans, root);
|
|
|
+ trans->block_rsv = NULL;
|
|
|
+
|
|
|
cur_trans = trans->transaction;
|
|
|
|
|
|
/*
|
|
@@ -1533,6 +1525,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
|
|
|
return ret;
|
|
|
|
|
|
cleanup_transaction:
|
|
|
+ btrfs_trans_release_metadata(trans, root);
|
|
|
+ trans->block_rsv = NULL;
|
|
|
btrfs_printk(root->fs_info, "Skipping commit of aborted transaction.\n");
|
|
|
// WARN_ON(1);
|
|
|
if (current->journal_info == trans)
|