From: Amir Goldstein <amir73il@gmail.com>
To: Gabriel Krisman Bertazi <krisman@collabora.com>
Cc: Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Khazhismel Kumykov <khazhy@google.com>,
Linux MM <linux-mm@kvack.org>,
kernel@collabora.com,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 2/3] shmem: Introduce /sys/fs/tmpfs support
Date: Wed, 23 Mar 2022 01:58:07 +0200 [thread overview]
Message-ID: <CAOQ4uxhLQp4ujuR8k16k9EfeOC2TiwwiCeVGYOzpViwRpa5oqw@mail.gmail.com> (raw)
In-Reply-To: <20220322222738.182974-3-krisman@collabora.com>
[+fsdevel please CC on next versions]
On Wed, Mar 23, 2022 at 12:27 AM Gabriel Krisman Bertazi
<krisman@collabora.com> wrote:
>
> In order to expose tmpfs statistics on sysfs, add the boilerplate code
> to create the /sys/fs/tmpfs structure. Other filesystems usually do
> /sys/fs/<fs>/<disk>, but since this is a nodev filesystem, I'm proposing
> to use fsid as <disk>.
I am proposing st_dev minor.
>
> This takes care of not exposing SB_NOUSER mounts. I don't think we have
> a usecase for showing them and, since they don't appear elsewhere, they
> might be confusing to users.
>
> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
> ---
> include/linux/shmem_fs.h | 4 +++
> mm/shmem.c | 73 +++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 76 insertions(+), 1 deletion(-)
>
[...]
> +static int shmem_register_sysfs(struct super_block *sb)
> +{
> + int err;
> + struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
> + __kernel_fsid_t fsid = uuid_to_fsid(sb->s_uuid.b);
> +
> + init_completion(&sbinfo->s_kobj_unregister);
> + err = kobject_init_and_add(&sbinfo->s_kobj, &tmpfs_sb_ktype, shmem_root,
> + "%x%x", fsid.val[0], fsid.val[1]);
uuid (and fsid) try to be unique across tmpfs instances from different times.
You don't need that.
I think you'd rather use s_dev (minor number) which is unique among all tmpfs
instances at a given time and also much easier from user scripts to read from
(e.g. stat or /proc/self/mountinfo).
That's btw the same number is used as an entry in /sys/fs/fuse/connections
(fusectl pseudo fs).
Thanks,
Amir.
next prev parent reply other threads:[~2022-03-22 23:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-22 22:27 [PATCH 0/3] shmem: Allow userspace monitoring of tmpfs for lack of space Gabriel Krisman Bertazi
2022-03-22 22:27 ` [PATCH 1/3] shmem: Keep track of out-of-memory and out-of-space errors Gabriel Krisman Bertazi
2022-03-22 22:27 ` [PATCH 2/3] shmem: Introduce /sys/fs/tmpfs support Gabriel Krisman Bertazi
2022-03-22 23:58 ` Amir Goldstein [this message]
2022-03-23 18:04 ` Gabriel Krisman Bertazi
2022-03-22 22:27 ` [PATCH 3/3] shmem: Expose space and accounting error count Gabriel Krisman Bertazi
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=CAOQ4uxhLQp4ujuR8k16k9EfeOC2TiwwiCeVGYOzpViwRpa5oqw@mail.gmail.com \
--to=amir73il@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=kernel@collabora.com \
--cc=khazhy@google.com \
--cc=krisman@collabora.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox