aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/dir-item.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-09-05 16:13:11 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:07 -0400
commite02119d5a7b4396c5a872582fddc8bd6d305a70a (patch)
tree825efe2a79dbca8d61256183f3526a5b5dc40dc6 /fs/btrfs/dir-item.c
parenta1b32a5932cfac7c38b442582285f3da2a09dfd8 (diff)
Btrfs: Add a write ahead tree log to optimize synchronous operations
File syncs and directory syncs are optimized by copying their items into a special (copy-on-write) log tree. There is one log tree per subvolume and the btrfs super block points to a tree of log tree roots. After a crash, items are copied out of the log tree and back into the subvolume. See tree-log.c for all the details. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/dir-item.c')
-rw-r--r--fs/btrfs/dir-item.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index 125094617fe8..e4f30090d640 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -96,6 +96,7 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
96 btrfs_set_dir_item_key(leaf, dir_item, &disk_key); 96 btrfs_set_dir_item_key(leaf, dir_item, &disk_key);
97 btrfs_set_dir_type(leaf, dir_item, BTRFS_FT_XATTR); 97 btrfs_set_dir_type(leaf, dir_item, BTRFS_FT_XATTR);
98 btrfs_set_dir_name_len(leaf, dir_item, name_len); 98 btrfs_set_dir_name_len(leaf, dir_item, name_len);
99 btrfs_set_dir_transid(leaf, dir_item, trans->transid);
99 btrfs_set_dir_data_len(leaf, dir_item, data_len); 100 btrfs_set_dir_data_len(leaf, dir_item, data_len);
100 name_ptr = (unsigned long)(dir_item + 1); 101 name_ptr = (unsigned long)(dir_item + 1);
101 data_ptr = (unsigned long)((char *)name_ptr + name_len); 102 data_ptr = (unsigned long)((char *)name_ptr + name_len);
@@ -142,6 +143,7 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
142 btrfs_set_dir_type(leaf, dir_item, type); 143 btrfs_set_dir_type(leaf, dir_item, type);
143 btrfs_set_dir_data_len(leaf, dir_item, 0); 144 btrfs_set_dir_data_len(leaf, dir_item, 0);
144 btrfs_set_dir_name_len(leaf, dir_item, name_len); 145 btrfs_set_dir_name_len(leaf, dir_item, name_len);
146 btrfs_set_dir_transid(leaf, dir_item, trans->transid);
145 name_ptr = (unsigned long)(dir_item + 1); 147 name_ptr = (unsigned long)(dir_item + 1);
146 148
147 write_extent_buffer(leaf, name, name_ptr, name_len); 149 write_extent_buffer(leaf, name, name_ptr, name_len);
@@ -169,6 +171,7 @@ second_insert:
169 btrfs_set_dir_type(leaf, dir_item, type); 171 btrfs_set_dir_type(leaf, dir_item, type);
170 btrfs_set_dir_data_len(leaf, dir_item, 0); 172 btrfs_set_dir_data_len(leaf, dir_item, 0);
171 btrfs_set_dir_name_len(leaf, dir_item, name_len); 173 btrfs_set_dir_name_len(leaf, dir_item, name_len);
174 btrfs_set_dir_transid(leaf, dir_item, trans->transid);
172 name_ptr = (unsigned long)(dir_item + 1); 175 name_ptr = (unsigned long)(dir_item + 1);
173 write_extent_buffer(leaf, name, name_ptr, name_len); 176 write_extent_buffer(leaf, name, name_ptr, name_len);
174 btrfs_mark_buffer_dirty(leaf); 177 btrfs_mark_buffer_dirty(leaf);