Commit 23ef8220 authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe

block: ublk_drv: don't consider flush request in map/unmap io

There isn't data in request of REQ_OP_FLUSH always, so don't consider
it in both ublk_map_io() and ublk_unmap_io().
Reviewed-by: default avatarZiyang Zhang <ZiyangZhang@linux.alibaba.com>
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 903f8aee
...@@ -529,15 +529,13 @@ static int ublk_map_io(const struct ublk_queue *ubq, const struct request *req, ...@@ -529,15 +529,13 @@ static int ublk_map_io(const struct ublk_queue *ubq, const struct request *req,
struct ublk_io *io) struct ublk_io *io)
{ {
const unsigned int rq_bytes = blk_rq_bytes(req); const unsigned int rq_bytes = blk_rq_bytes(req);
/* /*
* no zero copy, we delay copy WRITE request data into ublksrv * no zero copy, we delay copy WRITE request data into ublksrv
* context and the big benefit is that pinning pages in current * context and the big benefit is that pinning pages in current
* context is pretty fast, see ublk_pin_user_pages * context is pretty fast, see ublk_pin_user_pages
*/ */
if (req_op(req) != REQ_OP_WRITE && req_op(req) != REQ_OP_FLUSH) if (ublk_rq_has_data(req) && req_op(req) == REQ_OP_WRITE) {
return rq_bytes;
if (ublk_rq_has_data(req)) {
struct ublk_map_data data = { struct ublk_map_data data = {
.ubq = ubq, .ubq = ubq,
.rq = req, .rq = req,
...@@ -772,9 +770,7 @@ static inline void __ublk_rq_task_work(struct request *req) ...@@ -772,9 +770,7 @@ static inline void __ublk_rq_task_work(struct request *req)
return; return;
} }
if (ublk_need_get_data(ubq) && if (ublk_need_get_data(ubq) && (req_op(req) == REQ_OP_WRITE)) {
(req_op(req) == REQ_OP_WRITE ||
req_op(req) == REQ_OP_FLUSH)) {
/* /*
* We have not handled UBLK_IO_NEED_GET_DATA command yet, * We have not handled UBLK_IO_NEED_GET_DATA command yet,
* so immepdately pass UBLK_IO_RES_NEED_GET_DATA to ublksrv * so immepdately pass UBLK_IO_RES_NEED_GET_DATA to ublksrv
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment