diff mbox series

[3/6] blk-zoned: Document locking assumptions

Message ID 20241216210244.2687662-4-bvanassche@acm.org (mailing list archive)
State New
Headers show
Series Minor improvements for the zoned block storage code | expand

Commit Message

Bart Van Assche Dec. 16, 2024, 9:02 p.m. UTC
Document which functions expect that their callers must hold a lock.

Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 block/blk-zoned.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Christoph Hellwig Dec. 17, 2024, 4:21 a.m. UTC | #1
On Mon, Dec 16, 2024 at 01:02:41PM -0800, Bart Van Assche wrote:
> Document which functions expect that their callers must hold a lock.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Damien Le Moal Dec. 17, 2024, 3:07 p.m. UTC | #2
On 2024/12/16 13:02, Bart Van Assche wrote:
> Document which functions expect that their callers must hold a lock.
> 
> Cc: Damien Le Moal <dlemoal@kernel.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
diff mbox series

Patch

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 3e42372fa832..ca44b2d6727c 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -460,6 +460,8 @@  static inline void disk_put_zone_wplug(struct blk_zone_wplug *zwplug)
 static inline bool disk_should_remove_zone_wplug(struct gendisk *disk,
 						 struct blk_zone_wplug *zwplug)
 {
+	lockdep_assert_held(&zwplug->lock);
+
 	/* If the zone write plug was already removed, we are done. */
 	if (zwplug->flags & BLK_ZONE_WPLUG_UNHASHED)
 		return false;
@@ -914,6 +916,8 @@  static bool blk_zone_wplug_prepare_bio(struct blk_zone_wplug *zwplug,
 {
 	struct gendisk *disk = bio->bi_bdev->bd_disk;
 
+	lockdep_assert_held(&zwplug->lock);
+
 	/*
 	 * If we lost track of the zone write pointer due to a write error,
 	 * the user must either execute a report zones, reset the zone or finish