From: Jens Axboe Date: Thu, 5 Mar 2015 23:29:35 +0000 (-0700) Subject: aio: propagate and use queue cookie X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=refs%2Fheads%2Fblk-polled-io;p=linux-2.6-block.git aio: propagate and use queue cookie Signed-off-by: Jens Axboe --- diff --git a/fs/aio.c b/fs/aio.c index f8e52a1854c1..9ae65c2c9002 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -783,11 +783,17 @@ static int kill_ioctx(struct mm_struct *mm, struct kioctx *ctx, */ ssize_t wait_on_sync_kiocb(struct kiocb *req) { + struct backing_dev_info *bdi = NULL; + + if (req->ki_filp) + bdi = inode_to_bdi(req->ki_filp->f_inode); + while (!req->ki_ctx) { set_current_state(TASK_UNINTERRUPTIBLE); if (req->ki_ctx) break; - io_schedule(); + + bdi_io_wait(bdi, req->ki_queue_cookie); } __set_current_state(TASK_RUNNING); return req->ki_user_data; diff --git a/fs/direct-io.c b/fs/direct-io.c index adc588ad22da..35c33f4178d2 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -403,6 +403,9 @@ static inline void dio_bio_submit(struct dio *dio, struct dio_submit *sdio) } else dio->bio_cookie = submit_bio(dio->rw, bio); + if (dio->iocb) + dio->iocb->ki_queue_cookie = dio->bio_cookie; + sdio->bio = NULL; sdio->boundary = 0; sdio->logical_offset_in_bio = 0; diff --git a/include/linux/aio.h b/include/linux/aio.h index d9c92daa3944..1e897fd633d5 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h @@ -8,6 +8,7 @@ #include #include +#include struct kioctx; struct kiocb; @@ -52,6 +53,8 @@ struct kiocb { * this is the underlying eventfd context to deliver events to. */ struct eventfd_ctx *ki_eventfd; + + queue_cookie_t ki_queue_cookie; }; static inline bool is_sync_kiocb(struct kiocb *kiocb)