Skip to content

Commit eef46ab

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
gfs2: Introduce new quota=quiet mount option
This patch adds a new mount option quota=quiet which is the same as quota=on but it suppresses gfs2 quota error messages. Signed-off-by: Bob Peterson <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 267d1a0 commit eef46ab

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

fs/gfs2/incore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ struct gfs2_statfs_change_host {
537537
#define GFS2_QUOTA_OFF 0
538538
#define GFS2_QUOTA_ACCOUNT 1
539539
#define GFS2_QUOTA_ON 2
540+
#define GFS2_QUOTA_QUIET 3 /* on but not complaining */
540541

541542
#define GFS2_DATA_DEFAULT GFS2_DATA_ORDERED
542543
#define GFS2_DATA_WRITEBACK 1

fs/gfs2/ops_fstype.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,7 @@ static const struct constant_table gfs2_param_quota[] = {
13961396
{"off", GFS2_QUOTA_OFF},
13971397
{"account", GFS2_QUOTA_ACCOUNT},
13981398
{"on", GFS2_QUOTA_ON},
1399+
{"quiet", GFS2_QUOTA_QUIET},
13991400
{}
14001401
};
14011402

fs/gfs2/quota.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,8 @@ int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid)
10831083
u32 x;
10841084
int error = 0;
10851085

1086-
if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
1086+
if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON &&
1087+
sdp->sd_args.ar_quota != GFS2_QUOTA_QUIET)
10871088
return 0;
10881089

10891090
error = gfs2_quota_hold(ip, uid, gid);
@@ -1202,10 +1203,11 @@ static int print_message(struct gfs2_quota_data *qd, char *type)
12021203
{
12031204
struct gfs2_sbd *sdp = qd->qd_sbd;
12041205

1205-
fs_info(sdp, "quota %s for %s %u\n",
1206-
type,
1207-
(qd->qd_id.type == USRQUOTA) ? "user" : "group",
1208-
from_kqid(&init_user_ns, qd->qd_id));
1206+
if (sdp->sd_args.ar_quota != GFS2_QUOTA_QUIET)
1207+
fs_info(sdp, "quota %s for %s %u\n",
1208+
type,
1209+
(qd->qd_id.type == USRQUOTA) ? "user" : "group",
1210+
from_kqid(&init_user_ns, qd->qd_id));
12091211

12101212
return 0;
12111213
}
@@ -1291,7 +1293,8 @@ void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
12911293
u32 x;
12921294
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
12931295

1294-
if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON ||
1296+
if ((sdp->sd_args.ar_quota != GFS2_QUOTA_ON &&
1297+
sdp->sd_args.ar_quota != GFS2_QUOTA_QUIET) ||
12951298
gfs2_assert_warn(sdp, change))
12961299
return;
12971300
if (ip->i_diskflags & GFS2_DIF_SYSTEM)
@@ -1601,6 +1604,8 @@ static int gfs2_quota_get_state(struct super_block *sb, struct qc_state *state)
16011604
memset(state, 0, sizeof(*state));
16021605

16031606
switch (sdp->sd_args.ar_quota) {
1607+
case GFS2_QUOTA_QUIET:
1608+
fallthrough;
16041609
case GFS2_QUOTA_ON:
16051610
state->s_state[USRQUOTA].flags |= QCI_LIMITS_ENFORCED;
16061611
state->s_state[GRPQUOTA].flags |= QCI_LIMITS_ENFORCED;

fs/gfs2/super.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,9 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root)
11191119
case GFS2_QUOTA_ON:
11201120
state = "on";
11211121
break;
1122+
case GFS2_QUOTA_QUIET:
1123+
state = "quiet";
1124+
break;
11221125
default:
11231126
state = "unknown";
11241127
break;

0 commit comments

Comments
 (0)