REQ_NOAIT cleanups
Subsystems (2)
Hi all,
this series cleans up spurious code related to REQ_NOWAIT handling.
I have block layer work depending on this pending, so merging it through the block tree would be helpful.
Diffstat:
fs/direct-io.c | 15 ++++----------- include/linux/bio.h | 1 - 2 files changed, 4 insertions(+), 12 deletions(-)
PATCH 1/2 direct-io: remove IOCB_NOWAIT support
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.
--- fs/direct-io.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
fs/direct-io.c +4 -11
@@ -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
Signature · 1 line
2.53.0
Re: [PATCH 1/2] direct-io: remove IOCB_NOWAIT support
Quoted 5 lines · Christoph Hellwig
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 <[email protected]>
Looks OK to me.
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH 1/2] direct-io: remove IOCB_NOWAIT support
In reply to Christoph HellwigQuoted 5 lines · Christoph Hellwig
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 <[email protected]>
I agree there's no point in bothering with this. Feel free to add:
Honza
Quoted 42 lines
--- fs/direct-io.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)fs/direct-io.c +4
-11@@ -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 Signature · 1 line
2.53.0
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Re: [PATCH 1/2] direct-io: remove IOCB_NOWAIT support
In reply to Christoph HellwigQuoted 6 lines · Christoph Hellwig
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 <[email protected]>---
PATCH 2/2 block: don't set BIO_QUIET for BLK_STS_AGAIN
In reply to Christoph HellwigCommit abb30460bda2 ("block: mark bio_wouldblock_error() bio with BIO_QUIET") added this to suppress buffer_head warnings, but neither when this commit was added nor now any buffer_head using code actually ever sets REQ_NOWAIT which can lead to BLK_STS_AGAIN.
Remove the special handling for now. If we ever plan to use REQ_NOWAIT for buffer_head based I/O we're better off handling BLK_STS_AGAIN in the completion handler as it actually needs to retry the I/O as well.
--- include/linux/bio.h | 1 - 1 file changed, 1 deletion(-)
include/linux/bio.h +0 -1
@@ -379,7 +379,6 @@ static inline void bio_io_error(struct bio *bio)static inline void bio_wouldblock_error (struct bio *bio) { -bio_set_flag (bio,BIO_QUIET ); bio->bi_status =BLK_STS_AGAIN ;bio_endio (bio); }
Signature · 1 line
2.53.0
Re: [PATCH 2/2] block: don't set BIO_QUIET for BLK_STS_AGAIN
Quoted 10 lines · Christoph Hellwig
Commit
abb30460bda2("block: markbio_wouldblock_error()bio withBIO_QUIET") added this to suppressbuffer_headwarnings, but neither when this commit was added nor now anybuffer_headusing code actually ever setsREQ_NOWAITwhich can lead toBLK_STS_AGAIN.Remove the special handling for now. If we ever plan to use
REQ_NOWAITforbuffer_headbased I/O we're better off handlingBLK_STS_AGAINin the completion handler as it actually needs to retry the I/O as well.Signed-off-by Christoph Hellwig <[email protected]>
Looks OK to me.
Signature · 2 lines
Damien Le Moal Western Digital Research
Jan Kara
reviewerRe: [PATCH 2/2] block: don't set BIO_QUIET for BLK_STS_AGAIN
In reply to Christoph HellwigQuoted 10 lines · Christoph Hellwig
Commit
abb30460bda2("block: markbio_wouldblock_error()bio withBIO_QUIET") added this to suppressbuffer_headwarnings, but neither when this commit was added nor now anybuffer_headusing code actually ever setsREQ_NOWAITwhich can lead toBLK_STS_AGAIN.Remove the special handling for now. If we ever plan to use
REQ_NOWAITforbuffer_headbased I/O we're better off handlingBLK_STS_AGAINin the completion handler as it actually needs to retry the I/O as well.Signed-off-by Christoph Hellwig <[email protected]>
So I agree about the bh argument but bio_wouldblock_error() is not specific to bh path in any way, is it? So do we expect all bi_end_io handlers to check for BLK_STS_AGAIN and avoid complaining to logs in case of that? Not that all of them would be currently checking for BIO_QUIET either so I'm mostly trying to figure out what's the expected handling.
Honza
Quoted 19 lines
--- include/linux/bio.h | 1 - 1 file changed, 1 deletion(-)include/linux/bio.h +0
-1@@ -379,7 +379,6 @@ static inline void bio_io_error(struct bio *bio)static inline void bio_wouldblock_error (struct bio *bio) { -bio_set_flag (bio,BIO_QUIET ); bio->bi_status =BLK_STS_AGAIN ;bio_endio (bio); }Signature · 1 line
2.53.0
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Re: [PATCH 2/2] block: don't set BIO_QUIET for BLK_STS_AGAIN
Quoted 9 lines · Jan Kara
Quoted 9 lines
Commit
abb30460bda2("block: markbio_wouldblock_error()bio withBIO_QUIET") added this to suppressbuffer_headwarnings, but neither when this commit was added nor now anybuffer_headusing code actually ever setsREQ_NOWAITwhich can lead toBLK_STS_AGAIN.Remove the special handling for now. If we ever plan to use
REQ_NOWAITforbuffer_headbased I/O we're better off handlingBLK_STS_AGAINin the completion handler as it actually needs to retry the I/O as well.
Quoted 7 lines
Quoted 1 line
Signed-off-by Christoph Hellwig <[email protected]>So I agree about the bh argument but
bio_wouldblock_error()is not specific to bh path in any way, is it? So do we expect allbi_end_iohandlers to check forBLK_STS_AGAINand avoid complaining to logs in case of that? Not that all of them would be currently checking forBIO_QUIETeither so I'm mostly trying to figure out what's the expected handling.
File system would need special handling for BLK_STS_AGAIN were we to wire it up again (in upstream we have the dead direct-io code removed in patch 1, and an incorrect use in iomap polled I/O I sent a separate patch for), because simply bubbling it up as -EAGAIN will generally do the wrong thing. We ran into file system corruption last time we did it due to non-idempotency of writes and general locking issues with just retrying at a higher level.
Thus the rough consensus was that If we want to support fs-issued REQ_NOWAIT I/O we'd first need to add infrastructure to retry them from a blocking context at the bio-level, preferably in the block layer itself.
Re: [PATCH 2/2] block: don't set BIO_QUIET for BLK_STS_AGAIN
Quoted 26 lines · Christoph Hellwig
Quoted 9 lines · Jan Kara
Quoted 9 lines
Commit
abb30460bda2("block: markbio_wouldblock_error()bio withBIO_QUIET") added this to suppressbuffer_headwarnings, but neither when this commit was added nor now anybuffer_headusing code actually ever setsREQ_NOWAITwhich can lead toBLK_STS_AGAIN.Remove the special handling for now. If we ever plan to use
REQ_NOWAITforbuffer_headbased I/O we're better off handlingBLK_STS_AGAINin the completion handler as it actually needs to retry the I/O as well.Quoted 7 lines
Quoted 1 line
Signed-off-by Christoph Hellwig <[email protected]>So I agree about the bh argument but
bio_wouldblock_error()is not specific to bh path in any way, is it? So do we expect allbi_end_iohandlers to check forBLK_STS_AGAINand avoid complaining to logs in case of that? Not that all of them would be currently checking forBIO_QUIETeither so I'm mostly trying to figure out what's the expected handling.File system would need special handling for
BLK_STS_AGAINwere we to wire it up again (in upstream we have the dead direct-io code removed in patch 1, and an incorrect use in iomap polled I/O I sent a separate patch for), because simply bubbling it up as-EAGAINwill generally do the wrong thing. We ran into file system corruption last time we did it due to non-idempotency of writes and general locking issues with just retrying at a higher level.
Quoted 4 lines
Thus the rough consensus was that If we want to support fs-issued
REQ_NOWAITI/O we'd first need to add infrastructure to retry them from a blocking context at the bio-level, preferably in the block layer itself.
OK, fair. Thanks for explanation. So this flagging with quiet is indeed pointless. Feel free to add:
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 11 lines · Christoph Hellwig
this series cleans up spurious code related to
REQ_NOWAIThandling.I have block layer work depending on this pending, so merging it through the block tree would be helpful.
Diffstat:
fs/direct-io.c | 15 ++++----------- include/linux/bio.h | 1 - 2 files changed, 4 insertions(+), 12 deletions(-)[...]
Applied, thanks!
[1/2] direct-io: remove IOCB_NOWAIT support
commit: ef9049ec8b9fd6c508832d9f7ab12029f3355102
[2/2] block: don't set BIO_QUIET for BLK_STS_AGAIN
commit: 481105a949c8d11f7aa770b45fc4c8efcc53f205Best regards,
Signature · 1 line
Jens Axboe