
From: Jan Kara <jack@suse.cz>

Allow disabling of quota messages to console (they can disturb other
output).

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/dquot.c             |   14 ++++++++++++++
 25-akpm/include/linux/sysctl.h |    3 ++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff -puN fs/dquot.c~allow-disabling-quota-messages-to-console fs/dquot.c
--- 25/fs/dquot.c~allow-disabling-quota-messages-to-console	2004-11-30 01:23:17.695077048 -0800
+++ 25-akpm/fs/dquot.c	2004-11-30 01:23:17.703075832 -0800
@@ -774,8 +774,13 @@ static inline void dquot_decr_space(stru
 	clear_bit(DQ_BLKS_B, &dquot->dq_flags);
 }
 
+static int flag_print_warnings = 1;
+
 static inline int need_print_warning(struct dquot *dquot)
 {
+	if (!flag_print_warnings)
+		return 0;
+
 	switch (dquot->dq_type) {
 		case USRQUOTA:
 			return current->fsuid == dquot->dq_id;
@@ -803,6 +808,7 @@ static void print_warning(struct dquot *
 
 	if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags)))
 		return;
+
 	tty_write_message(current->signal->tty, dquot->dq_sb->s_id);
 	if (warntype == ISOFTWARN || warntype == BSOFTWARN)
 		tty_write_message(current->signal->tty, ": warning, ");
@@ -1744,6 +1750,14 @@ static ctl_table fs_dqstats_table[] = {
 		.mode		= 0444,
 		.proc_handler	= &proc_dointvec,
 	},
+	{
+		.ctl_name	= FS_DQ_WARNINGS,
+		.procname	= "warnings",
+		.data		= &flag_print_warnings,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
 	{ .ctl_name = 0 },
 };
 
diff -puN include/linux/sysctl.h~allow-disabling-quota-messages-to-console include/linux/sysctl.h
--- 25/include/linux/sysctl.h~allow-disabling-quota-messages-to-console	2004-11-30 01:23:17.697076744 -0800
+++ 25-akpm/include/linux/sysctl.h	2004-11-30 01:23:17.704075680 -0800
@@ -663,7 +663,7 @@ enum
 	FS_LEASES=13,	/* int: leases enabled */
 	FS_DIR_NOTIFY=14,	/* int: directory notification enabled */
 	FS_LEASE_TIME=15,	/* int: maximum time to wait for a lease break */
-	FS_DQSTATS=16,	/* disc quota usage statistics */
+	FS_DQSTATS=16,	/* disc quota usage statistics and control */
 	FS_XFS=17,	/* struct: control xfs parameters */
 	FS_AIO_NR=18,	/* current system-wide number of aio requests */
 	FS_AIO_MAX_NR=19,	/* system-wide maximum number of aio requests */
@@ -679,6 +679,7 @@ enum {
 	FS_DQ_ALLOCATED = 6,
 	FS_DQ_FREE = 7,
 	FS_DQ_SYNCS = 8,
+	FS_DQ_WARNINGS = 9,
 };
 
 /* CTL_DEBUG names: */
_
