[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210621152243.GA6392@lst.de>
Date: Mon, 21 Jun 2021 17:22:43 +0200
From: Christoph Hellwig <hch@....de>
To: Matthew Wilcox <willy@...radead.org>
Cc: Christoph Hellwig <hch@....de>, viro@...iv.linux.org.uk,
Vivek Goyal <vgoyal@...hat.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, virtio-fs@...hat.com
Subject: Re: [PATCH 1/2] init: split get_fs_names
On Mon, Jun 21, 2021 at 04:09:16PM +0100, Matthew Wilcox wrote:
> On Mon, Jun 21, 2021 at 08:26:56AM +0200, Christoph Hellwig wrote:
> > -static void __init get_fs_names(char *page)
> > +static void __init split_fs_names(char *page, char *names)
>
> If you're going to respin it anyway, can you rename 'page' to 'buf'
> or something? Kind of confusing to have a char * called 'page'.
I was hoping that we did not need a respin. While Al's suggestion is
nice, and I've added a variant of it to my local tree it really
is just incremental improvements.
I actually thing that page name is not too bad, as it implements the
implicit assumptions that it is a PAGE_SIZE allocation (which is a bad
idea to start with, but we're digging a deeper and deeper hole here..)
> is it really worth doing a strcpy() followed by a custom strtok()?
> would this work better?
>
> char c;
>
> do {
> c = *root_fs_names++;
> *buf++ = c;
> if (c == ',')
> buf[-1] = '\0';
> } while (c);
Maybe. Then again all this is age old rarely used code, so it might be
better to not stirr it too much..
> > +static void __init get_all_fs_names(char *page)
> > +{
> > + int len = get_filesystem_list(page);
>
> it occurs to me that get_filesystem_list() fails silently. if you build
> every linux filesystem in, and want your root on zonefs (assuming
> they're alphabetical), we'll fail to find it without a message
> indicating that we overflowed the buffer.
Yes. The only sensible way to fix this would be some kind of cursor.
We could use an xarray for the file_systems list, but unless we want
to assume file systems can't go away at init type (which might be an
ok assumption) we'd then need to get into refcount, and and and..
Powered by blists - more mailing lists