Re: [PATCH v8 01/10] fs: Allow fine-grained control of folio sizes

Matthew Wilcox
2024-07-04T23:56:41Z

On Fri, Jul 05, 2024 at 08:06:51AM +1000, Dave Chinner wrote:
> > > It seems strange to silently clamp these? Presumably for the bs>ps usecase,
> > > whatever values are passed in are a hard requirement? So wouldn't want them to
> > > be silently reduced. (Especially given the recent change to reduce the size of
> > > MAX_PAGECACHE_ORDER to less then PMD size in some cases).
> >
> > Hm, yes. We should probably make this return an errno. Including
> > returning an errno for !IS_ENABLED() and min > 0.
>
> What are callers supposed to do with an error? In the case of
> setting up a newly allocated inode in XFS, the error would be
> returned in the middle of a transaction and so this failure would
> result in a filesystem shutdown.

I suggest you handle it better than this. If the device is asking for a
blocksize > PMD_SIZE, you should fail to mount it. If the device is
asking for a blocksize > PAGE_SIZE and CONFIG_TRANSPARENT_HUGEPAGE is
not set, you should also decline to mount the filesystem.