aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota/dquot.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/quota/dquot.c')
-rw-r--r--fs/quota/dquot.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 10cbe841cb7e..36a29b753c79 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -78,7 +78,7 @@
78#include <linux/quotaops.h> 78#include <linux/quotaops.h>
79#include "../internal.h" /* ugh */ 79#include "../internal.h" /* ugh */
80 80
81#include <asm/uaccess.h> 81#include <linux/uaccess.h>
82 82
83/* 83/*
84 * There are three quota SMP locks. dq_list_lock protects all lists with quotas 84 * There are three quota SMP locks. dq_list_lock protects all lists with quotas
@@ -595,12 +595,14 @@ out:
595} 595}
596EXPORT_SYMBOL(dquot_scan_active); 596EXPORT_SYMBOL(dquot_scan_active);
597 597
598int dquot_quota_sync(struct super_block *sb, int type, int wait) 598/* Write all dquot structures to quota files */
599int dquot_writeback_dquots(struct super_block *sb, int type)
599{ 600{
600 struct list_head *dirty; 601 struct list_head *dirty;
601 struct dquot *dquot; 602 struct dquot *dquot;
602 struct quota_info *dqopt = sb_dqopt(sb); 603 struct quota_info *dqopt = sb_dqopt(sb);
603 int cnt; 604 int cnt;
605 int err, ret = 0;
604 606
605 mutex_lock(&dqopt->dqonoff_mutex); 607 mutex_lock(&dqopt->dqonoff_mutex);
606 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 608 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
@@ -624,7 +626,9 @@ int dquot_quota_sync(struct super_block *sb, int type, int wait)
624 atomic_inc(&dquot->dq_count); 626 atomic_inc(&dquot->dq_count);
625 spin_unlock(&dq_list_lock); 627 spin_unlock(&dq_list_lock);
626 dqstats_inc(DQST_LOOKUPS); 628 dqstats_inc(DQST_LOOKUPS);
627 sb->dq_op->write_dquot(dquot); 629 err = sb->dq_op->write_dquot(dquot);
630 if (!ret && err)
631 err = ret;
628 dqput(dquot); 632 dqput(dquot);
629 spin_lock(&dq_list_lock); 633 spin_lock(&dq_list_lock);
630 } 634 }
@@ -638,7 +642,21 @@ int dquot_quota_sync(struct super_block *sb, int type, int wait)
638 dqstats_inc(DQST_SYNCS); 642 dqstats_inc(DQST_SYNCS);
639 mutex_unlock(&dqopt->dqonoff_mutex); 643 mutex_unlock(&dqopt->dqonoff_mutex);
640 644
641 if (!wait || (dqopt->flags & DQUOT_QUOTA_SYS_FILE)) 645 return ret;
646}
647EXPORT_SYMBOL(dquot_writeback_dquots);
648
649/* Write all dquot structures to disk and make them visible from userspace */
650int dquot_quota_sync(struct super_block *sb, int type)
651{
652 struct quota_info *dqopt = sb_dqopt(sb);
653 int cnt;
654 int ret;
655
656 ret = dquot_writeback_dquots(sb, type);
657 if (ret)
658 return ret;
659 if (dqopt->flags & DQUOT_QUOTA_SYS_FILE)
642 return 0; 660 return 0;
643 661
644 /* This is not very clever (and fast) but currently I don't know about 662 /* This is not very clever (and fast) but currently I don't know about