diff mbox series

Fix EROFS Kconfig

Message ID 2265065.1703250126@warthog.procyon.org.uk (mailing list archive)
State New
Headers show
Series Fix EROFS Kconfig | expand

Commit Message

David Howells Dec. 22, 2023, 1:02 p.m. UTC
This needs an additional change (see attached).

Comments

Jingbo Xu Dec. 23, 2023, 3:55 a.m. UTC | #1
Hi,

On 12/22/23 9:02 PM, David Howells wrote:
> This needs an additional change (see attached).
> 
> diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig
> index 1d318f85232d..1949763e66aa 100644
> --- a/fs/erofs/Kconfig
> +++ b/fs/erofs/Kconfig
> @@ -114,7 +114,8 @@ config EROFS_FS_ZIP_DEFLATE
>  
>  config EROFS_FS_ONDEMAND
>  	bool "EROFS fscache-based on-demand read support"
> -	depends on CACHEFILES_ONDEMAND && (EROFS_FS=m && FSCACHE || EROFS_FS=y && FSCACHE=y)
> +	depends on CACHEFILES_ONDEMAND && FSCACHE && \
> +		(EROFS_FS=m && NETFS_SUPPORT || EROFS_FS=y && NETFS_SUPPORT=y)
>  	default n
>  	help
>  	  This permits EROFS to use fscache-backed data blobs with on-demand
> 

Thanks for the special reminder.  I noticed that it has been included in
this commit[*] in the dev tree.

[*]
https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?h=netfs-lib&id=7472173cc3baf4a0bd8c803e56c37efdb8388f1c


Besides I noticed an issue when trying to configure EROFS_FS_ONDEMAND.
The above kconfig indicates that EROFS_FS_ONDEMAND depends on
NETFS_SUPPORT, while NETFS_SUPPORT has no prompt in menuconfig and can
only be selected by, e.g. fs/ceph/Kconfig:

	config CEPH_FS
        select NETFS_SUPPORT

IOW EROFS_FS_ONDEMAND will not be prompted and has no way being
configured if NETFS_SUPPORT itself is not selected by any other filesystem.


I tried to fix this in following way:

diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig
index 1949763e66aa..5b7b71e537f1 100644
--- a/fs/erofs/Kconfig
+++ b/fs/erofs/Kconfig
@@ -5,6 +5,7 @@ config EROFS_FS
        depends on BLOCK
        select FS_IOMAP
        select LIBCRC32C
