Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-29 Thread Lennert Buytenhek
On Fri, Jan 29, 2021 at 07:37:03AM +0200, Lennert Buytenhek wrote: > > > > One open question is whether IORING_OP_GETDENTS64 should be more like > > > > pread(2) and allow passing in a starting offset to read from the > > > > directory from. (This would require some more surgery in

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-28 Thread Lennert Buytenhek
On Fri, Jan 29, 2021 at 01:07:10AM +0200, Lennert Buytenhek wrote: > > > One open question is whether IORING_OP_GETDENTS64 should be more like > > > pread(2) and allow passing in a starting offset to read from the > > > directory from. (This would require some more surgery in fs/readdir.c.) > >

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-28 Thread Lennert Buytenhek
On Sun, Jan 24, 2021 at 10:21:38PM +, David Laight wrote: > > One open question is whether IORING_OP_GETDENTS64 should be more like > > pread(2) and allow passing in a starting offset to read from the > > directory from. (This would require some more surgery in fs/readdir.c.) > > Since

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-28 Thread Lennert Buytenhek
On Sat, Jan 23, 2021 at 04:33:34PM -0700, Jens Axboe wrote: > >> IORING_OP_GETDENTS64 behaves like getdents64(2) and takes the same > > > > Could we drop the '64'? We don't, for example, have IOURING_OP_FADVISE64 > > even though that's the name of the syscall. > > Agreed, only case we do mimic

RE: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-24 Thread David Laight
> One open question is whether IORING_OP_GETDENTS64 should be more like > pread(2) and allow passing in a starting offset to read from the > directory from. (This would require some more surgery in fs/readdir.c.) Since directories are seekable this ought to work. Modulo horrid issues with 32bit

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-23 Thread Andres Freund
Hi, On 2021-01-24 01:59:05 +, Al Viro wrote: > On Sat, Jan 23, 2021 at 03:50:55PM -0800, Andres Freund wrote: > > > As there's only a shared lock, seems like both would end up with the > > same ctx->pos and end up updating f_pos to the same offset (assuming the > > same count). > > > > Am I

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-23 Thread Al Viro
On Sat, Jan 23, 2021 at 03:50:55PM -0800, Andres Freund wrote: > As there's only a shared lock, seems like both would end up with the > same ctx->pos and end up updating f_pos to the same offset (assuming the > same count). > > Am I missing something? This: f = fdget_pos(fd); if

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-23 Thread Andres Freund
Hi, On 2021-01-23 15:50:55 -0800, Andres Freund wrote: > It's also not clear to me that right now you'd necessarily get correct > results if multiple IORING_OP_GETDENTS64 for the same fd get processed > in different workers. Looking at iterate_dir(), it looks to me that the > locking around the

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-23 Thread Andres Freund
Hi, On 2021-01-23 13:41:52 +0200, Lennert Buytenhek wrote: > IORING_OP_GETDENTS64 behaves like getdents64(2) and takes the same > arguments. I've wished for this before, this would be awesome. > One open question is whether IORING_OP_GETDENTS64 should be more like > pread(2) and allow passing

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-23 Thread Jens Axboe
On 1/23/21 4:27 PM, Matthew Wilcox wrote: > On Sat, Jan 23, 2021 at 01:41:52PM +0200, Lennert Buytenhek wrote: >> IORING_OP_GETDENTS64 behaves like getdents64(2) and takes the same > > Could we drop the '64'? We don't, for example, have IOURING_OP_FADVISE64 > even though that's the name of the

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-23 Thread Matthew Wilcox
On Sat, Jan 23, 2021 at 01:41:52PM +0200, Lennert Buytenhek wrote: > IORING_OP_GETDENTS64 behaves like getdents64(2) and takes the same Could we drop the '64'? We don't, for example, have IOURING_OP_FADVISE64 even though that's the name of the syscall.

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-23 Thread Jens Axboe
On 1/23/21 11:16 AM, Lennert Buytenhek wrote: > On Sat, Jan 23, 2021 at 10:37:25AM -0700, Jens Axboe wrote: > >>> IORING_OP_GETDENTS64 behaves like getdents64(2) and takes the same >>> arguments. >>> >>> Signed-off-by: Lennert Buytenhek >>> --- >>> This seems to work OK, but I'd appreciate a

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-23 Thread Lennert Buytenhek
On Sat, Jan 23, 2021 at 10:37:25AM -0700, Jens Axboe wrote: > > IORING_OP_GETDENTS64 behaves like getdents64(2) and takes the same > > arguments. > > > > Signed-off-by: Lennert Buytenhek > > --- > > This seems to work OK, but I'd appreciate a review from someone more > > familiar with io_uring

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-23 Thread Jens Axboe
On 1/23/21 4:41 AM, Lennert Buytenhek wrote: > IORING_OP_GETDENTS64 behaves like getdents64(2) and takes the same > arguments. > > Signed-off-by: Lennert Buytenhek > --- > This seems to work OK, but I'd appreciate a review from someone more > familiar with io_uring internals than I am, as I'm

[RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-23 Thread Lennert Buytenhek
IORING_OP_GETDENTS64 behaves like getdents64(2) and takes the same arguments. Signed-off-by: Lennert Buytenhek --- This seems to work OK, but I'd appreciate a review from someone more familiar with io_uring internals than I am, as I'm not entirely sure I did everything quite right. A dumb test