aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-09-11 15:53:12 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:07 -0400
commit49eb7e46d47ea72a9bd2a5f8cedb04f5159cc277 (patch)
treec3d05588c3cf73453673206214fadedc07bd79d7 /fs/btrfs/tree-log.c
parent98509cfc5a6857bddcfe4b19a9539726655ec9bd (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/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 3f4b139b27ed..5d49a701bdcd 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1973,10 +1973,10 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
1973 atomic_set(&log->fs_info->tree_log_commit, 1); 1973 atomic_set(&log->fs_info->tree_log_commit, 1);
1974 1974
1975 while(1) { 1975 while(1) {
1976 batch = log->fs_info->tree_log_batch;
1976 mutex_unlock(&log->fs_info->tree_log_mutex); 1977 mutex_unlock(&log->fs_info->tree_log_mutex);
1977 schedule_timeout_uninterruptible(1); 1978 schedule_timeout_uninterruptible(1);
1978 mutex_lock(&log->fs_info->tree_log_mutex); 1979 mutex_lock(&log->fs_info->tree_log_mutex);
1979 batch = log->fs_info->tree_log_batch;
1980 1980
1981 while(atomic_read(&log->fs_info->tree_log_writers)) { 1981 while(atomic_read(&log->fs_info->tree_log_writers)) {
1982 DEFINE_WAIT(wait); 1982 DEFINE_WAIT(wait);
@@ -2189,8 +2189,6 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
2189 mutex_unlock(&BTRFS_I(inode)->log_mutex); 2189 mutex_unlock(&BTRFS_I(inode)->log_mutex);
2190 end_log_trans(root); 2190 end_log_trans(root);
2191 2191
2192 if (ret == 0 || ret == -ENOENT)
2193 return 0;
2194 return ret; 2192 return ret;
2195} 2193}
2196 2194
@@ -2620,9 +2618,11 @@ static int __btrfs_log_inode(struct btrfs_trans_handle *trans,
2620 else 2618 else
2621 break; 2619 break;
2622 } 2620 }
2623 if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) { 2621 if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode) &&
2622 BTRFS_I(inode)->log_dirty_trans >= trans->transid) {
2624 btrfs_release_path(root, path); 2623 btrfs_release_path(root, path);
2625 btrfs_release_path(log, dst_path); 2624 btrfs_release_path(log, dst_path);
2625 BTRFS_I(inode)->log_dirty_trans = 0;
2626 ret = log_directory_changes(trans, root, inode, path, dst_path); 2626 ret = log_directory_changes(trans, root, inode, path, dst_path);
2627 BUG_ON(ret); 2627 BUG_ON(ret);
2628 } 2628 }