From: Eric Whitney <enwlinux@gmail.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu
Subject: [PATCH] e2fsprogs: enable project quota reporting in debugfs
Date: Tue, 10 Jan 2017 16:54:01 -0500 [thread overview]
Message-ID: <20170110215401.GA1232@localhost.localdomain> (raw)
Make the minor changes required so the list_quota and get_quota commands
can report project quota information. This also fixes a debugfs
segfault that currently occurs when either list_quota or get_quota is
invoked with an unknown quota_type argument.
Signed-off-by: Eric Whitney <enwlinux@gmail.com>
---
debugfs/quota.c | 12 ++++++------
tests/f_quota/expect.0 | 28 ++++++++++++++--------------
2 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/debugfs/quota.c b/debugfs/quota.c
index cf1078c..0b7c2ee 100644
--- a/debugfs/quota.c
+++ b/debugfs/quota.c
@@ -25,7 +25,7 @@ extern char *optarg;
#include "debugfs.h"
-const char *quota_type[] = { "user", "group", NULL };
+const char *quota_type[] = { "user", "group", "project", NULL };
static int load_quota_ctx(char *progname)
{
@@ -92,7 +92,7 @@ static int parse_quota_type(const char *cmdname, const char *str)
static int list_quota_callback(struct dquot *dq,
void *cb_data EXT2FS_ATTR((unused)))
{
- printf("%8u %8lld %8lld %8lld %8lld %8lld %8lld\n",
+ printf("%10u %8lld %8lld %8lld %8lld %8lld %8lld\n",
dq->dq_id, (long long)dq->dq_dqb.dqb_curspace,
(long long)dq->dq_dqb.dqb_bsoftlimit,
(long long)dq->dq_dqb.dqb_bhardlimit,
@@ -120,8 +120,8 @@ void do_list_quota(int argc, char *argv[])
if (type < 0)
return;
- printf("%8s %8s %8s %8s %8s %8s %8s\n",
- (type == 0) ? "user id" : "group id",
+ printf("%7s %2s %8s %8s %8s %8s %8s %8s\n",
+ quota_type[type], "id",
"blocks", "quota", "limit", "inodes", "quota", "limit");
qh = current_qctx->quota_file[type];
retval = qh->qh_ops->scan_dquots(qh, list_quota_callback, NULL);
@@ -154,8 +154,8 @@ void do_get_quota(int argc, char *argv[])
if (err)
return;
- printf("%8s %8s %8s %8s %8s %8s %8s\n",
- (type == 0) ? "user id" : "group id",
+ printf("%7s %2s %8s %8s %8s %8s %8s %8s\n",
+ quota_type[type], "id",
"blocks", "quota", "limit", "inodes", "quota", "limit");
qh = current_qctx->quota_file[type];
diff --git a/tests/f_quota/expect.0 b/tests/f_quota/expect.0
index c0ad63d..eb5294e 100644
--- a/tests/f_quota/expect.0
+++ b/tests/f_quota/expect.0
@@ -1,21 +1,21 @@
debugfs: list_quota user
- user id blocks quota limit inodes quota limit
- 0 13312 0 0 2 0 0
- 34 1024 0 0 1 0 0
- 100 2048 32 50 2 20 30
+ user id blocks quota limit inodes quota limit
+ 0 13312 0 0 2 0 0
+ 34 1024 0 0 1 0 0
+ 100 2048 32 50 2 20 30
debugfs: list_quota group
-group id blocks quota limit inodes quota limit
- 0 16384 0 0 5 0 0
+ group id blocks quota limit inodes quota limit
+ 0 16384 0 0 5 0 0
debugfs: get_quota user 0
- user id blocks quota limit inodes quota limit
- 0 13312 0 0 2 0 0
+ user id blocks quota limit inodes quota limit
+ 0 13312 0 0 2 0 0
debugfs: get_quota user 100
- user id blocks quota limit inodes quota limit
- 100 2048 32 50 2 20 30
+ user id blocks quota limit inodes quota limit
+ 100 2048 32 50 2 20 30
debugfs: get_quota user 34
- user id blocks quota limit inodes quota limit
- 34 1024 0 0 1 0 0
+ user id blocks quota limit inodes quota limit
+ 34 1024 0 0 1 0 0
debugfs: get_quota group 0
-group id blocks quota limit inodes quota limit
- 0 16384 0 0 5 0 0
+ group id blocks quota limit inodes quota limit
+ 0 16384 0 0 5 0 0
debugfs:
--
2.1.4
next reply other threads:[~2017-01-10 21:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-10 21:54 Eric Whitney [this message]
2017-01-30 20:34 ` [PATCH] e2fsprogs: enable project quota reporting in debugfs Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170110215401.GA1232@localhost.localdomain \
--to=enwlinux@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).