From: Jan Kara <jack@suse.cz>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Lukas Czerner <lczerner@redhat.com>,
Hugh Dickins <hughd@google.com>, Jan Kara <jack@suse.com>,
Eric Sandeen <sandeen@redhat.com>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/2] shmem: implement user/group quota support for tmpfs
Date: Tue, 8 Nov 2022 17:52:47 +0100 [thread overview]
Message-ID: <20221108165247.aeqooex26wfdiitm@quack3> (raw)
In-Reply-To: <Y2qC8lcFAMyDhUs1@magnolia>
On Tue 08-11-22 08:25:22, Darrick J. Wong wrote:
> On Tue, Nov 08, 2022 at 02:30:09PM +0100, Lukas Czerner wrote:
> > diff --git a/Documentation/filesystems/tmpfs.rst b/Documentation/filesystems/tmpfs.rst
> > index 0408c245785e..9c4f228ef4f3 100644
> > --- a/Documentation/filesystems/tmpfs.rst
> > +++ b/Documentation/filesystems/tmpfs.rst
> > @@ -86,6 +86,18 @@ use up all the memory on the machine; but enhances the scalability of
> > that instance in a system with many CPUs making intensive use of it.
> >
> >
> > +tmpfs also supports quota with the following mount options
> > +
> > +======== =============================================================
> > +quota Quota accounting is enabled on the mount. Tmpfs is using
> > + hidden system quota files that are initialized on mount.
> > + Quota limits can quota enforcement can be enabled using
> > + standard quota tools.
> > +usrquota Same as quota option. Exists for compatibility reasons.
> > +grpquota Same as quota option. Exists for compatibility reasons.
>
> I guess this is following ext* where group and user quota cannot be
> enabled individually, nor is there a 'noenforce' mode?
Well, in ext4 enforcement of user and group quotas can be enabled
separately. usrquota enables enforcement of user quotas, grpquota enables
enforcement of group quotas. Quota usage tracking depends on the enabled
filesystem features and there you are correct ext4 either tracks both user
& group usage or none. OTOH project quota tracking can be selected
separately. Frankly, I don't see a great reason to not allow user/group
quotas to be tracked independently when we already have all three mount
options.
I agree the noenforce mode for tmpfs does not make a lot of sense.
> > + shmem_quota_write_inode(inode, type, (const char *)&qinfo,
> > + sizeof(qinfo), sizeof(qheader));
> > + shmem_quota_write_inode(inode, type, 0,
> > + QT_TREEOFF * QUOTABLOCK_SIZE,
> > + QUOTABLOCK_SIZE);
> > +
> > + shmem_set_inode_flags(inode, FS_NOATIME_FL | FS_IMMUTABLE_FL);
> > +
> > + err = dquot_load_quota_inode(inode, type, QFMT_VFS_V1,
>
> I wonder, what's the difference between quota v1 and v2? Wouldn't we
> want the newer version?
So this is a naming catch I've introduced many years ago :-| QFMT_VFS_V1 is
the newest quota format we support and is implemented in
fs/quota/quota_v2.c
> > @@ -353,7 +590,6 @@ static void shmem_recalc_inode(struct inode *inode)
> > freed = info->alloced - info->swapped - inode->i_mapping->nrpages;
> > if (freed > 0) {
> > info->alloced -= freed;
> > - inode->i_blocks -= freed * BLOCKS_PER_PAGE;
>
> I guess the quotaops helpers take care of the i_blocks updates now?
Yes, dquot_alloc_space() takes care of inode->i_blocks update.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2022-11-08 16:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 13:30 [PATCH 0/2] [RFC] shmem: user and group " Lukas Czerner
2022-11-08 13:30 ` [PATCH 1/2] shmem: implement user/group " Lukas Czerner
2022-11-08 16:25 ` Darrick J. Wong
2022-11-08 16:52 ` Jan Kara [this message]
2022-11-09 9:30 ` Lukas Czerner
2022-11-08 20:03 ` Matthew Wilcox
2022-11-09 1:52 ` kernel test robot
2022-11-09 13:10 ` kernel test robot
2022-11-12 3:29 ` kernel test robot
2022-11-08 13:30 ` [PATCH 2/2] shmem: implement mount options for global quota limits Lukas Czerner
2022-11-08 16:35 ` Darrick J. Wong
2022-11-09 9:02 ` Lukas Czerner
2022-11-08 17:43 ` [PATCH 0/2] [RFC] shmem: user and group quota support for tmpfs Jan Kara
2022-11-09 9:41 ` Lukas Czerner
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=20221108165247.aeqooex26wfdiitm@quack3 \
--to=jack@suse.cz \
--cc=djwong@kernel.org \
--cc=hughd@google.com \
--cc=jack@suse.com \
--cc=lczerner@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sandeen@redhat.com \
/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