Introduce IOCB_CMD_ZONE_APPEND opcode for zone-append. On append completion zone-relative offset is returned using io_event->res2. Signed-off-by: Kanchan Joshi <joshi.k@xxxxxxxxxxx> Signed-off-by: Arnav Dawn <a.dawn@xxxxxxxxxxx> Signed-off-by: SelvaKumar S <selvakuma.s1@xxxxxxxxxxx> Signed-off-by: Nitesh Shetty <nj.shetty@xxxxxxxxxxx> Signed-off-by: Javier Gonzalez <javier.gonz@xxxxxxxxxxx> --- fs/aio.c | 8 ++++++++ include/uapi/linux/aio_abi.h | 1 + 2 files changed, 9 insertions(+) diff --git a/fs/aio.c b/fs/aio.c index 7ecddc2..8b10a55d 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1579,6 +1579,10 @@ static int aio_write(struct kiocb *req, const struct iocb *iocb, __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, true); __sb_writers_release(file_inode(file)->i_sb, SB_FREEZE_WRITE); } +#ifdef CONFIG_BLK_DEV_ZONED + if (iocb->aio_lio_opcode == IOCB_CMD_ZONE_APPEND) + req->ki_flags |= IOCB_ZONE_APPEND; +#endif req->ki_flags |= IOCB_WRITE; aio_rw_done(req, call_write_iter(file, req, &iter)); } @@ -1846,6 +1850,10 @@ static int __io_submit_one(struct kioctx *ctx, const struct iocb *iocb, return aio_fsync(&req->fsync, iocb, true); case IOCB_CMD_POLL: return aio_poll(req, iocb); +#ifdef CONFIG_BLK_DEV_ZONED + case IOCB_CMD_ZONE_APPEND: + return aio_write(&req->rw, iocb, false, compat); +#endif default: pr_debug("invalid aio operation %d\n", iocb->aio_lio_opcode); return -EINVAL; diff --git a/include/uapi/linux/aio_abi.h b/include/uapi/linux/aio_abi.h index 8387e0a..541d96a 100644 --- a/include/uapi/linux/aio_abi.h +++ b/include/uapi/linux/aio_abi.h @@ -43,6 +43,7 @@ enum { IOCB_CMD_NOOP = 6, IOCB_CMD_PREADV = 7, IOCB_CMD_PWRITEV = 8, + IOCB_CMD_ZONE_APPEND = 9, }; /* -- 2.7.4