Configurable quota messages

From: Jan Kara
Date: Thu Oct 28 2004 - 11:49:55 EST


Hello Marcelo!

Here is a patch which allows root to turn of quota messages to console
(some users don't like them because they disturb other console output).
If you think the patch could go into 2.4 tree then please apply it.

Thanks
Honza
diff -ru linux-2.4.27/fs/dquot.c linux-2.4.27-quotawarn/fs/dquot.c
--- linux-2.4.27/fs/dquot.c 2004-08-08 01:26:05.000000000 +0200
+++ linux-2.4.27-quotawarn/fs/dquot.c 2004-10-27 16:41:49.000000000 +0200
@@ -794,8 +794,13 @@
mark_dquot_dirty(dquot);
}

+static int flag_print_warnings = 1;
+
static inline int need_print_warning(struct dquot *dquot, int flag)
{
+ if (!flag_print_warnings)
+ return 0;
+
switch (dquot->dq_type) {
case USRQUOTA:
return current->fsuid == dquot->dq_id && !(dquot->dq_flags & flag);
@@ -1498,6 +1503,7 @@
{FS_DQ_ALLOCATED, "allocated_dquots", &dqstats.allocated_dquots, sizeof(int), 0444, NULL, &proc_dointvec},
{FS_DQ_FREE, "free_dquots", &dqstats.free_dquots, sizeof(int), 0444, NULL, &proc_dointvec},
{FS_DQ_SYNCS, "syncs", &dqstats.syncs, sizeof(int), 0444, NULL, &proc_dointvec},
+ {FS_DQ_WARNINGS, "warnings", &flag_print_warnings, sizeof(int), 0644, NULL, &proc_dointvec},
{},
};

diff -ru linux-2.4.27/include/linux/sysctl.h linux-2.4.27-quotawarn/include/linux/sysctl.h
--- linux-2.4.27/include/linux/sysctl.h 2004-08-08 01:26:06.000000000 +0200
+++ linux-2.4.27-quotawarn/include/linux/sysctl.h 2004-10-27 18:22:24.000000000 +0200
@@ -627,7 +627,7 @@
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, /* dir: disc quota usage statistics */
+ FS_DQSTATS=16, /* dir: disc quota usage statistics and settings */
FS_XFS=17, /* struct: control xfs parameters */
};

@@ -641,6 +641,7 @@
FS_DQ_ALLOCATED = 6,
FS_DQ_FREE = 7,
FS_DQ_SYNCS = 8,
+ FS_DQ_WARNINGS = 9,
};

/* CTL_DEBUG names: */