[PATCH v10 03/10] fs: Export alloc_empty_backing_file

Hongbo Li posted 10 patches 1 month, 2 weeks ago
Only 9 patches received!
There is a newer version of this series
[PATCH v10 03/10] fs: Export alloc_empty_backing_file
Posted by Hongbo Li 1 month, 2 weeks ago
There is no need to open nonexistent real files if backing files
couldn't be backed by real files (e.g., EROFS page cache sharing
doesn't need typical real files to open again).

Therefore, we export the alloc_empty_backing_file() helper, allowing
filesystems to dynamically set the backing file without real file
open. This is particularly useful for obtaining the correct @path
and @inode when calling file_user_path() and file_user_inode().

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 fs/file_table.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/file_table.c b/fs/file_table.c
index cd4a3db4659a..476edfe7d8f5 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -308,6 +308,7 @@ struct file *alloc_empty_backing_file(int flags, const struct cred *cred)
 	ff->file.f_mode |= FMODE_BACKING | FMODE_NOACCOUNT;
 	return &ff->file;
 }
+EXPORT_SYMBOL_GPL(alloc_empty_backing_file);
 
 /**
  * file_init_path - initialize a 'struct file' based on path
-- 
2.22.0
Re: [PATCH v10 03/10] fs: Export alloc_empty_backing_file
Posted by Gao Xiang 1 month, 2 weeks ago

On 2025/12/23 09:56, Hongbo Li wrote:
> There is no need to open nonexistent real files if backing files
> couldn't be backed by real files (e.g., EROFS page cache sharing
> doesn't need typical real files to open again).
> 
> Therefore, we export the alloc_empty_backing_file() helper, allowing
> filesystems to dynamically set the backing file without real file
> open. This is particularly useful for obtaining the correct @path
> and @inode when calling file_user_path() and file_user_inode().
> 
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>

Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

(I hope Amir could ack this particular patch too..)

Thanks,
Gao Xiang
Re: [PATCH v10 03/10] fs: Export alloc_empty_backing_file
Posted by Amir Goldstein 1 month, 2 weeks ago
On Tue, Dec 23, 2025 at 10:31 AM Gao Xiang <hsiangkao@linux.alibaba.com> wrote:
>
>
>
> On 2025/12/23 09:56, Hongbo Li wrote:
> > There is no need to open nonexistent real files if backing files
> > couldn't be backed by real files (e.g., EROFS page cache sharing
> > doesn't need typical real files to open again).
> >
> > Therefore, we export the alloc_empty_backing_file() helper, allowing
> > filesystems to dynamically set the backing file without real file
> > open. This is particularly useful for obtaining the correct @path
> > and @inode when calling file_user_path() and file_user_inode().
> >
> > Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
>
> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
>
> (I hope Amir could ack this particular patch too..)

As long as Chritian is ok with this, I don't mind.

Acked-by: Amir Goldstein <amir73il@gmail.com>

Thanks,
Amir.