diff options
| author | Josef Bacik <[email protected]> | 2012-05-29 20:57:49 +0000 |
|---|---|---|
| committer | Josef Bacik <[email protected]> | 2012-05-30 14:23:42 +0000 |
| commit | 22ee6985de7d3e81ec0cef9c6ba01b45ad1bafeb (patch) | |
| tree | 96f9f1b4a4e0f0e77503fd63e6552a4a4b477e21 /fs/btrfs/file.c | |
| parent | Btrfs: return value of btrfs_read_buffer is checked correctly (diff) | |
| download | kernel-22ee6985de7d3e81ec0cef9c6ba01b45ad1bafeb.tar.gz kernel-22ee6985de7d3e81ec0cef9c6ba01b45ad1bafeb.zip | |
Btrfs: check to see if the inode is in the log before fsyncing
We have this check down in the actual logging code, but this is after we
start a transaction and all that good stuff. So move the helper
inode_in_log() out so we can call it in fsync() and avoid starting a
transaction altogether and just exit if we've already fsync()'ed this file
recently. You would notice this issue if you fsync()'ed a file over and
over again until the transaction committed. Thanks,
Signed-off-by: Josef Bacik <[email protected]>
Diffstat (limited to 'fs/btrfs/file.c')
| -rw-r--r-- | fs/btrfs/file.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 2e63cdc2b093..876cddd6b2f0 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1552,7 +1552,8 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) * syncing */ smp_mb(); - if (BTRFS_I(inode)->last_trans <= + if (btrfs_inode_in_log(inode, root->fs_info->generation) || + BTRFS_I(inode)->last_trans <= root->fs_info->last_trans_committed) { BTRFS_I(inode)->last_trans = 0; mutex_unlock(&inode->i_mutex); |
