Re: Linux 5.16-rc1

From: Guenter Roeck
Date: Thu Nov 18 2021 - 16:23:55 EST


On Wed, Nov 17, 2021 at 05:54:06PM -0800, Linus Torvalds wrote:
> On Wed, Nov 17, 2021 at 5:26 PM Anton Altaparmakov <anton@xxxxxxxxxx> wrote:
> >
> > So is it worth doing the singly linked list to fix one file only to have compilation fail a few files later when it gets to mft.c?
>
> Heh.
>
> That does sound dubious.
>
> Honestly, maybe the solution here is to just make the Kconfig depend
> on the page size not being excessive for what NTFS wants to do.
>
> Because I'm not sure that "powerpc with 64kB pages" is all that
> relevant for NTFS to begin with.
>
> The main problem is that the page size thing isn't some generic
> Kconfig entry, different architectures have different names for it. On
> PPC, the confic name is PPC_*K_PAGES and PPC_PAGE_SHIFT.
>
> And arm64 has something very similar.
>
> We have other things that do that, ie KASAN support has
>
> select HAVE_ARCH_KASAN if PPC32 && PPC_PAGE_SHIFT <= 14
>
> (and something very similar for arm64).
>
> But those KASAN dependencies are inside the core architecture Kconfig
> files, so it can fairly naturally use that page size config variable
> as a conditional.
>
> For something like NTFS, we don't really have a generic Kconfig
> variable to test.
>
> It wouldn't be _hard_ to add, but it would have to be done somewhat
> sensibly and preferably in a way that doesn't require every
> architecture to change how their page size selection (or lack of
> selection) is done.
>
> The simplest thing would probably be to add something like
> config BIG_PAGES
> bool
>
> to some generic file, and then add
>
> select BIG_PAGES
>
> to PPC and arm64 for the 64kB+ page size, and add a
>
> depends on !BIG_PAGES
>
> to the NTFS Kconfig entry.
>
> But that honestly looks a bit hacky to me. It would be less hacky to
> just add a PAGE_SIZE config variable, and have architectures just set
> it, and then NTFS could do
>
> depends on PAGE_SIZE < 65536
>
> or whatever. I just don't know if it's worth it if this is only for NTFS.
>

Like this ?

Guenter

---
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index dea74d7717c0..fd3fb2ab2350 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -767,6 +767,16 @@ config PPC_PAGE_SHIFT
default 14 if PPC_16K_PAGES
default 12

+config HAVE_PAGE_SIZE
+ def_bool y
+
+config PAGE_SIZE
+ int
+ default 262144 if PPC_256K_PAGES
+ default 65536 if PPC_64K_PAGES
+ default 16384 if PPC_16K_PAGES
+ default 4096
+
config THREAD_SHIFT
int "Thread shift" if EXPERT
range 13 15
diff --git a/fs/ntfs/Kconfig b/fs/ntfs/Kconfig
index 1667a7e590d8..912361014bb0 100644
--- a/fs/ntfs/Kconfig
+++ b/fs/ntfs/Kconfig
@@ -1,6 +1,16 @@
# SPDX-License-Identifier: GPL-2.0-only
+
+config NTFS_PAGE_SIZE_LIMIT
+ int
+ default 262144 if FRAME_WARN >= 8192
+ default 131072 if FRAME_WARN >= 4096
+ default 65536 if FRAME_WARN >= 2048
+ default 32768 if FRAME_WARN >= 1024
+ default 16384
+
config NTFS_FS
tristate "NTFS file system support"
+ depends on !WERROR || !HAVE_PAGE_SIZE || PAGE_SIZE < NTFS_PAGE_SIZE_LIMIT
select NLS
help
NTFS is the file system of Microsoft Windows NT, 2000, XP and 2003.