+       select NETFS_SUPPORT if EROFS_FS_ONDEMAND
        help
          EROFS (Enhanced Read-Only File System) is a lightweight read-only
          file system with modern designs (e.g. no buffer heads, inline
@@ -114,8 +115,10 @@ config EROFS_FS_ZIP_DEFLATE

 config EROFS_FS_ONDEMAND
        bool "EROFS fscache-based on-demand read support"
-       depends on CACHEFILES_ONDEMAND && FSCACHE && \
-               (EROFS_FS=m && NETFS_SUPPORT || EROFS_FS=y &&
NETFS_SUPPORT=y)
+       depends on EROFS_FS
+       select FSCACHE
        default n
        help
          This permits EROFS to use fscache-backed data blobs with on-demand


But still the dependency for CACHEFILES_ONDEMAND and CACHEFILES can not
be resolved.  Though CACHEFILES is not a must during the linking stage
as EROFS only calls fscache APIs directly, CACHEFILES is indeed needed
to ensure that the EROFS on-demand functionality works at runtime.

If we let EROFS_FS_ONDEMAND select CACHEFILES_ONDEMAND, then only
CACHEFILES_ONDEMAND will be selected while CACHEFILES can be still N.
Maybe EROFS_FS_ONDEMAND needs to selct both CACHEFILES_ONDEMAND and
CACHEFILES?

Besides if we make EROFS_FS_ONDEMAND depends on CACHEFILES_ONDEMAND,
then there will be a recursive dependency loop, as

fs/netfs/Kconfig:3:error: recursive dependency detected!
fs/netfs/Kconfig:3:	symbol NETFS_SUPPORT is selected by EROFS_FS_ONDEMAND
fs/erofs/Kconfig:116:	symbol EROFS_FS_ONDEMAND depends on
CACHEFILES_ONDEMAND
fs/cachefiles/Kconfig:30:	symbol CACHEFILES_ONDEMAND depends on CACHEFILES
fs/cachefiles/Kconfig:3:	symbol CACHEFILES depends on NETFS_SUPPORT


Hi Xiang, any better idea?
Gao Xiang Dec. 23, 2023, 1:32 p.m. UTC | #2
Hi David and Jingbo,

On 2023/12/23 11:55, Jingbo Xu wrote:
> Hi,
> 
> On 12/22/23 9:02 PM, David Howells wrote:
>> This needs an additional change (see attached).
>>
>> diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig
>> index 1d318f85232d..1949763e66aa 100644
>> --- a/fs/erofs/Kconfig
>> +++ b/fs/erofs/Kconfig
>> @@ -114,7 +114,8 @@ config EROFS_FS_ZIP_DEFLATE
>>   
>>   config EROFS_FS_ONDEMAND
>>   	bool "EROFS fscache-based on-demand read support"
>> -	depends on CACHEFILES_ONDEMAND && (EROFS_FS=m && FSCACHE || EROFS_FS=y && FSCACHE=y)
>> +	depends on CACHEFILES_ONDEMAND && FSCACHE && \
>> +		(EROFS_FS=m && NETFS_SUPPORT || EROFS_FS=y && NETFS_SUPPORT=y)
>>   	default n
>>   	help
>>   	  This permits EROFS to use fscache-backed data blobs with on-demand
>>
> 
> Thanks for the special reminder.  I noticed that it has been included in
> this commit[*] in the dev tree.
> 
> [*]
> https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?h=netfs-lib&id=7472173cc3baf4a0bd8c803e56c37efdb8388f1c
> 
> 
> Besides I noticed an issue when trying to configure EROFS_FS_ONDEMAND.
> The above kconfig indicates that EROFS_FS_ONDEMAND depends on
> NETFS_SUPPORT, while NETFS_SUPPORT has no prompt in menuconfig and can
> only be selected by, e.g. fs/ceph/Kconfig:
> 
> 	config CEPH_FS
>          select NETFS_SUPPORT
> 
> IOW EROFS_FS_ONDEMAND will not be prompted and has no way being
> configured if NETFS_SUPPORT itself is not selected by any other filesystem.
> 
> 
> I tried to fix this in following way:
> 
> diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig
> index 1949763e66aa..5b7b71e537f1 100644
> --- a/fs/erofs/Kconfig
> +++ b/fs/erofs/Kconfig
> @@ -5,6 +5,7 @@ config EROFS_FS
>          depends on BLOCK
>          select FS_IOMAP
>          select LIBCRC32C
> +       select NETFS_SUPPORT if EROFS_FS_ONDEMAND
>          help
>            EROFS (Enhanced Read-Only File System) is a lightweight read-only
>            file system with modern designs (e.g. no buffer heads, inline
> @@ -114,8 +115,10 @@ config EROFS_FS_ZIP_DEFLATE
> 
>   config EROFS_FS_ONDEMAND
>          bool "EROFS fscache-based on-demand read support"
> -       depends on CACHEFILES_ONDEMAND && FSCACHE && \
> -               (EROFS_FS=m && NETFS_SUPPORT || EROFS_FS=y &&
> NETFS_SUPPORT=y)
> +       depends on EROFS_FS
> +       select FSCACHE
>          default n
>          help
>            This permits EROFS to use fscache-backed data blobs with on-demand
> 
> 
> But still the dependency for CACHEFILES_ONDEMAND and CACHEFILES can not
> be resolved.  Though CACHEFILES is not a must during the linking stage
> as EROFS only calls fscache APIs directly, CACHEFILES is indeed needed
> to ensure that the EROFS on-demand functionality works at runtime.
> 
> If we let EROFS_FS_ONDEMAND select CACHEFILES_ONDEMAND, then only
> CACHEFILES_ONDEMAND will be selected while CACHEFILES can be still N.
> Maybe EROFS_FS_ONDEMAND needs to selct both CACHEFILES_ONDEMAND and
> CACHEFILES?

I think the main point here is that we don't have an explicit
menuconfig item for either netfs or fscache directly.

In principle, EROFS ondemand feature only needs fscache "volume
and cookie" management framework as well as cachefiles since
they're all needed to manage EROFS cached blobs, but I'm fine
if that needs NETFS_SUPPORT is also enabled.

If netfs doesn't have a plan for a new explicit menuconfig
item for users to use, I think we have to enable as below:

diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig
index 1d318f85232d..fffd3919343e 100644
--- a/fs/erofs/Kconfig
+++ b/fs/erofs/Kconfig
@@ -114,8 +114,11 @@ config EROFS_FS_ZIP_DEFLATE

  config EROFS_FS_ONDEMAND
  	bool "EROFS fscache-based on-demand read support"
-	depends on CACHEFILES_ONDEMAND && (EROFS_FS=m && FSCACHE || EROFS_FS=y && FSCACHE=y)
-	default n
+	depends on EROFS_FS
+	select NETFS_SUPPORT
+	select FSCACHE
+	select CACHEFILES
+	select CACHEFILES_ONDEMAND
  	help
  	  This permits EROFS to use fscache-backed data blobs with on-demand
  	  read support.
--
2.39.3

But cachefiles won't be complied as modules anymore. Does it
sounds good?

Thanks,
Gao Xiang
diff mbox series

Patch

diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig
index 1d318f85232d..1949763e66aa 100644
--- a/fs/erofs/Kconfig
+++ b/fs/erofs/Kconfig
@@ -114,7 +114,8 @@  config EROFS_FS_ZIP_DEFLATE
 
 config EROFS_FS_ONDEMAND
 	bool "EROFS fscache-based on-demand read support"
-	depends on CACHEFILES_ONDEMAND && (EROFS_FS=m && FSCACHE || EROFS_FS=y && FSCACHE=y)
+	depends on CACHEFILES_ONDEMAND && FSCACHE && \
+		(EROFS_FS=m && NETFS_SUPPORT || EROFS_FS=y && NETFS_SUPPORT=y)
 	default n
 	help
 	  This permits EROFS to use fscache-backed data blobs with on-demand