[PATCH v4 07/12] rbd: introduce completion for each img_request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When we are going to do a sync IO, we need a way
to wait a img_request to complete. Example, when
we are going to do journal replay, we need to do
a sync replaying, and return after img_request
completed.

Signed-off-by: Dongsheng Yang <dongsheng.yang@xxxxxxxxxxxx>
---
 drivers/block/rbd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index f1fc28d..8a8914a 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -349,6 +349,9 @@ struct rbd_img_request {
 	struct pending_result	pending;
 	struct work_struct	work;
 	int			work_result;
+
+	struct completion	completion;
+
 	struct kref		kref;
 };
 
@@ -1750,6 +1753,7 @@ static struct rbd_img_request *rbd_img_request_create(
 		img_request_layered_set(img_request);
 
 	INIT_LIST_HEAD(&img_request->lock_item);
+	init_completion(&img_request->completion);
 	INIT_LIST_HEAD(&img_request->object_extents);
 	mutex_init(&img_request->state_mutex);
 	kref_init(&img_request->kref);
@@ -3725,6 +3729,7 @@ static void rbd_img_handle_request(struct rbd_img_request *img_req, int result)
 	} else {
 		struct request *rq = img_req->rq;
 
+		complete_all(&img_req->completion);
 		rbd_img_request_put(img_req);
 		blk_mq_end_request(rq, errno_to_blk_status(result));
 	}
-- 
1.8.3.1





[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux