mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
block: return on congested block device
A new bio operation flag REQ_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. Stacked devices such as md (the ones with make_request_fn hooks) currently are not supported because it may block for housekeeping. For example, an md can have a part of the device suspended. For this reason, only request based devices are supported. In the future, this feature will be expanded to stacked devices by teaching them how to handle the REQ_NOWAIT flags. Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Signed-off-by: Goldwyn Rodrigues <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
a38d124370
commit
03a07c92a9
5 changed files with 42 additions and 4 deletions
|
|
@ -479,8 +479,12 @@ static blk_status_t dio_bio_complete(struct dio *dio, struct bio *bio)
|
|||
unsigned i;
|
||||
blk_status_t err = bio->bi_status;
|
||||
|
||||
if (err)
|
||||
dio->io_error = -EIO;
|
||||
if (err) {
|
||||
if (err == BLK_STS_AGAIN && (bio->bi_opf & REQ_NOWAIT))
|
||||
dio->io_error = -EAGAIN;
|
||||
else
|
||||
dio->io_error = -EIO;
|
||||
}
|
||||
|
||||
if (dio->is_async && dio->op == REQ_OP_READ && dio->should_dirty) {
|
||||
bio_check_pages_dirty(bio); /* transfers ownership */
|
||||
|
|
@ -1194,6 +1198,8 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
|
|||
if (iov_iter_rw(iter) == WRITE) {
|
||||
dio->op = REQ_OP_WRITE;
|
||||
dio->op_flags = REQ_SYNC | REQ_IDLE;
|
||||
if (iocb->ki_flags & IOCB_NOWAIT)
|
||||
dio->op_flags |= REQ_NOWAIT;
|
||||
} else {
|
||||
dio->op = REQ_OP_READ;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue