Re: [RFC PATCH 3/4] fs/super.c: introduce reverse superblock iterator and use it in emergency remount
From: James Bottomley
Date: Fri Mar 28 2025 - 08:39:10 EST
On Fri, 2025-03-28 at 12:56 +0100, Christian Brauner wrote:
> On Thu, Mar 27, 2025 at 10:06:12AM -0400, James Bottomley wrote:
> > Originally proposed by Amir as an extract from the android kernel:
> >
> > https://lore.kernel.org/linux-fsdevel/CAA2m6vfatWKS1CQFpaRbii2AXiZFvQUjVvYhGxWTSpz+2rxDyg@xxxxxxxxxxxxxx/
> >
> > Since suspend/resume requires a reverse iterator, I'm dusting it
> > off.
> >
> > Signed-off-by: James Bottomley
> > <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>
> > ---
> > fs/super.c | 48 +++++++++++++++++++++++++++++-------------------
> > 1 file changed, 29 insertions(+), 19 deletions(-)
> >
> > diff --git a/fs/super.c b/fs/super.c
> > index 5a7db4a556e3..76785509d906 100644
> > --- a/fs/super.c
> > +++ b/fs/super.c
> > @@ -887,28 +887,38 @@ void drop_super_exclusive(struct super_block
> > *sb)
> > }
> > EXPORT_SYMBOL(drop_super_exclusive);
> >
> > +#define ITERATE_SUPERS(f, rev) \
>
> I'm not fond of the macro magic here.
> I've taken some of your patches and massaging them.
I'm not either, so if you have an alternative, I'm all ears. The
problem I had is that list_for_each_entry() and _reverse are designed
to take a code block, so it's very difficult to swap one for the other
without macroizing. The internal logic is complex enough that I didn't
want to duplicate it.
Regards,
James