diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 0f2653182405..d5d8b3899258 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -196,8 +196,6 @@ struct btrfs_root { /* Used only for log trees of subvolumes, not for the log root tree */ atomic_t log_writers; atomic_t log_commit[2]; - /* Used only for log trees of subvolumes, not for the log root tree */ - atomic_t log_batch; /* * Protected by the 'log_mutex' lock but can be read without holding * that lock to avoid unnecessary lock contention, in which case it diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 0357c84d6c25..a62748fc2881 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -669,7 +669,6 @@ static struct btrfs_root *btrfs_alloc_root(struct btrfs_fs_info *fs_info, atomic_set(&root->log_commit[0], 0); atomic_set(&root->log_commit[1], 0); atomic_set(&root->log_writers, 0); - atomic_set(&root->log_batch, 0); refcount_set(&root->refs, 1); atomic_set(&root->snapshot_force_cow, 0); atomic_set(&root->nr_swapfiles, 0); diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 818c53c445f8..20e15dc30bfb 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1573,8 +1573,6 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) else btrfs_inode_lock(inode, BTRFS_ILOCK_MMAP); - atomic_inc(&root->log_batch); - /* * Before we acquired the inode's lock and the mmap lock, someone may * have dirtied more pages in the target range. We need to make sure @@ -1657,8 +1655,6 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) if (ret) goto out_release_extents; - atomic_inc(&root->log_batch); - if (skip_inode_logging(&ctx)) { /* * We've had everything committed since the last time we were diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index ccc262833a7c..580f2aabc065 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -3336,13 +3336,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, if (atomic_read(&root->log_commit[(index1 + 1) % 2])) wait_log_commit(root, log_transid - 1); - while (1) { - int batch = atomic_read(&root->log_batch); - - wait_for_writer(root); - if (batch == atomic_read(&root->log_batch)) - break; - } + wait_for_writer(root); /* bail out if we need to do a full commit */ if (btrfs_need_log_full_commit(trans)) {