diff options
author | Chris Mason <chris.mason@oracle.com> | 2011-05-22 07:07:01 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-05-22 07:07:01 -0400 |
commit | dcc6d073225b6b732a52477c91bd4edc9b4d5502 (patch) | |
tree | 71da6844bb03c940c87c01a2a1f8c2e11cf85238 /fs/btrfs/transaction.c | |
parent | 0965537308ac3b267ea16e731bd73870a51c53b8 (diff) | |
parent | 16cdcec736cd214350cdb591bf1091f8beedefa0 (diff) |
Merge branch 'delayed_inode' into inode_numbers
Conflicts:
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/transaction.c
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 4d1dbcbbaf41..8e7e72341555 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -488,19 +488,40 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
488 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, | 488 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, |
489 | struct btrfs_root *root) | 489 | struct btrfs_root *root) |
490 | { | 490 | { |
491 | return __btrfs_end_transaction(trans, root, 0, 1); | 491 | int ret; |
492 | |||
493 | ret = __btrfs_end_transaction(trans, root, 0, 1); | ||
494 | if (ret) | ||
495 | return ret; | ||
496 | return 0; | ||
492 | } | 497 | } |
493 | 498 | ||
494 | int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans, | 499 | int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans, |
495 | struct btrfs_root *root) | 500 | struct btrfs_root *root) |
496 | { | 501 | { |
497 | return __btrfs_end_transaction(trans, root, 1, 1); | 502 | int ret; |
503 | |||
504 | ret = __btrfs_end_transaction(trans, root, 1, 1); | ||
505 | if (ret) | ||
506 | return ret; | ||
507 | return 0; | ||
498 | } | 508 | } |
499 | 509 | ||
500 | int btrfs_end_transaction_nolock(struct btrfs_trans_handle *trans, | 510 | int btrfs_end_transaction_nolock(struct btrfs_trans_handle *trans, |
501 | struct btrfs_root *root) | 511 | struct btrfs_root *root) |
502 | { | 512 | { |
503 | return __btrfs_end_transaction(trans, root, 0, 0); | 513 | int ret; |
514 | |||
515 | ret = __btrfs_end_transaction(trans, root, 0, 0); | ||
516 | if (ret) | ||
517 | return ret; | ||
518 | return 0; | ||
519 | } | ||
520 | |||
521 | int btrfs_end_transaction_dmeta(struct btrfs_trans_handle *trans, | ||
522 | struct btrfs_root *root) | ||
523 | { | ||
524 | return __btrfs_end_transaction(trans, root, 1, 1); | ||
504 | } | 525 | } |
505 | 526 | ||
506 | /* | 527 | /* |
@@ -974,7 +995,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
974 | BUG_ON(ret); | 995 | BUG_ON(ret); |
975 | ret = btrfs_insert_dir_item(trans, parent_root, | 996 | ret = btrfs_insert_dir_item(trans, parent_root, |
976 | dentry->d_name.name, dentry->d_name.len, | 997 | dentry->d_name.name, dentry->d_name.len, |
977 | btrfs_ino(parent_inode), &key, | 998 | parent_inode, &key, |
978 | BTRFS_FT_DIR, index); | 999 | BTRFS_FT_DIR, index); |
979 | BUG_ON(ret); | 1000 | BUG_ON(ret); |
980 | 1001 | ||
@@ -1044,6 +1065,14 @@ static noinline int create_pending_snapshots(struct btrfs_trans_handle *trans, | |||
1044 | int ret; | 1065 | int ret; |
1045 | 1066 | ||
1046 | list_for_each_entry(pending, head, list) { | 1067 | list_for_each_entry(pending, head, list) { |
1068 | /* | ||
1069 | * We must deal with the delayed items before creating | ||
1070 | * snapshots, or we will create a snapthot with inconsistent | ||
1071 | * information. | ||
1072 | */ | ||
1073 | ret = btrfs_run_delayed_items(trans, fs_info->fs_root); | ||
1074 | BUG_ON(ret); | ||
1075 | |||
1047 | ret = create_pending_snapshot(trans, fs_info, pending); | 1076 | ret = create_pending_snapshot(trans, fs_info, pending); |
1048 | BUG_ON(ret); | 1077 | BUG_ON(ret); |
1049 | } | 1078 | } |
@@ -1297,6 +1326,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1297 | BUG_ON(ret); | 1326 | BUG_ON(ret); |
1298 | } | 1327 | } |
1299 | 1328 | ||
1329 | ret = btrfs_run_delayed_items(trans, root); | ||
1330 | BUG_ON(ret); | ||
1331 | |||
1300 | /* | 1332 | /* |
1301 | * rename don't use btrfs_join_transaction, so, once we | 1333 | * rename don't use btrfs_join_transaction, so, once we |
1302 | * set the transaction to blocked above, we aren't going | 1334 | * set the transaction to blocked above, we aren't going |
@@ -1323,6 +1355,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1323 | ret = create_pending_snapshots(trans, root->fs_info); | 1355 | ret = create_pending_snapshots(trans, root->fs_info); |
1324 | BUG_ON(ret); | 1356 | BUG_ON(ret); |
1325 | 1357 | ||
1358 | ret = btrfs_run_delayed_items(trans, root); | ||
1359 | BUG_ON(ret); | ||
1360 | |||
1326 | ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1); | 1361 | ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1); |
1327 | BUG_ON(ret); | 1362 | BUG_ON(ret); |
1328 | 1363 | ||
@@ -1439,6 +1474,8 @@ int btrfs_clean_old_snapshots(struct btrfs_root *root) | |||
1439 | root = list_entry(list.next, struct btrfs_root, root_list); | 1474 | root = list_entry(list.next, struct btrfs_root, root_list); |
1440 | list_del(&root->root_list); | 1475 | list_del(&root->root_list); |
1441 | 1476 | ||
1477 | btrfs_kill_all_delayed_nodes(root); | ||
1478 | |||
1442 | if (btrfs_header_backref_rev(root->node) < | 1479 | if (btrfs_header_backref_rev(root->node) < |
1443 | BTRFS_MIXED_BACKREF_REV) | 1480 | BTRFS_MIXED_BACKREF_REV) |
1444 | btrfs_drop_snapshot(root, NULL, 0); | 1481 | btrfs_drop_snapshot(root, NULL, 0); |