aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/quota.c9
-rw-r--r--fs/gfs2/quota.h2
-rw-r--r--fs/gfs2/super.c2
-rw-r--r--fs/gfs2/sys.c2
-rw-r--r--fs/quota/dquot.c29
-rw-r--r--fs/quota/quota.c46
-rw-r--r--fs/sync.c14
7 files changed, 50 insertions, 54 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index e3bf6eab8750..6dbcbad6ab17 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1083,7 +1083,7 @@ void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
1083 } 1083 }
1084} 1084}
1085 1085
1086int gfs2_quota_sync(struct super_block *sb, int type) 1086int gfs2_quota_sync(struct super_block *sb, int type, int wait)
1087{ 1087{
1088 struct gfs2_sbd *sdp = sb->s_fs_info; 1088 struct gfs2_sbd *sdp = sb->s_fs_info;
1089 struct gfs2_quota_data **qda; 1089 struct gfs2_quota_data **qda;
@@ -1127,6 +1127,11 @@ int gfs2_quota_sync(struct super_block *sb, int type)
1127 return error; 1127 return error;
1128} 1128}
1129 1129
1130static int gfs2_quota_sync_timeo(struct super_block *sb, int type)
1131{
1132 return gfs2_quota_sync(sb, type, 0);
1133}
1134
1130int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id) 1135int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id)
1131{ 1136{
1132 struct gfs2_quota_data *qd; 1137 struct gfs2_quota_data *qd;
@@ -1382,7 +1387,7 @@ int gfs2_quotad(void *data)
1382 &tune->gt_statfs_quantum); 1387 &tune->gt_statfs_quantum);
1383 1388
1384 /* Update quota file */ 1389 /* Update quota file */
1385 quotad_check_timeo(sdp, "sync", gfs2_quota_sync, t, 1390 quotad_check_timeo(sdp, "sync", gfs2_quota_sync_timeo, t,
1386 &quotad_timeo, &tune->gt_quota_quantum); 1391 &quotad_timeo, &tune->gt_quota_quantum);
1387 1392
1388 /* Check for & recover partially truncated inodes */ 1393 /* Check for & recover partially truncated inodes */
diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h
index e271fa07ad02..195f60c8bd14 100644
--- a/fs/gfs2/quota.h
+++ b/fs/gfs2/quota.h
@@ -25,7 +25,7 @@ extern int gfs2_quota_check(struct gfs2_inode *ip, u32 uid, u32 gid);
25extern void gfs2_quota_change(struct gfs2_inode *ip, s64 change, 25extern void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
26 u32 uid, u32 gid); 26 u32 uid, u32 gid);
27 27
28extern int gfs2_quota_sync(struct super_block *sb, int type); 28extern int gfs2_quota_sync(struct super_block *sb, int type, int wait);
29extern int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id); 29extern int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id);
30 30
31extern int gfs2_quota_init(struct gfs2_sbd *sdp); 31extern int gfs2_quota_init(struct gfs2_sbd *sdp);
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index b9dd3da22c0a..a8c2bcd0fcc8 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -764,7 +764,7 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
764 int error; 764 int error;
765 765
766 flush_workqueue(gfs2_delete_workqueue); 766 flush_workqueue(gfs2_delete_workqueue);
767 gfs2_quota_sync(sdp->sd_vfs, 0); 767 gfs2_quota_sync(sdp->sd_vfs, 0, 1);
768 gfs2_statfs_sync(sdp->sd_vfs, 0); 768 gfs2_statfs_sync(sdp->sd_vfs, 0);
769 769
770 error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, GL_NOCACHE, 770 error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, GL_NOCACHE,
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 0dc34621f6a6..4496cc37a0fa 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -167,7 +167,7 @@ static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf,
167 if (simple_strtol(buf, NULL, 0) != 1) 167 if (simple_strtol(buf, NULL, 0) != 1)
168 return -EINVAL; 168 return -EINVAL;
169 169
170 gfs2_quota_sync(sdp->sd_vfs, 0); 170 gfs2_quota_sync(sdp->sd_vfs, 0, 1);
171 return len; 171 return len;
172} 172}
173 173
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);
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 3d31228082ea..0593b229656c 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -48,44 +48,6 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
48 return security_quotactl(cmd, type, id, sb); 48 return security_quotactl(cmd, type, id, sb);
49} 49}
50 50
51#ifdef CONFIG_QUOTA
52void sync_quota_sb(struct super_block *sb, int type)
53{
54 int cnt;
55
56 if (!sb->s_qcop || !sb->s_qcop->quota_sync)
57 return;
58
59 sb->s_qcop->quota_sync(sb, type);
60
61 if (sb_dqopt(sb)->flags & DQUOT_QUOTA_SYS_FILE)
62 return;
63 /* This is not very clever (and fast) but currently I don't know about
64 * any other simple way of getting quota data to disk and we must get
65 * them there for userspace to be visible... */
66 if (sb->s_op->sync_fs)
67 sb->s_op->sync_fs(sb, 1);
68 sync_blockdev(sb->s_bdev);
69
70 /*
71 * Now when everything is written we can discard the pagecache so
72 * that userspace sees the changes.
73 */
74 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
75 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
76 if (type != -1 && cnt != type)
77 continue;
78 if (!sb_has_quota_active(sb, cnt))
79 continue;
80 mutex_lock_nested(&sb_dqopt(sb)->files[cnt]->i_mutex,
81 I_MUTEX_QUOTA);
82 truncate_inode_pages(&sb_dqopt(sb)->files[cnt]->i_data, 0);
83 mutex_unlock(&sb_dqopt(sb)->files[cnt]->i_mutex);
84 }
85 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
86}
87#endif
88
89static int quota_sync_all(int type) 51static int quota_sync_all(int type)
90{ 52{
91 struct super_block *sb; 53 struct super_block *sb;
@@ -101,6 +63,9 @@ static int quota_sync_all(int type)
101 spin_lock(&sb_lock); 63 spin_lock(&sb_lock);
102restart: 64restart:
103 list_for_each_entry(sb, &super_blocks, s_list) { 65 list_for_each_entry(sb, &super_blocks, s_list) {
66 if (!sb->s_qcop || !sb->s_qcop->quota_sync)
67 continue;
68
104 /* This test just improves performance so it needn't be 69 /* This test just improves performance so it needn't be
105 * reliable... */ 70 * reliable... */
106 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 71 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
@@ -119,7 +84,7 @@ restart:
119 spin_unlock(&sb_lock); 84 spin_unlock(&sb_lock);
120 down_read(&sb->s_umount); 85 down_read(&sb->s_umount);
121 if (sb->s_root) 86 if (sb->s_root)
122 sync_quota_sb(sb, type); 87 sb->s_qcop->quota_sync(sb, type, 1);
123 up_read(&sb->s_umount); 88 up_read(&sb->s_umount);
124 spin_lock(&sb_lock); 89 spin_lock(&sb_lock);
125 if (__put_super_and_need_restart(sb)) 90 if (__put_super_and_need_restart(sb))
@@ -306,8 +271,7 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
306 case Q_SYNC: 271 case Q_SYNC:
307 if (!sb->s_qcop->quota_sync) 272 if (!sb->s_qcop->quota_sync)
308 return -ENOSYS; 273 return -ENOSYS;
309 sync_quota_sb(sb, type); 274 return sb->s_qcop->quota_sync(sb, type, 1);
310 return 0;
311 case Q_XQUOTAON: 275 case Q_XQUOTAON:
312 case Q_XQUOTAOFF: 276 case Q_XQUOTAOFF:
313 case Q_XQUOTARM: 277 case Q_XQUOTARM:
diff --git a/fs/sync.c b/fs/sync.c
index 418727a2a239..f557d71cb097 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -34,14 +34,14 @@ static int __sync_filesystem(struct super_block *sb, int wait)
34 if (!sb->s_bdi) 34 if (!sb->s_bdi)
35 return 0; 35 return 0;
36 36
37 /* Avoid doing twice syncing and cache pruning for quota sync */ 37 if (sb->s_qcop && sb->s_qcop->quota_sync)
38 if (!wait) { 38 sb->s_qcop->quota_sync(sb, -1, wait);
39 writeout_quota_sb(sb, -1); 39
40 writeback_inodes_sb(sb); 40 if (wait)
41 } else {
42 sync_quota_sb(sb, -1);
43 sync_inodes_sb(sb); 41 sync_inodes_sb(sb);
44 } 42 else
43 writeback_inodes_sb(sb);
44
45 if (sb->s_op->sync_fs) 45 if (sb->s_op->sync_fs)
46 sb->s_op->sync_fs(sb, wait); 46 sb->s_op->sync_fs(sb, wait);
47 return __sync_blockdev(sb->s_bdev, wait); 47 return __sync_blockdev(sb->s_bdev, wait);