aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota/dquot.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-02-16 03:44:52 -0500
committerJan Kara <jack@suse.cz>2010-03-04 18:20:24 -0500
commit5fb324ad24febe57a8a2e62903dcb7bad546ea71 (patch)
treef49d1b8b7fe9feffbdd1afba18047001f5d7228f /fs/quota/dquot.c
parent8c4e4acd660a09e571a71583b5bbe1eee700c9ad (diff)
quota: move code from sync_quota_sb into vfs_quota_sync
Currenly sync_quota_sb does a lot of sync and truncate action that only applies to "VFS" style quotas and is actively harmful for the sync performance in XFS. Move it into vfs_quota_sync and add a wait parameter to ->quota_sync to tell if we need it or not. My audit of the GFS2 code says it's also not needed given the way GFS2 implements quotas, but I'd be happy if this can get a detailed review. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota/dquot.c')
-rw-r--r--fs/quota/dquot.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 6c849de5dc8f..4c2213f7ed36 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -570,7 +570,7 @@ out:
570} 570}
571EXPORT_SYMBOL(dquot_scan_active); 571EXPORT_SYMBOL(dquot_scan_active);
572 572
573int vfs_quota_sync(struct super_block *sb, int type) 573int vfs_quota_sync(struct super_block *sb, int type, int wait)
574{ 574{
575 struct list_head *dirty; 575 struct list_head *dirty;
576 struct dquot *dquot; 576 struct dquot *dquot;
@@ -615,6 +615,33 @@ int vfs_quota_sync(struct super_block *sb, int type)
615 spin_unlock(&dq_list_lock); 615 spin_unlock(&dq_list_lock);
616 mutex_unlock(&dqopt->dqonoff_mutex); 616 mutex_unlock(&dqopt->dqonoff_mutex);
617 617
618 if (!wait || (sb_dqopt(sb)->flags & DQUOT_QUOTA_SYS_FILE))
619 return 0;
620
621 /* This is not very clever (and fast) but currently I don't know about
622 * any other simple way of getting quota data to disk and we must get
623 * them there for userspace to be visible... */
624 if (sb->s_op->sync_fs)
625 sb->s_op->sync_fs(sb, 1);
626 sync_blockdev(sb->s_bdev);
627
628 /*
629 * Now when everything is written we can discard the pagecache so
630 * that userspace sees the changes.
631 */
632 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
633 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
634 if (type != -1 && cnt != type)
635 continue;
636 if (!sb_has_quota_active(sb, cnt))
637 continue;
638 mutex_lock_nested(&sb_dqopt(sb)->files[cnt]->i_mutex,
639 I_MUTEX_QUOTA);
640 truncate_inode_pages(&sb_dqopt(sb)->files[cnt]->i_data, 0);
641 mutex_unlock(&sb_dqopt(sb)->files[cnt]->i_mutex);
642 }
643 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
644
618 return 0; 645 return 0;
619} 646}
620EXPORT_SYMBOL(vfs_quota_sync); 647EXPORT_SYMBOL(vfs_quota_sync);