diff options
author | Liu Bo | 2012-08-29 09:07:55 +0200 |
---|---|---|
committer | Chris Mason | 2012-10-01 21:19:06 +0200 |
commit | 46d8bc34248f3a94dea910137d1ddf5fb1e3a1cc (patch) | |
tree | 2851b02c4aa073ea15737e1a41d53b3a8024c962 /fs/btrfs/tree-log.c | |
parent | Btrfs: fix wrong orphan count of the fs/file tree (diff) | |
download | kernel-qcow2-linux-46d8bc34248f3a94dea910137d1ddf5fb1e3a1cc.tar.gz kernel-qcow2-linux-46d8bc34248f3a94dea910137d1ddf5fb1e3a1cc.tar.xz kernel-qcow2-linux-46d8bc34248f3a94dea910137d1ddf5fb1e3a1cc.zip |
Btrfs: fix a bug in checking whether a inode is already in log
This is based on Josef's "Btrfs: turbo charge fsync".
The current btrfs checks if an inode is in log by comparing
root's last_log_commit to inode's last_sub_trans[2].
But the problem is that this root->last_log_commit is shared among
inodes.
Say we have N inodes to be logged, after the first inode,
root's last_log_commit is updated and the N-1 remained files will
be skipped.
This fixes the bug by keeping a local copy of root's last_log_commit
inside each inode and this local copy will be maintained itself.
[1]: we regard each log transaction as a subset of btrfs's transaction,
i.e. sub_trans
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r-- | fs/btrfs/tree-log.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 71e71539ffb7..fc0df95c2862 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -3185,6 +3185,7 @@ next_slot: } } BTRFS_I(inode)->logged_trans = trans->transid; + BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->last_sub_trans; out_unlock: mutex_unlock(&BTRFS_I(inode)->log_mutex); |