diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-09-11 15:51:21 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:07 -0400 |
commit | 8d5bf1cb35ea29795862ff0ea2f4c4d7e22727f3 (patch) | |
tree | 1c9af9227dfb34a47230ebefbb0eed4f3125bcfe /fs | |
parent | 4bef084857ab8fe71cf49eae349c25e440a49150 (diff) |
Btrfs: Update the highest objectid in a root after log replay is done
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode.c | 3 | ||||
-rw-r--r-- | fs/btrfs/tree-log.c | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b4dbb5c97646..073fdd77c784 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -2239,8 +2239,9 @@ static int btrfs_set_inode_index(struct inode *dir, struct inode *inode, | |||
2239 | 2239 | ||
2240 | if (BTRFS_I(dir)->index_cnt == (u64)-1) { | 2240 | if (BTRFS_I(dir)->index_cnt == (u64)-1) { |
2241 | ret = btrfs_set_inode_index_count(dir); | 2241 | ret = btrfs_set_inode_index_count(dir); |
2242 | if (ret) | 2242 | if (ret) { |
2243 | return ret; | 2243 | return ret; |
2244 | } | ||
2244 | } | 2245 | } |
2245 | 2246 | ||
2246 | *index = BTRFS_I(dir)->index_cnt; | 2247 | *index = BTRFS_I(dir)->index_cnt; |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 13d7ee8e0c52..3f4b139b27ed 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -1027,6 +1027,7 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans, | |||
1027 | inode->i_nlink = nlink; | 1027 | inode->i_nlink = nlink; |
1028 | btrfs_update_inode(trans, root, inode); | 1028 | btrfs_update_inode(trans, root, inode); |
1029 | } | 1029 | } |
1030 | BTRFS_I(inode)->index_cnt = (u64)-1; | ||
1030 | 1031 | ||
1031 | return 0; | 1032 | return 0; |
1032 | } | 1033 | } |
@@ -2714,6 +2715,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) | |||
2714 | struct btrfs_key tmp_key; | 2715 | struct btrfs_key tmp_key; |
2715 | struct btrfs_root *log; | 2716 | struct btrfs_root *log; |
2716 | struct btrfs_fs_info *fs_info = log_root_tree->fs_info; | 2717 | struct btrfs_fs_info *fs_info = log_root_tree->fs_info; |
2718 | u64 highest_inode; | ||
2717 | struct walk_control wc = { | 2719 | struct walk_control wc = { |
2718 | .process_func = process_one_buffer, | 2720 | .process_func = process_one_buffer, |
2719 | .stage = 0, | 2721 | .stage = 0, |
@@ -2772,6 +2774,11 @@ again: | |||
2772 | path); | 2774 | path); |
2773 | BUG_ON(ret); | 2775 | BUG_ON(ret); |
2774 | } | 2776 | } |
2777 | ret = btrfs_find_highest_inode(wc.replay_dest, &highest_inode); | ||
2778 | if (ret == 0) { | ||
2779 | wc.replay_dest->highest_inode = highest_inode; | ||
2780 | wc.replay_dest->last_inode_alloc = highest_inode; | ||
2781 | } | ||
2775 | 2782 | ||
2776 | key.offset = found_key.offset - 1; | 2783 | key.offset = found_key.offset - 1; |
2777 | free_extent_buffer(log->node); | 2784 | free_extent_buffer(log->node); |