From: Al Viro <viro@zeniv.linux.org.uk>
To: James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Ard Biesheuvel <ardb@kernel.org>,
Christian Brauner <brauner@kernel.org>
Subject: Re: [RFC PATCH 0/3] create simple libfs directory iterator and make efivarfs use it
Date: Tue, 18 Mar 2025 23:45:05 +0000 [thread overview]
Message-ID: <20250318234505.GY2023217@ZenIV> (raw)
In-Reply-To: <20250318194111.19419-1-James.Bottomley@HansenPartnership.com>
On Tue, Mar 18, 2025 at 03:41:08PM -0400, James Bottomley wrote:
> [Note this is built on top of the previous patch to populate path.mnt]
>
> This turned out to be much simpler than I feared. The first patch
> breaks out the core of the current dcache_readdir() into an internal
> function with a callback (there should be no functional change). The
> second adds a new API, simple_iterate_call(), which loops over the
> dentries in the next level and executes a callback for each one and
> the third which removes all the efivarfs superblock and mnt crud and
> replaces it with this simple callback interface. I think the
> diffstats of the third patch demonstrate how much nicer it is for us:
I suspect that you are making it too generic for its own good.
dcache_readdir() needs to cope with the situation when there are
fuckloads of opened-and-unliked files in there. That's why we
play those games with cursors under if (need_resched()) there.
That's not the case for efivarfs. There you really want just
"grab a reference to the next positive, drop the reference we
were given" and that's it.
IOW, find_next_child() instead of scan_positives(). Export that
and it becomes just a simple loop -
child = NULL;
while ((child = find_next_child(parent, child)) != NULL) {
struct inode *inode = d_inode(child);
struct efivar_entry *entry = efivar_entry(inode);
err = efivar_entry_size(entry, &size);
inode_lock(inode);
i_size_write(inode, err ? 0 : size + sizeof(__u32));
inode_unlock(inode);
if (err)
simple_recursive_removal(child, NULL);
}
and that's it. No callbacks, no cursors, no iterators - just an
export of helper already there.
next prev parent reply other threads:[~2025-03-18 23:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 19:41 [RFC PATCH 0/3] create simple libfs directory iterator and make efivarfs use it James Bottomley
2025-03-18 19:41 ` [RFC PATCH 1/3] libfs: rework dcache_readdir to use an internal function with callback James Bottomley
2025-03-18 21:32 ` Ard Biesheuvel
2025-03-18 21:49 ` James Bottomley
2025-03-18 19:41 ` [RFC PATCH 2/3] libfs: add simple directory iteration " James Bottomley
2025-03-18 21:33 ` Ard Biesheuvel
2025-03-18 21:50 ` James Bottomley
2025-03-18 19:41 ` [RFC PATCH 3/3] efivarfs: replace iterate_dir with libfs function simple_iterate_call James Bottomley
2025-03-18 21:34 ` Ard Biesheuvel
2025-03-18 23:45 ` Al Viro [this message]
2025-03-18 23:49 ` [RFC PATCH 0/3] create simple libfs directory iterator and make efivarfs use it Al Viro
2025-03-19 16:46 ` James Bottomley
2025-03-19 18:45 ` James Bottomley
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=20250318234505.GY2023217@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=James.Bottomley@hansenpartnership.com \
--cc=ardb@kernel.org \
--cc=brauner@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.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