From: Linus Torvalds <[email protected]>
To: Dmitry Kadashev <[email protected]>
Cc: Jens Axboe <[email protected]>,
Alexander Viro <[email protected]>,
Christian Brauner <[email protected]>,
Pavel Begunkov <[email protected]>,
linux-fsdevel <[email protected]>,
io-uring <[email protected]>
Subject: Re: [PATCH v8 02/11] namei: change filename_parentat() calling conventions
Date: Wed, 7 Jul 2021 12:18:26 -0700 [thread overview]
Message-ID: <CAHk-=wh=cpt_tQCirzFZRPawRpbuFTZ2MxNpXiyUF+eBXF=+sw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
On Wed, Jul 7, 2021 at 5:28 AM Dmitry Kadashev <[email protected]> wrote:
>
> Hence this preparation change splits filename_parentat() into two: one
> that always consumes the name and another that never consumes the name.
> This will allow to implement two filename_create() variants in the same
> way, and is a consistent and hopefully easier to reason about approach.
I like it.
The patch itself is a bit hard to read, but the end result seems to make sense.
My main reaction is that this could have probably done a bit more
cleanup by avoiding some of the "goto exit1" kind of things.
Just as an example, now the rule is that "do_rmdir()" always does that
> putname(name);
> return error;
at the end, and I think this means that this whole function could be
split into a few trivial helper functions instead, and we'd have
long do_rmdir(int dfd, struct filename *name)
{
int error;
error = rmdir_helper(...)
if (!retry_estale(error, lookup_flags)) {
lookup_flags |= LOOKUP_REVAL;
error = rmdir_helper(...);
}
putname(name);
return error;
}
which gets rid of both the "goto retry" and the "goto exit1".
With the meat of "do_rmdir()" done in that "rmdir_helper()" function.
I think the same is basically true of "do_unlinkat()" too.
But I wouldn't mind that cleanup as a separate patch. My point is that
I think this new rule for when the name is consumed is better and can
result in further cleanups.
(NOTE! This is from just reading the patch, I might have missed some case).
Linus
next prev parent reply other threads:[~2021-07-07 19:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 12:27 [PATCH v8 00/11] io_uring: add mkdir and [sym]linkat support Dmitry Kadashev
2021-07-07 12:27 ` [PATCH v8 01/11] namei: ignore ERR/NULL names in putname() Dmitry Kadashev
2021-07-07 12:27 ` [PATCH v8 02/11] namei: change filename_parentat() calling conventions Dmitry Kadashev
2021-07-07 19:18 ` Linus Torvalds [this message]
2021-07-07 12:27 ` [PATCH v8 03/11] fs: make do_mkdirat() take struct filename Dmitry Kadashev
2021-07-07 19:20 ` Linus Torvalds
2021-07-07 12:27 ` [PATCH v8 04/11] io_uring: add support for IORING_OP_MKDIRAT Dmitry Kadashev
2021-07-07 12:27 ` [PATCH v8 05/11] fs: make do_mknodat() take struct filename Dmitry Kadashev
2021-07-07 19:22 ` Linus Torvalds
2021-07-07 12:27 ` [PATCH v8 06/11] fs: make do_symlinkat() " Dmitry Kadashev
2021-07-07 12:27 ` [PATCH v8 07/11] namei: add getname_uflags() Dmitry Kadashev
2021-07-07 12:27 ` [PATCH v8 08/11] fs: make do_linkat() take struct filename Dmitry Kadashev
2021-07-07 12:27 ` [PATCH v8 09/11] fs: update do_*() helpers to return ints Dmitry Kadashev
2021-07-07 12:27 ` [PATCH v8 10/11] io_uring: add support for IORING_OP_SYMLINKAT Dmitry Kadashev
2021-07-07 12:27 ` [PATCH v8 11/11] io_uring: add support for IORING_OP_LINKAT Dmitry Kadashev
2021-07-07 12:32 ` [PATCH v8 00/11] io_uring: add mkdir and [sym]linkat support Dmitry Kadashev
2021-07-07 19:26 ` Linus Torvalds
2021-07-08 6:05 ` Dmitry Kadashev
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='CAHk-=wh=cpt_tQCirzFZRPawRpbuFTZ2MxNpXiyUF+eBXF=+sw@mail.gmail.com' \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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