diff options
author | Andreas Rohner <andreas.rohner@gmx.net> | 2014-10-13 18:53:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-13 20:18:20 -0400 |
commit | e2c7617ae36b27f97643bfa08aabe27e630c1a76 (patch) | |
tree | 306dc0642ffbd8c4f837b7fbae960a49116053e6 /fs/nilfs2/super.c | |
parent | 0f2a84f41aff6cefd1bc768738159d0cacea2f2d (diff) |
nilfs2: add missing blkdev_issue_flush() to nilfs_sync_fs()
Under normal circumstances nilfs_sync_fs() writes out the super block,
which causes a flush of the underlying block device. But this depends
on the THE_NILFS_SB_DIRTY flag, which is only set if the pointer to the
last segment crosses a segment boundary. So if only a small amount of
data is written before the call to nilfs_sync_fs(), no flush of the
block device occurs.
In the above case an additional call to blkdev_issue_flush() is needed.
To prevent unnecessary overhead, the new flag nilfs->ns_flushed_device
is introduced, which is cleared whenever new logs are written and set
whenever the block device is flushed. For convenience the function
nilfs_flush_device() is added, which contains the above logic.
Signed-off-by: Andreas Rohner <andreas.rohner@gmx.net>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nilfs2/super.c')
-rw-r--r-- | fs/nilfs2/super.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 228f5bdf0772..2e5b3ec85b8f 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -310,6 +310,9 @@ int nilfs_commit_super(struct super_block *sb, int flag) | |||
310 | nilfs->ns_sbsize)); | 310 | nilfs->ns_sbsize)); |
311 | } | 311 | } |
312 | clear_nilfs_sb_dirty(nilfs); | 312 | clear_nilfs_sb_dirty(nilfs); |
313 | nilfs->ns_flushed_device = 1; | ||
314 | /* make sure store to ns_flushed_device cannot be reordered */ | ||
315 | smp_wmb(); | ||
313 | return nilfs_sync_super(sb, flag); | 316 | return nilfs_sync_super(sb, flag); |
314 | } | 317 | } |
315 | 318 | ||
@@ -514,6 +517,9 @@ static int nilfs_sync_fs(struct super_block *sb, int wait) | |||
514 | } | 517 | } |
515 | up_write(&nilfs->ns_sem); | 518 | up_write(&nilfs->ns_sem); |
516 | 519 | ||
520 | if (!err) | ||
521 | err = nilfs_flush_device(nilfs); | ||
522 | |||
517 | return err; | 523 | return err; |
518 | } | 524 | } |
519 | 525 | ||