[v3,11/15] rbd: introduce IMG_REQ_NOLOCK flag for image request state
diff mbox series

Message ID 1564393377-28949-12-git-send-email-dongsheng.yang@easystack.cn
State New
Headers show
Series
  • rbd journaling feature
Related show

Commit Message

Dongsheng Yang July 29, 2019, 9:42 a.m. UTC
When we are going to replay an journal event, we don't need
to acquire exclusive_lock, as we are in lock acquiring.

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

Patch
diff mbox series

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 4ff46ac..337a20f 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -318,6 +318,7 @@  struct rbd_obj_request {
 enum img_req_flags {
 	IMG_REQ_CHILD,		/* initiator: block = 0, child image = 1 */
 	IMG_REQ_LAYERED,	/* ENOENT handling: normal = 0, layered = 1 */
+	IMG_REQ_NOLOCK,		/* this img request don't need exclusive lock */
 };
 
 enum rbd_img_state {
@@ -3550,6 +3551,9 @@  static bool need_exclusive_lock(struct rbd_img_request *img_req)
 	if (rbd_dev->spec->snap_id != CEPH_NOSNAP)
 		return false;
 
+	if (test_bit(IMG_REQ_NOLOCK, &img_req->flags))
+		return false;
+
 	rbd_assert(!test_bit(IMG_REQ_CHILD, &img_req->flags));
 	if (rbd_dev->opts->lock_on_read ||
 	    (rbd_dev->header.features & RBD_FEATURE_OBJECT_MAP))