linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@collabora.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Hugh Dickins <hughd@google.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	 Amir Goldstein <amir73il@gmail.com>,
	kernel@collabora.com,  Khazhismel Kumykov <khazhy@google.com>,
	 Linux MM <linux-mm@kvack.org>,
	 linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH RESEND 2/3] shmem: Introduce /sys/fs/tmpfs support
Date: Mon, 04 Apr 2022 15:02:35 -0400	[thread overview]
Message-ID: <87zgl0y8ms.fsf@collabora.com> (raw)
In-Reply-To: <Ykr6fmRjMwEhIjtk@zeniv-ca.linux.org.uk> (Al Viro's message of "Mon, 4 Apr 2022 14:02:38 +0000")

Al Viro <viro@zeniv.linux.org.uk> writes:

> On Mon, Apr 04, 2022 at 09:41:36AM -0400, Gabriel Krisman Bertazi wrote:
>> In order to expose tmpfs statistics on sysfs, add the boilerplate code
>> to create the /sys/fs/tmpfs structure.  As suggested on a previous
>> review, this uses the minor as the volume directory in /sys/fs/.
>> 
>> 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>
>
>> +static void shmem_unregister_sysfs(struct super_block *sb)
>> +{
>> +	struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
>> +
>> +	kobject_del(&sbinfo->s_kobj);
>> +	kobject_put(&sbinfo->s_kobj);
>> +	wait_for_completion(&sbinfo->s_kobj_unregister);
>> +}
>
> If you embed kobject into something, you basically commit to
> having the lifetime rules maintained by that kobject...

Hi Viro,

The way I'm doing it seems to be a pattern used by at least Ext4, f2fs
and Btrfs. Is there a problem with embedding it in the superblock,
holding a reference and then waiting for completion when umounting the
fs?

-- 
Gabriel Krisman Bertazi


  reply	other threads:[~2022-04-04 19:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-04 13:41 [PATCH RESEND 0/3] shmem: Allow userspace monitoring of tmpfs for lack of space Gabriel Krisman Bertazi
2022-04-04 13:41 ` [PATCH RESEND 1/3] shmem: Keep track of out-of-memory and out-of-space errors Gabriel Krisman Bertazi
2022-04-04 13:41 ` [PATCH RESEND 2/3] shmem: Introduce /sys/fs/tmpfs support Gabriel Krisman Bertazi
2022-04-04 14:02   ` Al Viro
2022-04-04 19:02     ` Gabriel Krisman Bertazi [this message]
2022-04-04 13:41 ` [PATCH RESEND 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=87zgl0y8ms.fsf@collabora.com \
    --to=krisman@collabora.com \
    --cc=akpm@linux-foundation.org \
    --cc=amir73il@gmail.com \
    --cc=hughd@google.com \
    --cc=kernel@collabora.com \
    --cc=khazhy@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=viro@zeniv.linux.org.uk \
    /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