aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-07-03 10:45:29 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-22 15:58:34 -0400
commita1177825719ccef3f76ef39bbfd5ebb6087d53c7 (patch)
treeeb7a1137ea6438be224052f17c104cd040a10366 /fs
parentceed17236a7491b44ee2be21f56a41ab997cbe7d (diff)
quota: Move quota syncing to ->sync_fs method
Since the moment writes to quota files are using block device page cache and space for quota structures is reserved at the moment they are first accessed we have no reason to sync quota before inode writeback. In fact this order is now only harmful since quota information can easily change during inode writeback (either because conversion of delayed-allocated extents or simply because of allocation of new blocks for simple filesystems not using page_mkwrite). So move syncing of quota information after writeback of inodes into ->sync_fs method. This way we do not have to use ->quota_sync callback which is primarily intended for use by quotactl syscall anyway and we get rid of calling ->sync_fs() twice unnecessarily. We skip quota syncing for OCFS2 since it does proper quota journalling in all cases (unlike ext3, ext4, and reiserfs which also support legacy non-journalled quotas) and thus there are no dirty quota structures. CC: "Theodore Ts'o" <tytso@mit.edu> CC: Joel Becker <jlbec@evilplan.org> CC: reiserfs-devel@vger.kernel.org Acked-by: Steven Whitehouse <swhiteho@redhat.com> Acked-by: Dave Kleikamp <shaggy@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext2/super.c6
-rw-r--r--fs/ext3/super.c5
-rw-r--r--fs/ext4/super.c5
-rw-r--r--fs/gfs2/super.c2
-rw-r--r--fs/jfs/super.c5
-rw-r--r--fs/reiserfs/super.c5
-rw-r--r--fs/sync.c3
7 files changed, 28 insertions, 3 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index b3621cb7ea31..5df3d2d8169c 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1184,6 +1184,12 @@ static int ext2_sync_fs(struct super_block *sb, int wait)
1184 struct ext2_sb_info *sbi = EXT2_SB(sb); 1184 struct ext2_sb_info *sbi = EXT2_SB(sb);
1185 struct ext2_super_block *es = EXT2_SB(sb)->s_es; 1185 struct ext2_super_block *es = EXT2_SB(sb)->s_es;
1186 1186
1187 /*
1188 * Write quota structures to quota file, sync_blockdev() will write
1189 * them to disk later
1190 */
1191 dquot_writeback_dquots(sb, -1);
1192
1187 spin_lock(&sbi->s_lock); 1193 spin_lock(&sbi->s_lock);
1188 if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) { 1194 if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) {
1189 ext2_debug("setting valid to 0\n"); 1195 ext2_debug("setting valid to 0\n");
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 8c3a44b7c375..4ac304c55c53 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2526,6 +2526,11 @@ static int ext3_sync_fs(struct super_block *sb, int wait)
2526 tid_t target; 2526 tid_t target;
2527 2527
2528 trace_ext3_sync_fs(sb, wait); 2528 trace_ext3_sync_fs(sb, wait);
2529 /*
2530 * Writeback quota in non-journalled quota case - journalled quota has
2531 * no dirty dquots
2532 */
2533 dquot_writeback_dquots(sb, -1);
2529 if (journal_start_commit(EXT3_SB(sb)->s_journal, &target)) { 2534 if (journal_start_commit(EXT3_SB(sb)->s_journal, &target)) {
2530 if (wait) 2535 if (wait)
2531 log_wait_commit(EXT3_SB(sb)->s_journal, target); 2536 log_wait_commit(EXT3_SB(sb)->s_journal, target);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index eb7aa3e4ef05..d8759401ecae 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4325,6 +4325,11 @@ static int ext4_sync_fs(struct super_block *sb, int wait)
4325 4325
4326 trace_ext4_sync_fs(sb, wait); 4326 trace_ext4_sync_fs(sb, wait);
4327 flush_workqueue(sbi->dio_unwritten_wq); 4327 flush_workqueue(sbi->dio_unwritten_wq);
4328 /*
4329 * Writeback quota in non-journalled quota case - journalled quota has
4330 * no dirty dquots
4331 */
4332 dquot_writeback_dquots(sb, -1);
4328 if (jbd2_journal_start_commit(sbi->s_journal, &target)) { 4333 if (jbd2_journal_start_commit(sbi->s_journal, &target)) {
4329 if (wait) 4334 if (wait)
4330 jbd2_log_wait_commit(sbi->s_journal, target); 4335 jbd2_log_wait_commit(sbi->s_journal, target);
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 313c329490e2..f3d6bbfb32c5 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -952,6 +952,8 @@ restart:
952static int gfs2_sync_fs(struct super_block *sb, int wait) 952static int gfs2_sync_fs(struct super_block *sb, int wait)
953{ 953{
954 struct gfs2_sbd *sdp = sb->s_fs_info; 954 struct gfs2_sbd *sdp = sb->s_fs_info;
955
956 gfs2_quota_sync(sb, -1);
955 if (wait && sdp) 957 if (wait && sdp)
956 gfs2_log_flush(sdp, NULL); 958 gfs2_log_flush(sdp, NULL);
957 return 0; 959 return 0;
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 4a82950f412f..c55c7452d285 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -601,6 +601,11 @@ static int jfs_sync_fs(struct super_block *sb, int wait)
601 601
602 /* log == NULL indicates read-only mount */ 602 /* log == NULL indicates read-only mount */
603 if (log) { 603 if (log) {
604 /*
605 * Write quota structures to quota file, sync_blockdev() will
606 * write them to disk later
607 */
608 dquot_writeback_dquots(sb, -1);
604 jfs_flush_journal(log, wait); 609 jfs_flush_journal(log, wait);
605 jfs_syncpt(log, 0); 610 jfs_syncpt(log, 0);
606 } 611 }
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 651ce767b55d..7a37dabf5a96 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -68,6 +68,11 @@ static int reiserfs_sync_fs(struct super_block *s, int wait)
68{ 68{
69 struct reiserfs_transaction_handle th; 69 struct reiserfs_transaction_handle th;
70 70
71 /*
72 * Writeback quota in non-journalled quota case - journalled quota has
73 * no dirty dquots
74 */
75 dquot_writeback_dquots(s, -1);
71 reiserfs_write_lock(s); 76 reiserfs_write_lock(s);
72 if (!journal_begin(&th, s, 1)) 77 if (!journal_begin(&th, s, 1))
73 if (!journal_end_sync(&th, s, 1)) 78 if (!journal_end_sync(&th, s, 1))
diff --git a/fs/sync.c b/fs/sync.c
index cae145dd8018..66acd2ba91c4 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -29,9 +29,6 @@
29 */ 29 */
30static int __sync_filesystem(struct super_block *sb, int wait) 30static int __sync_filesystem(struct super_block *sb, int wait)
31{ 31{
32 if (sb->s_qcop && sb->s_qcop->quota_sync)
33 sb->s_qcop->quota_sync(sb, -1);
34
35 if (wait) 32 if (wait)
36 sync_inodes_sb(sb); 33 sync_inodes_sb(sb);
37 else 34 else