From: "Theodore Ts'o" <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: Gwendal Grignou <gwendal@chromium.org>,
uekawa@chromium.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] tune2fs: do not update quota when not needed
Date: Thu, 24 Oct 2024 22:53:55 -0400 [thread overview]
Message-ID: <20241025025355.GR3204734@mit.edu> (raw)
In-Reply-To: <20240912091558.jbmwtnvfxrymjch2@quack3>
On Thu, Sep 12, 2024 at 11:15:58AM +0200, Jan Kara wrote:
> On Fri 30-08-24 11:59:21, Gwendal Grignou wrote:
> > Enabling quota is expensive: All inodes in the filesystem are scanned.
> > Only do it when the requested quota configuration does not match the
> > existing configuration.
> >
> > Test:
> > Add a tiny patch to print out when core of function
> > handle_quota_options() is triggered.
> > Issue commands:
> > truncate -s 1G unused ; mkfs.ext4 unused
> >
> > | commands | trigger | comments
> > +---------------------------------------------------------+---------+---------
> > | tune2fs -Qusrquota,grpquota -Qprjquota -O quota unused | Y |
> > Quota not set at formatting.
> > | tune2fs -Qusrquota,grpquota -Qprjquota -O quota unused | N |
> > Already set just above
> > | tune2fs -Qusrquota,grpquota -Q^prjquota -O quota unused | Y |
> > Disabling a quota option always force a deep look.
I'm not sure why disabling a quota should always "force a deep look"?
What was your thinking behind this change?
> Why don't you do it like:
>
> for (qtype = 0 ;qtype < MAXQUOTAS; qtype++) {
> if (quota_enable[qtype] == QOPT_ENABLE &&
> *quota_sb_inump(fs->super, qtype) == 0) {
> /* Need to enable this quota type. */
> break;
> }
> if (quota_enable[qtype] == QOPT_DISABLE &&
> *quota_sb_inump(fs->super, qtype)) {
> /* Need to disable this quota type. */
> break;
> }
> }
> if (qtype == MAXQUOTAS) {
> /* Nothing to do. */
> return 0;
> }
I like Jan's suggestion here, and this could easily just be done at
the beginning of handle_quota_options(), replacing what's currently
there:
for (qtype = 0 ; qtype < MAXQUOTAS; qtype++)
if (quota_enable[qtype] != 0)
break;
if (qtype == MAXQUOTAS)
/* Nothing to do. */
return 0;
It results in simpler and cleaner code, I think....
- Ted
next prev parent reply other threads:[~2024-10-25 2:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 18:59 [PATCH] tune2fs: do not update quota when not needed Gwendal Grignou
2024-09-12 9:15 ` Jan Kara
2024-10-25 2:53 ` Theodore Ts'o [this message]
2025-01-03 23:47 ` Gwendal Grignou
2025-01-03 23:50 ` [PATCH v2] " Gwendal Grignou
2025-01-06 10:10 ` Jan Kara
2025-05-21 14:51 ` 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=20241025025355.GR3204734@mit.edu \
--to=tytso@mit.edu \
--cc=gwendal@chromium.org \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=uekawa@chromium.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.