diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-09-11 15:53:12 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:07 -0400 |
commit | 49eb7e46d47ea72a9bd2a5f8cedb04f5159cc277 (patch) | |
tree | c3d05588c3cf73453673206214fadedc07bd79d7 /fs/btrfs/inode.c | |
parent | 98509cfc5a6857bddcfe4b19a9539726655ec9bd (diff) |
Btrfs: Dir fsync optimizations
Drop i_mutex during the commit
Don't bother doing the fsync at all unless the dir is marked as dirtied
and needing fsync in this transaction. For directories, this means
that someone has unlinked a file from the dir without fsyncing the
file.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 24b7e97fccb9..12c1c0530f3d 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1187,7 +1187,9 @@ int btrfs_unlink_inode(struct btrfs_trans_handle *trans, | |||
1187 | 1187 | ||
1188 | ret = btrfs_del_inode_ref_in_log(trans, root, name, name_len, | 1188 | ret = btrfs_del_inode_ref_in_log(trans, root, name, name_len, |
1189 | inode, dir->i_ino); | 1189 | inode, dir->i_ino); |
1190 | BUG_ON(ret); | 1190 | BUG_ON(ret != 0 && ret != -ENOENT); |
1191 | if (ret != -ENOENT) | ||
1192 | BTRFS_I(dir)->log_dirty_trans = trans->transid; | ||
1191 | 1193 | ||
1192 | ret = btrfs_del_dir_entries_in_log(trans, root, name, name_len, | 1194 | ret = btrfs_del_dir_entries_in_log(trans, root, name, name_len, |
1193 | dir, index); | 1195 | dir, index); |
@@ -1790,6 +1792,7 @@ static noinline void init_btrfs_i(struct inode *inode) | |||
1790 | bi->disk_i_size = 0; | 1792 | bi->disk_i_size = 0; |
1791 | bi->flags = 0; | 1793 | bi->flags = 0; |
1792 | bi->index_cnt = (u64)-1; | 1794 | bi->index_cnt = (u64)-1; |
1795 | bi->log_dirty_trans = 0; | ||
1793 | extent_map_tree_init(&BTRFS_I(inode)->extent_tree, GFP_NOFS); | 1796 | extent_map_tree_init(&BTRFS_I(inode)->extent_tree, GFP_NOFS); |
1794 | extent_io_tree_init(&BTRFS_I(inode)->io_tree, | 1797 | extent_io_tree_init(&BTRFS_I(inode)->io_tree, |
1795 | inode->i_mapping, GFP_NOFS); | 1798 | inode->i_mapping, GFP_NOFS); |