diff mbox series

[1/2] fs: fix kiocb ki_complete interface

Message ID 20200720132118.10934-2-johannes.thumshirn@wdc.com (mailing list archive)
State New, archived
Headers show
Series zonefs: use zone-append for aio with rwf append | expand

Commit Message

Johannes Thumshirn July 20, 2020, 1:21 p.m. UTC
From: Damien Le Moal <damien.lemoal@wdc.com>

The res and res2 fields of struct io_event are signed 64 bits values
(__s64 type). Allow the ki_complete method of struct kiocb to set 64
bits values in these fields by changin its interface from the long type
to long long.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 drivers/block/loop.c              | 3 ++-
 drivers/nvme/target/io-cmd-file.c | 3 ++-
 drivers/target/target_core_file.c | 3 ++-
 fs/aio.c                          | 2 +-
 fs/io_uring.c                     | 5 +++--
 include/linux/fs.h                | 2 +-
 6 files changed, 11 insertions(+), 7 deletions(-)

Comments

Christoph Hellwig July 20, 2020, 1:38 p.m. UTC | #1
On Mon, Jul 20, 2020 at 10:21:17PM +0900, Johannes Thumshirn wrote:
> From: Damien Le Moal <damien.lemoal@wdc.com>
> 
> The res and res2 fields of struct io_event are signed 64 bits values
> (__s64 type). Allow the ki_complete method of struct kiocb to set 64
> bits values in these fields by changin its interface from the long type
> to long long.

Which doesn't help if the consumers can't deal with these values.
But that shouldn't even be required for using zone append anyway..
Damien Le Moal July 20, 2020, 1:43 p.m. UTC | #2
On 2020/07/20 22:38, Christoph Hellwig wrote:
> On Mon, Jul 20, 2020 at 10:21:17PM +0900, Johannes Thumshirn wrote:
>> From: Damien Le Moal <damien.lemoal@wdc.com>
>>
>> The res and res2 fields of struct io_event are signed 64 bits values
>> (__s64 type). Allow the ki_complete method of struct kiocb to set 64
>> bits values in these fields by changin its interface from the long type
>> to long long.
> 
> Which doesn't help if the consumers can't deal with these values.
> But that shouldn't even be required for using zone append anyway..
> 

Not sure what you mean...

res2 is used to pass back to the user the written file offset, 64bits Bytes
value, for aio case (io_submit()/io_getevent()). The change does not break user
interface at all, no changes needed to any system call. The patch  just enables
passing that 64bit byte offset. The consumer of it would be the user
application, and yes, it does need to know what it is doing. But if it is using
zonefs, likely, the application knows.
Christoph Hellwig July 20, 2020, 1:47 p.m. UTC | #3
On Mon, Jul 20, 2020 at 01:43:43PM +0000, Damien Le Moal wrote:
> On 2020/07/20 22:38, Christoph Hellwig wrote:
> > On Mon, Jul 20, 2020 at 10:21:17PM +0900, Johannes Thumshirn wrote:
> >> From: Damien Le Moal <damien.lemoal@wdc.com>
> >>
> >> The res and res2 fields of struct io_event are signed 64 bits values
> >> (__s64 type). Allow the ki_complete method of struct kiocb to set 64
> >> bits values in these fields by changin its interface from the long type
> >> to long long.
> > 
> > Which doesn't help if the consumers can't deal with these values.
> > But that shouldn't even be required for using zone append anyway..
> > 
> 
> Not sure what you mean...
> 
> res2 is used to pass back to the user the written file offset, 64bits Bytes
> value, for aio case (io_submit()/io_getevent()). The change does not break user
> interface at all, no changes needed to any system call. The patch  just enables
> passing that 64bit byte offset. The consumer of it would be the user
> application, and yes, it does need to know what it is doing. But if it is using
> zonefs, likely, the application knows.

Please start a discussion on this ABI on the linux-aio and linux-api
lists.  If we support that for zonefs we should also support it for
other direct I/O writes.  And I'm not sure an API that only works
with aio and not io_uring is going to win a lot of friends these days.
diff mbox series

Patch

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index a943207705dd..2a1e0f248436 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -513,7 +513,8 @@  static void lo_rw_aio_do_completion(struct loop_cmd *cmd)
 		blk_mq_complete_request(rq);
 }
 
-static void lo_rw_aio_complete(struct kiocb *iocb, long ret, long ret2)
+static void lo_rw_aio_complete(struct kiocb *iocb,
+			       long long ret, long long ret2)
 {
 	struct loop_cmd *cmd = container_of(iocb, struct loop_cmd, iocb);
 
diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c
index 0abbefd9925e..302bfdff55e5 100644
--- a/drivers/nvme/target/io-cmd-file.c
+++ b/drivers/nvme/target/io-cmd-file.c
@@ -123,7 +123,8 @@  static ssize_t nvmet_file_submit_bvec(struct nvmet_req *req, loff_t pos,
 	return call_iter(iocb, &iter);
 }
 
-static void nvmet_file_io_done(struct kiocb *iocb, long ret, long ret2)
+static void nvmet_file_io_done(struct kiocb *iocb,
+			       long long ret, long long ret2)
 {
 	struct nvmet_req *req = container_of(iocb, struct nvmet_req, f.iocb);
 	u16 status = NVME_SC_SUCCESS;
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index 7143d03f0e02..87eac2313758 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -243,7 +243,8 @@  struct target_core_file_cmd {
 	struct kiocb	iocb;
 };
 
-static void cmd_rw_aio_complete(struct kiocb *iocb, long ret, long ret2)
+static void cmd_rw_aio_complete(struct kiocb *iocb,
+				long long ret, long long ret2)
 {
 	struct target_core_file_cmd *cmd;
 
diff --git a/fs/aio.c b/fs/aio.c
index 91e7cc4a9f17..38bce07f9733 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1418,7 +1418,7 @@  static void aio_remove_iocb(struct aio_kiocb *iocb)
 	spin_unlock_irqrestore(&ctx->ctx_lock, flags);
 }
 
-static void aio_complete_rw(struct kiocb *kiocb, long res, long res2)
+static void aio_complete_rw(struct kiocb *kiocb, long long res, long long res2)
 {
 	struct aio_kiocb *iocb = container_of(kiocb, struct aio_kiocb, rw);
 
diff --git a/fs/io_uring.c b/fs/io_uring.c
index ce63e1389568..a2e861b13b1e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2261,14 +2261,15 @@  static void __io_complete_rw(struct io_kiocb *req, long res, long res2,
 		io_complete_rw_common(&req->rw.kiocb, res, cs);
 }
 
-static void io_complete_rw(struct kiocb *kiocb, long res, long res2)
+static void io_complete_rw(struct kiocb *kiocb, long long res, long long res2)
 {
 	struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb);
 
 	__io_complete_rw(req, res, res2, NULL);
 }
 
-static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2)
+static void io_complete_rw_iopoll(struct kiocb *kiocb, long long res,
+				  long long res2)
 {
 	struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb);
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index da90323b9f92..aa8e82496179 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -328,7 +328,7 @@  struct kiocb {
 	randomized_struct_fields_start
 
 	loff_t			ki_pos;
-	void (*ki_complete)(struct kiocb *iocb, long ret, long ret2);
+	void (*ki_complete)(struct kiocb *iocb, long long ret, long long ret2);
 	void			*private;
 	int			ki_flags;
 	u16			ki_hint;