aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota/quota.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-03-23 06:06:58 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-05-21 18:31:16 -0400
commit01a05b337a5b647909e1d6670f57e7202318a5fb (patch)
tree7877f08db14877d06346c8e1ef52aa17f2483e93 /fs/quota/quota.c
parent35cf7ba0b46dc3582a01c3860b14bff122662aa3 (diff)
new helper: iterate_supers()
... and switch the simple "loop over superblocks and do something" loops to it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/quota/quota.c')
-rw-r--r--fs/quota/quota.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 3ce1553ea7eb..ce3dfd066f59 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -18,7 +18,6 @@
18#include <linux/quotaops.h> 18#include <linux/quotaops.h>
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/writeback.h> 20#include <linux/writeback.h>
21#include "../internal.h"
22 21
23static int check_quotactl_permission(struct super_block *sb, int type, int cmd, 22static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
24 qid_t id) 23 qid_t id)
@@ -46,36 +45,22 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
46 return security_quotactl(cmd, type, id, sb); 45 return security_quotactl(cmd, type, id, sb);
47} 46}
48 47
48static void quota_sync_one(struct super_block *sb, void *arg)
49{
50 if (sb->s_qcop && sb->s_qcop->quota_sync)
51 sb->s_qcop->quota_sync(sb, *(int *)arg, 1);
52}
53
49static int quota_sync_all(int type) 54static int quota_sync_all(int type)
50{ 55{
51 struct super_block *sb, *n;
52 int ret; 56 int ret;
53 57
54 if (type >= MAXQUOTAS) 58 if (type >= MAXQUOTAS)
55 return -EINVAL; 59 return -EINVAL;
56 ret = security_quotactl(Q_SYNC, type, 0, NULL); 60 ret = security_quotactl(Q_SYNC, type, 0, NULL);
57 if (ret) 61 if (!ret)
58 return ret; 62 iterate_supers(quota_sync_one, &type);
59 63 return ret;
60 spin_lock(&sb_lock);
61 list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
62 if (list_empty(&sb->s_instances))
63 continue;
64 if (!sb->s_qcop || !sb->s_qcop->quota_sync)
65 continue;
66
67 sb->s_count++;
68 spin_unlock(&sb_lock);
69 down_read(&sb->s_umount);
70 if (sb->s_root)
71 sb->s_qcop->quota_sync(sb, type, 1);
72 up_read(&sb->s_umount);
73 spin_lock(&sb_lock);
74 __put_super(sb);
75 }
76 spin_unlock(&sb_lock);
77
78 return 0;
79} 64}
80 65
81static int quota_quotaon(struct super_block *sb, int type, int cmd, qid_t id, 66static int quota_quotaon(struct super_block *sb, int type, int cmd, qid_t id,