From: Christoph Hellwig <hch@lst.de>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Miklos Szeredi <miklos@szeredi.hu>,
Christoph Hellwig <hch@lst.de>,
David Howells <dhowells@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org
Subject: Re: [PATCH v4 1/2] fs: use backing_file container for internal files with "fake" f_path
Date: Thu, 15 Jun 2023 06:24:24 +0200 [thread overview]
Message-ID: <20230615042424.GA4508@lst.de> (raw)
In-Reply-To: <20230614074907.1943007-2-amir73il@gmail.com>
On Wed, Jun 14, 2023 at 10:49:06AM +0300, Amir Goldstein wrote:
> +static struct file *__alloc_file(int flags, const struct cred *cred)
> +{
> + struct file *f;
> + int error;
> +
> + f = kmem_cache_zalloc(filp_cachep, GFP_KERNEL);
> + if (unlikely(!f))
> + return ERR_PTR(-ENOMEM);
> +
> + error = init_file(f, flags, cred);
> + if (unlikely(error))
> + return ERR_PTR(error);
> +
> return f;
Nit: is there much of a point in keeping this now very trivial helper
instead of open coding it in the two callers?
> +/*
> + * Variant of alloc_empty_file() that allocates a backing_file container
> + * and doesn't check and modify nr_files.
> + *
> + * Should not be used unless there's a very good reason to do so.
I'm not sure this comment is all that helpful.. I'd rather explain
when it should be used (i.e. only from open_backing_file) then when
it should not..
> -struct file *open_with_fake_path(const struct path *path, int flags,
> - struct inode *inode, const struct cred *cred)
> +struct file *open_backing_file(const struct path *path, int flags,
> + const struct path *real_path,
> + const struct cred *cred)
Please write a big fat comment on where this function should and should
not be used and how it works.
> +struct path *backing_file_real_path(struct file *f);
> +static inline const struct path *f_real_path(struct file *f)
> +{
> + if (unlikely(f->f_mode & FMODE_BACKING))
> + return backing_file_real_path(f);
> + else
> + return &f->f_path;
> +}
Nit: no need for the else here.
next prev parent reply other threads:[~2023-06-15 4:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 7:49 [PATCH v4 0/2] Handle notifications on overlayfs fake path files Amir Goldstein
2023-06-14 7:49 ` [PATCH v4 1/2] fs: use backing_file container for internal files with "fake" f_path Amir Goldstein
2023-06-14 13:26 ` Christian Brauner
2023-06-14 13:48 ` Amir Goldstein
2023-06-15 11:32 ` Amir Goldstein
2023-06-15 4:24 ` Christoph Hellwig [this message]
2023-06-14 7:49 ` [PATCH v4 2/2] ovl: enable fsnotify events on underlying real files Amir Goldstein
2023-06-14 9:54 ` Jan Kara
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=20230615042424.GA4508@lst.de \
--to=hch@lst.de \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=dhowells@redhat.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--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;
as well as URLs for NNTP newsgroup(s).