[PATCH v16 16/26] blk-zoned: Document locking assumptions

Bart Van Assche
2024-11-19T00:28:59Z

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
block/blk-zoned.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 1d0f8fea7516..17fe40db1888 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -441,6 +441,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;
@@ -583,6 +585,8 @@ static inline void disk_zone_wplug_set_error(struct gendisk *disk,
{
unsigned long flags;

+ lockdep_assert_held(&zwplug->lock);
+
if (zwplug->flags & BLK_ZONE_WPLUG_ERROR)
return;

@@ -933,6 +937,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);
+
/*
* Check that the user is not attempting to write to a full zone.
* We know such BIO will fail, and that would potentially overflow our