[PATCH 2/2] cachefiles: support query cachefiles ondemand feature
Gao Xiang
hsiangkao at linux.alibaba.com
Fri Jun 21 20:06:27 AEST 2024
On 2024/6/21 17:37, Hongbo Li wrote:
>
>
> On 2024/6/21 17:14, Gao Xiang wrote:
>>
>>
>> On 2024/6/21 14:18, Hongbo Li wrote:
>>> Erofs over fscache need CONFIG_CACHEFILES_ONDEMAND in cachefiles
>>> module. We cannot know whether it is supported from userspace, so
>>> we export this feature to user by sysfs interface.
>>>
>>> [Before]
>>> $ cat /sys/fs/cachefiles/features/cachefiles_ondemand
>>> cat: /sys/fs/cachefiles/features/cachefiles_ondemand: No such file or directory
>>>
>>> [After]
>>> $ cat /sys/fs/cachefiles/features/cachefiles_ondemand
>>> supported
>>>
>>> Signed-off-by: Hongbo Li <lihongbo22 at huawei.com>
>>
>> I don't think such sysfs is needed, you could just use
>> `bind ondemand` to check if it is supported:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/cachefiles/daemon.c?h=v6.9#n780
>>
> Thanks for reply!
> `bind ondemand` can check if it is supported, but it requires a more complicated procedure for user to implement. For example, a serial of system call (open, ioctl, close) are need.The containerd snapshotter daemon relies on these feature, only use a simple check method is usable in product environment. The snapshotter developers may know how cachefiles works, but for snapshotter users, a simple way to check whether snapshotter can be launched is useful. Even though they do not know how cachefiles works.
I don't think it needs to be considered as long as userspace
has a way to check since you could wrap up these as a helper
(I will do in the official erofs-utils later or if you have
some interest you could help too) and even some erofs-utils
binary for this.
sysfs maintainence just for some random feature doesn't
sound good to me (similar to ext4/xfs on-disk features) and
even if works, you cannot use this way for 5.19~6.10
upstream kernels.
Thanks,
Gao Xiang
>
> Thanks,
> Hongbo
>>
>> Thanks,
>> Gao Xiang
More information about the Linux-erofs
mailing list