Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/1] btrfs: Add macros for multilevel wait event annotations with lockdep
@ 2022-08-12  0:17 Ioannis Angelakopoulos
  2022-08-12  0:17 ` [PATCH 1/1] btrfs: Macros for multilevel annotations of wait events " Ioannis Angelakopoulos
  0 siblings, 1 reply; 2+ messages in thread
From: Ioannis Angelakopoulos @ 2022-08-12  0:17 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

Hello,

with this patch series we add two new macros, which can be used for
multilevel (nested) wait event annotations with lockdep.

The new macros added in fs/btrfs/ctree.h are:
  1) btrfs_might_wait_for_event_nested()
  2) btrfs_lockdep_acquire_nested()

Ioannis Angelakopoulos (1):
  btrfs: Macros for multilevel annotations of wait events with lockdep

 fs/btrfs/ctree.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] btrfs: Macros for multilevel annotations of wait events with lockdep
  2022-08-12  0:17 [PATCH 0/1] btrfs: Add macros for multilevel wait event annotations with lockdep Ioannis Angelakopoulos
@ 2022-08-12  0:17 ` Ioannis Angelakopoulos
  0 siblings, 0 replies; 2+ messages in thread
From: Ioannis Angelakopoulos @ 2022-08-12  0:17 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

The new macros are similar to the generic lockdep annotation macros used to
annotate wait events in btrfs in fs/btrfs/ctree.h. However, the new macros
take as a parameter the subclass of the lockdep map, which can be used for
a multilevel annotation of a wait event.

The new macros introduced are:
  1) btrfs_might_wait_for_event_nested()
  2) btrfs_lockdep_acquire_nested()

Signed-off-by: Ioannis Angelakopoulos <iangelak@fb.com>
---
 fs/btrfs/ctree.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 51c480439263..44837545eef8 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1211,6 +1211,16 @@ enum btrfs_lockdep_trans_states {
 		rwsem_release(&owner->lock##_map, _THIS_IP_);			\
 	} while (0)
 
+/*
+ * Same as the btrfs_wait_for_event() macro but used for multilevel lockdep
+ * annotations.
+ */
+#define btrfs_might_wait_for_event_nested(owner, lock, subclass)		\
+	do {									\
+		rwsem_acquire(&owner->lock##_map, subclass, 0, _THIS_IP_);	\
+		rwsem_release(&owner->lock##_map, _THIS_IP_);			\
+	} while (0)
+
 /*
  * Protection for the resource/condition of a wait event.
  *
@@ -1225,6 +1235,13 @@ enum btrfs_lockdep_trans_states {
 #define btrfs_lockdep_acquire(owner, lock)					\
 	rwsem_acquire_read(&owner->lock##_map, 0, 0, _THIS_IP_)
 
+/*
+ * Same as the btrfs_lockdep_acquire() macro but used for multilevel lockdep
+ * annotations.
+ */
+#define btrfs_lockdep_acquire_nested(owner, lock, subclass)			\
+	rwsem_acquire_read(&owner->lock##_map, subclass, 0, _THIS_IP_)
+
 /*
  * Used after signaling the condition for a wait event to release the lockdep
  * map held by a reader thread.
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-12  0:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-12  0:17 [PATCH 0/1] btrfs: Add macros for multilevel wait event annotations with lockdep Ioannis Angelakopoulos
2022-08-12  0:17 ` [PATCH 1/1] btrfs: Macros for multilevel annotations of wait events " Ioannis Angelakopoulos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox