Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 1 | #include <linux/module.h> |
| 2 | #include <linux/fs.h> |
| 3 | #include "ctree.h" |
| 4 | #include "disk-io.h" |
| 5 | #include "transaction.h" |
| 6 | |
Chris Mason | 78fae27 | 2007-03-25 11:35:08 -0400 | [diff] [blame] | 7 | static int total_trans = 0; |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 8 | extern struct kmem_cache *btrfs_trans_handle_cachep; |
| 9 | extern struct kmem_cache *btrfs_transaction_cachep; |
| 10 | |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 11 | #define BTRFS_ROOT_TRANS_TAG 0 |
| 12 | |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 13 | #define TRANS_MAGIC 0xE1E10E |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 14 | static void put_transaction(struct btrfs_transaction *transaction) |
| 15 | { |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 16 | WARN_ON(transaction->use_count == 0); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 17 | transaction->use_count--; |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 18 | WARN_ON(transaction->magic != TRANS_MAGIC); |
Chris Mason | 78fae27 | 2007-03-25 11:35:08 -0400 | [diff] [blame] | 19 | if (transaction->use_count == 0) { |
| 20 | WARN_ON(total_trans == 0); |
| 21 | total_trans--; |
Chris Mason | 8fd1779 | 2007-04-19 21:01:03 -0400 | [diff] [blame^] | 22 | list_del_init(&transaction->list); |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 23 | memset(transaction, 0, sizeof(*transaction)); |
| 24 | kmem_cache_free(btrfs_transaction_cachep, transaction); |
Chris Mason | 78fae27 | 2007-03-25 11:35:08 -0400 | [diff] [blame] | 25 | } |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | static int join_transaction(struct btrfs_root *root) |
| 29 | { |
| 30 | struct btrfs_transaction *cur_trans; |
| 31 | cur_trans = root->fs_info->running_transaction; |
| 32 | if (!cur_trans) { |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 33 | cur_trans = kmem_cache_alloc(btrfs_transaction_cachep, |
| 34 | GFP_NOFS); |
Chris Mason | 78fae27 | 2007-03-25 11:35:08 -0400 | [diff] [blame] | 35 | total_trans++; |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 36 | BUG_ON(!cur_trans); |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 37 | root->fs_info->generation++; |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 38 | root->fs_info->running_transaction = cur_trans; |
| 39 | cur_trans->num_writers = 0; |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 40 | cur_trans->transid = root->fs_info->generation; |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 41 | init_waitqueue_head(&cur_trans->writer_wait); |
| 42 | init_waitqueue_head(&cur_trans->commit_wait); |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 43 | cur_trans->magic = TRANS_MAGIC; |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 44 | cur_trans->in_commit = 0; |
Chris Mason | d571976 | 2007-03-23 10:01:08 -0400 | [diff] [blame] | 45 | cur_trans->use_count = 1; |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 46 | cur_trans->commit_done = 0; |
Chris Mason | 8fd1779 | 2007-04-19 21:01:03 -0400 | [diff] [blame^] | 47 | list_add_tail(&cur_trans->list, &root->fs_info->trans_list); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 48 | } |
| 49 | cur_trans->num_writers++; |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root, |
| 54 | int num_blocks) |
| 55 | { |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 56 | struct btrfs_trans_handle *h = |
| 57 | kmem_cache_alloc(btrfs_trans_handle_cachep, GFP_NOFS); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 58 | int ret; |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 59 | u64 running_trans_id; |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 60 | |
| 61 | mutex_lock(&root->fs_info->trans_mutex); |
| 62 | ret = join_transaction(root); |
| 63 | BUG_ON(ret); |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 64 | running_trans_id = root->fs_info->running_transaction->transid; |
| 65 | |
| 66 | if (root != root->fs_info->tree_root && root->last_trans < |
| 67 | running_trans_id) { |
| 68 | radix_tree_tag_set(&root->fs_info->fs_roots_radix, |
Chris Mason | 2619ba1 | 2007-04-10 16:58:11 -0400 | [diff] [blame] | 69 | (unsigned long)root->root_key.objectid, |
| 70 | BTRFS_ROOT_TRANS_TAG); |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 71 | root->commit_root = root->node; |
| 72 | get_bh(root->node); |
| 73 | } |
| 74 | root->last_trans = running_trans_id; |
| 75 | h->transid = running_trans_id; |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 76 | h->transaction = root->fs_info->running_transaction; |
| 77 | h->blocks_reserved = num_blocks; |
| 78 | h->blocks_used = 0; |
| 79 | root->fs_info->running_transaction->use_count++; |
| 80 | mutex_unlock(&root->fs_info->trans_mutex); |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 81 | h->magic = h->magic2 = TRANS_MAGIC; |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 82 | return h; |
| 83 | } |
| 84 | |
| 85 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, |
| 86 | struct btrfs_root *root) |
| 87 | { |
| 88 | struct btrfs_transaction *cur_trans; |
Chris Mason | d6e4a42 | 2007-04-06 15:37:36 -0400 | [diff] [blame] | 89 | |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 90 | WARN_ON(trans->magic != TRANS_MAGIC); |
| 91 | WARN_ON(trans->magic2 != TRANS_MAGIC); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 92 | mutex_lock(&root->fs_info->trans_mutex); |
| 93 | cur_trans = root->fs_info->running_transaction; |
Chris Mason | d571976 | 2007-03-23 10:01:08 -0400 | [diff] [blame] | 94 | WARN_ON(cur_trans->num_writers < 1); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 95 | if (waitqueue_active(&cur_trans->writer_wait)) |
| 96 | wake_up(&cur_trans->writer_wait); |
| 97 | cur_trans->num_writers--; |
| 98 | put_transaction(cur_trans); |
| 99 | mutex_unlock(&root->fs_info->trans_mutex); |
Chris Mason | d602557 | 2007-03-30 14:27:56 -0400 | [diff] [blame] | 100 | memset(trans, 0, sizeof(*trans)); |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 101 | kmem_cache_free(btrfs_trans_handle_cachep, trans); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | |
| 106 | int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, |
| 107 | struct btrfs_root *root) |
| 108 | { |
Chris Mason | 7cfcc17 | 2007-04-02 14:53:59 -0400 | [diff] [blame] | 109 | filemap_write_and_wait(root->fs_info->btree_inode->i_mapping); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 110 | return 0; |
| 111 | } |
| 112 | |
| 113 | int btrfs_commit_tree_roots(struct btrfs_trans_handle *trans, |
| 114 | struct btrfs_root *root) |
| 115 | { |
| 116 | int ret; |
| 117 | u64 old_extent_block; |
| 118 | struct btrfs_fs_info *fs_info = root->fs_info; |
| 119 | struct btrfs_root *tree_root = fs_info->tree_root; |
| 120 | struct btrfs_root *extent_root = fs_info->extent_root; |
Chris Mason | 8352d8a | 2007-04-12 10:43:05 -0400 | [diff] [blame] | 121 | struct btrfs_root *dev_root = fs_info->dev_root; |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 122 | |
Chris Mason | 8352d8a | 2007-04-12 10:43:05 -0400 | [diff] [blame] | 123 | if (btrfs_super_device_root(fs_info->disk_super) != |
| 124 | bh_blocknr(dev_root->node)) { |
| 125 | btrfs_set_super_device_root(fs_info->disk_super, |
| 126 | bh_blocknr(dev_root->node)); |
| 127 | } |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 128 | while(1) { |
| 129 | old_extent_block = btrfs_root_blocknr(&extent_root->root_item); |
Chris Mason | 7eccb90 | 2007-04-11 15:53:25 -0400 | [diff] [blame] | 130 | if (old_extent_block == bh_blocknr(extent_root->node)) |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 131 | break; |
| 132 | btrfs_set_root_blocknr(&extent_root->root_item, |
Chris Mason | 7eccb90 | 2007-04-11 15:53:25 -0400 | [diff] [blame] | 133 | bh_blocknr(extent_root->node)); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 134 | ret = btrfs_update_root(trans, tree_root, |
| 135 | &extent_root->root_key, |
| 136 | &extent_root->root_item); |
| 137 | BUG_ON(ret); |
| 138 | } |
| 139 | return 0; |
| 140 | } |
| 141 | |
| 142 | static int wait_for_commit(struct btrfs_root *root, |
| 143 | struct btrfs_transaction *commit) |
| 144 | { |
| 145 | DEFINE_WAIT(wait); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 146 | while(!commit->commit_done) { |
| 147 | prepare_to_wait(&commit->commit_wait, &wait, |
| 148 | TASK_UNINTERRUPTIBLE); |
| 149 | if (commit->commit_done) |
| 150 | break; |
| 151 | mutex_unlock(&root->fs_info->trans_mutex); |
| 152 | schedule(); |
| 153 | mutex_lock(&root->fs_info->trans_mutex); |
| 154 | } |
| 155 | finish_wait(&commit->commit_wait, &wait); |
| 156 | return 0; |
| 157 | } |
| 158 | |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 159 | struct dirty_root { |
| 160 | struct list_head list; |
| 161 | struct btrfs_key snap_key; |
| 162 | struct buffer_head *commit_root; |
| 163 | struct btrfs_root *root; |
| 164 | }; |
| 165 | |
| 166 | int add_dirty_roots(struct btrfs_trans_handle *trans, |
| 167 | struct radix_tree_root *radix, struct list_head *list) |
| 168 | { |
| 169 | struct dirty_root *dirty; |
| 170 | struct btrfs_root *gang[8]; |
| 171 | struct btrfs_root *root; |
| 172 | int i; |
| 173 | int ret; |
| 174 | int err; |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 175 | while(1) { |
| 176 | ret = radix_tree_gang_lookup_tag(radix, (void **)gang, 0, |
| 177 | ARRAY_SIZE(gang), |
| 178 | BTRFS_ROOT_TRANS_TAG); |
| 179 | if (ret == 0) |
| 180 | break; |
| 181 | for (i = 0; i < ret; i++) { |
| 182 | root = gang[i]; |
Chris Mason | 2619ba1 | 2007-04-10 16:58:11 -0400 | [diff] [blame] | 183 | radix_tree_tag_clear(radix, |
| 184 | (unsigned long)root->root_key.objectid, |
| 185 | BTRFS_ROOT_TRANS_TAG); |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 186 | if (root->commit_root == root->node) { |
Chris Mason | 7eccb90 | 2007-04-11 15:53:25 -0400 | [diff] [blame] | 187 | WARN_ON(bh_blocknr(root->node) != |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 188 | btrfs_root_blocknr(&root->root_item)); |
| 189 | brelse(root->commit_root); |
| 190 | root->commit_root = NULL; |
| 191 | continue; |
| 192 | } |
| 193 | dirty = kmalloc(sizeof(*dirty), GFP_NOFS); |
| 194 | BUG_ON(!dirty); |
| 195 | memcpy(&dirty->snap_key, &root->root_key, |
| 196 | sizeof(root->root_key)); |
| 197 | dirty->commit_root = root->commit_root; |
| 198 | root->commit_root = NULL; |
| 199 | dirty->root = root; |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 200 | root->root_key.offset = root->fs_info->generation; |
| 201 | btrfs_set_root_blocknr(&root->root_item, |
Chris Mason | 7eccb90 | 2007-04-11 15:53:25 -0400 | [diff] [blame] | 202 | bh_blocknr(root->node)); |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 203 | err = btrfs_insert_root(trans, root->fs_info->tree_root, |
| 204 | &root->root_key, |
| 205 | &root->root_item); |
| 206 | BUG_ON(err); |
| 207 | list_add(&dirty->list, list); |
| 208 | } |
| 209 | } |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 210 | return 0; |
| 211 | } |
| 212 | |
| 213 | int drop_dirty_roots(struct btrfs_root *tree_root, struct list_head *list) |
| 214 | { |
| 215 | struct dirty_root *dirty; |
| 216 | struct btrfs_trans_handle *trans; |
| 217 | int ret; |
| 218 | |
| 219 | while(!list_empty(list)) { |
| 220 | dirty = list_entry(list->next, struct dirty_root, list); |
| 221 | list_del_init(&dirty->list); |
| 222 | trans = btrfs_start_transaction(tree_root, 1); |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 223 | ret = btrfs_drop_snapshot(trans, dirty->root, |
| 224 | dirty->commit_root); |
| 225 | BUG_ON(ret); |
| 226 | |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 227 | ret = btrfs_del_root(trans, tree_root, &dirty->snap_key); |
| 228 | BUG_ON(ret); |
| 229 | ret = btrfs_end_transaction(trans, tree_root); |
| 230 | BUG_ON(ret); |
| 231 | kfree(dirty); |
| 232 | } |
| 233 | return 0; |
| 234 | } |
| 235 | |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 236 | int btrfs_commit_transaction(struct btrfs_trans_handle *trans, |
| 237 | struct btrfs_root *root) |
| 238 | { |
| 239 | int ret = 0; |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 240 | struct btrfs_transaction *cur_trans; |
Chris Mason | 8fd1779 | 2007-04-19 21:01:03 -0400 | [diff] [blame^] | 241 | struct btrfs_transaction *prev_trans = NULL; |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 242 | struct list_head dirty_fs_roots; |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 243 | DEFINE_WAIT(wait); |
| 244 | |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 245 | INIT_LIST_HEAD(&dirty_fs_roots); |
Chris Mason | d6e4a42 | 2007-04-06 15:37:36 -0400 | [diff] [blame] | 246 | |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 247 | mutex_lock(&root->fs_info->trans_mutex); |
| 248 | if (trans->transaction->in_commit) { |
| 249 | cur_trans = trans->transaction; |
| 250 | trans->transaction->use_count++; |
| 251 | btrfs_end_transaction(trans, root); |
| 252 | ret = wait_for_commit(root, cur_trans); |
| 253 | BUG_ON(ret); |
| 254 | put_transaction(cur_trans); |
| 255 | mutex_unlock(&root->fs_info->trans_mutex); |
| 256 | return 0; |
| 257 | } |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 258 | cur_trans = trans->transaction; |
| 259 | trans->transaction->in_commit = 1; |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 260 | while (trans->transaction->num_writers > 1) { |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 261 | WARN_ON(cur_trans != trans->transaction); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 262 | prepare_to_wait(&trans->transaction->writer_wait, &wait, |
| 263 | TASK_UNINTERRUPTIBLE); |
| 264 | if (trans->transaction->num_writers <= 1) |
| 265 | break; |
| 266 | mutex_unlock(&root->fs_info->trans_mutex); |
| 267 | schedule(); |
| 268 | mutex_lock(&root->fs_info->trans_mutex); |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 269 | finish_wait(&trans->transaction->writer_wait, &wait); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 270 | } |
| 271 | finish_wait(&trans->transaction->writer_wait, &wait); |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 272 | WARN_ON(cur_trans != trans->transaction); |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 273 | add_dirty_roots(trans, &root->fs_info->fs_roots_radix, &dirty_fs_roots); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 274 | ret = btrfs_commit_tree_roots(trans, root); |
| 275 | BUG_ON(ret); |
Chris Mason | 78fae27 | 2007-03-25 11:35:08 -0400 | [diff] [blame] | 276 | cur_trans = root->fs_info->running_transaction; |
| 277 | root->fs_info->running_transaction = NULL; |
Chris Mason | 8fd1779 | 2007-04-19 21:01:03 -0400 | [diff] [blame^] | 278 | if (cur_trans->list.prev != &root->fs_info->trans_list) { |
| 279 | prev_trans = list_entry(cur_trans->list.prev, |
| 280 | struct btrfs_transaction, list); |
| 281 | if (prev_trans->commit_done) |
| 282 | prev_trans = NULL; |
| 283 | else |
| 284 | prev_trans->use_count++; |
| 285 | } |
Chris Mason | 78fae27 | 2007-03-25 11:35:08 -0400 | [diff] [blame] | 286 | mutex_unlock(&root->fs_info->trans_mutex); |
Chris Mason | 8fd1779 | 2007-04-19 21:01:03 -0400 | [diff] [blame^] | 287 | mutex_unlock(&root->fs_info->fs_mutex); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 288 | ret = btrfs_write_and_wait_transaction(trans, root); |
Chris Mason | 8fd1779 | 2007-04-19 21:01:03 -0400 | [diff] [blame^] | 289 | if (prev_trans) { |
| 290 | mutex_lock(&root->fs_info->trans_mutex); |
| 291 | wait_for_commit(root, prev_trans); |
| 292 | put_transaction(prev_trans); |
| 293 | mutex_unlock(&root->fs_info->trans_mutex); |
| 294 | } |
| 295 | btrfs_set_super_generation(root->fs_info->disk_super, |
| 296 | cur_trans->transid); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 297 | BUG_ON(ret); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 298 | write_ctree_super(trans, root); |
Chris Mason | 8fd1779 | 2007-04-19 21:01:03 -0400 | [diff] [blame^] | 299 | |
| 300 | mutex_lock(&root->fs_info->fs_mutex); |
Chris Mason | 78fae27 | 2007-03-25 11:35:08 -0400 | [diff] [blame] | 301 | btrfs_finish_extent_commit(trans, root); |
| 302 | mutex_lock(&root->fs_info->trans_mutex); |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 303 | cur_trans->commit_done = 1; |
| 304 | wake_up(&cur_trans->commit_wait); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 305 | put_transaction(cur_trans); |
Chris Mason | 78fae27 | 2007-03-25 11:35:08 -0400 | [diff] [blame] | 306 | put_transaction(cur_trans); |
| 307 | mutex_unlock(&root->fs_info->trans_mutex); |
Chris Mason | 2c90e5d | 2007-04-02 10:50:19 -0400 | [diff] [blame] | 308 | kmem_cache_free(btrfs_trans_handle_cachep, trans); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 309 | |
Chris Mason | 0f7d52f | 2007-04-09 10:42:37 -0400 | [diff] [blame] | 310 | drop_dirty_roots(root->fs_info->tree_root, &dirty_fs_roots); |
Chris Mason | 79154b1 | 2007-03-22 15:59:16 -0400 | [diff] [blame] | 311 | return ret; |
| 312 | } |
| 313 | |