]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
direct-io: remove IOCB_NOWAIT support
authorChristoph Hellwig <hch@lst.de>
Mon, 18 May 2026 06:33:29 +0000 (08:33 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 26 May 2026 17:01:55 +0000 (11:01 -0600)
None of the file systems using the legacy direct I/O code actually sets
FMODE_NOWAIT, and if they did this would not work, as the write locking
could not handle the retry.  Remove this dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://patch.msgid.link/20260518063336.507369-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/direct-io.c

index 2267f5ae7f77a886731b52834c6ea5347a5f24d6..9e49767169855a4b6877a3844cab717f0a5bdd88 100644 (file)
@@ -502,12 +502,8 @@ static blk_status_t dio_bio_complete(struct dio *dio, struct bio *bio)
        const enum req_op dio_op = dio->opf & REQ_OP_MASK;
        bool should_dirty = dio_op == REQ_OP_READ && dio->should_dirty;
 
-       if (err) {
-               if (err == BLK_STS_AGAIN && (bio->bi_opf & REQ_NOWAIT))
-                       dio->io_error = -EAGAIN;
-               else
-                       dio->io_error = -EIO;
-       }
+       if (err)
+               dio->io_error = -EIO;
 
        if (dio->is_async && should_dirty) {
                bio_check_pages_dirty(bio);     /* transfers ownership */
@@ -1178,13 +1174,10 @@ ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
                dio->is_async = true;
 
        dio->inode = inode;
-       if (iov_iter_rw(iter) == WRITE) {
+       if (iov_iter_rw(iter) == WRITE)
                dio->opf = REQ_OP_WRITE | REQ_SYNC | REQ_IDLE;
-               if (iocb->ki_flags & IOCB_NOWAIT)
-                       dio->opf |= REQ_NOWAIT;
-       } else {
+       else
                dio->opf = REQ_OP_READ;
-       }
 
        /*
         * For AIO O_(D)SYNC writes we need to defer completions to a workqueue