diff mbox series

[v4,08/12] rbd: introduce IMG_REQ_NOLOCK flag for image request state

Message ID 1569402454-4736-9-git-send-email-dongsheng.yang@easystack.cn (mailing list archive)
State New, archived
Headers show
Series rbd journaling feature | expand

Commit Message

Dongsheng Yang Sept. 25, 2019, 9:07 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(+)
diff mbox series

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 8a8914a..6b387d9 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,		/* don't need exclusive lock and ->lock_rwsem */
 };
 
 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))