On Tue, Jul 11, 2023 at 05:50:27PM -0600, Jens Axboe wrote: > On 7/11/23 5:41?PM, Dave Chinner wrote: > > On Tue, Jul 11, 2023 at 07:40:25PM +0800, Hao Xu wrote: > >> From: Dominique Martinet <asmadeus@xxxxxxxxxxxxx> > >> > >> This splits off the vfs_getdents function from the getdents64 system > >> call. > >> This will allow io_uring to call the vfs_getdents function. > >> > >> Co-developed-by: Stefan Roesch <shr@xxxxxx> > >> Signed-off-by: Stefan Roesch <shr@xxxxxx> > >> Signed-off-by: Dominique Martinet <asmadeus@xxxxxxxxxxxxx> > >> --- > >> fs/internal.h | 8 ++++++++ > >> fs/readdir.c | 34 ++++++++++++++++++++++++++-------- > >> 2 files changed, 34 insertions(+), 8 deletions(-) > >> > >> diff --git a/fs/internal.h b/fs/internal.h > >> index f7a3dc111026..b1f66e52d61b 100644 > >> --- a/fs/internal.h > >> +++ b/fs/internal.h > >> @@ -304,3 +304,11 @@ ssize_t __kernel_write_iter(struct file *file, struct iov_iter *from, loff_t *po > >> struct mnt_idmap *alloc_mnt_idmap(struct user_namespace *mnt_userns); > >> struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap); > >> void mnt_idmap_put(struct mnt_idmap *idmap); > >> + > >> +/* > >> + * fs/readdir.c > >> + */ > >> +struct linux_dirent64; > >> + > >> +int vfs_getdents(struct file *file, struct linux_dirent64 __user *dirent, > >> + unsigned int count); > > > > Uh... > > > > Since when have we allowed code outside fs/ to use fs/internal.h? > > io_uring does use for things like open/close, statx, and xattr already. Arguably though because you io_uring once used to be located under fs/. In general though, we don't support anyone outside of fs/ to use that header.