aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2011-05-21 09:27:38 -0400
committerChris Mason <chris.mason@oracle.com>2011-05-21 09:27:38 -0400
commit0965537308ac3b267ea16e731bd73870a51c53b8 (patch)
tree7b52288b7272b2391f736dd82a313cbbaad68570 /fs/btrfs/transaction.c
parent61c4f2c81c61f73549928dfd9f3e8f26aa36a8cf (diff)
parent82d5902d9c681be37ffa9d70482907f9f0b7ec1f (diff)
Merge branch 'ino-alloc' of git://repo.or.cz/linux-btrfs-devel into inode_numbers
Conflicts: fs/btrfs/free-space-cache.c Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index c571734d5e5a..4d1dbcbbaf41 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -27,6 +27,7 @@
27#include "transaction.h" 27#include "transaction.h"
28#include "locking.h" 28#include "locking.h"
29#include "tree-log.h" 29#include "tree-log.h"
30#include "inode-map.h"
30 31
31#define BTRFS_ROOT_TRANS_TAG 0 32#define BTRFS_ROOT_TRANS_TAG 0
32 33
@@ -760,8 +761,14 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans,
760 btrfs_update_reloc_root(trans, root); 761 btrfs_update_reloc_root(trans, root);
761 btrfs_orphan_commit_root(trans, root); 762 btrfs_orphan_commit_root(trans, root);
762 763
764 btrfs_save_ino_cache(root, trans);
765
763 if (root->commit_root != root->node) { 766 if (root->commit_root != root->node) {
767 mutex_lock(&root->fs_commit_mutex);
764 switch_commit_root(root); 768 switch_commit_root(root);
769 btrfs_unpin_free_ino(root);
770 mutex_unlock(&root->fs_commit_mutex);
771
765 btrfs_set_root_node(&root->root_item, 772 btrfs_set_root_node(&root->root_item,
766 root->node); 773 root->node);
767 } 774 }
@@ -930,7 +937,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
930 goto fail; 937 goto fail;
931 } 938 }
932 939
933 ret = btrfs_find_free_objectid(trans, tree_root, 0, &objectid); 940 ret = btrfs_find_free_objectid(tree_root, &objectid);
934 if (ret) { 941 if (ret) {
935 pending->error = ret; 942 pending->error = ret;
936 goto fail; 943 goto fail;
@@ -967,7 +974,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
967 BUG_ON(ret); 974 BUG_ON(ret);
968 ret = btrfs_insert_dir_item(trans, parent_root, 975 ret = btrfs_insert_dir_item(trans, parent_root,
969 dentry->d_name.name, dentry->d_name.len, 976 dentry->d_name.name, dentry->d_name.len,
970 parent_inode->i_ino, &key, 977 btrfs_ino(parent_inode), &key,
971 BTRFS_FT_DIR, index); 978 BTRFS_FT_DIR, index);
972 BUG_ON(ret); 979 BUG_ON(ret);
973 980
@@ -1009,7 +1016,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1009 */ 1016 */
1010 ret = btrfs_add_root_ref(trans, tree_root, objectid, 1017 ret = btrfs_add_root_ref(trans, tree_root, objectid,
1011 parent_root->root_key.objectid, 1018 parent_root->root_key.objectid,
1012 parent_inode->i_ino, index, 1019 btrfs_ino(parent_inode), index,
1013 dentry->d_name.name, dentry->d_name.len); 1020 dentry->d_name.name, dentry->d_name.len);
1014 BUG_ON(ret); 1021 BUG_ON(ret);
1015 dput(parent); 1022 dput(parent);