diff mbox series

[2/6] blk-zoned: Document the locking order

Message ID 20241216210244.2687662-3-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 that zwplug->lock is the outer lock relative to
disk->zone_wplugs_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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig Dec. 17, 2024, 4:21 a.m. UTC | #1
On Mon, Dec 16, 2024 at 01:02:40PM -0800, Bart Van Assche wrote:
> Document that zwplug->lock is the outer lock relative to
> disk->zone_wplugs_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 | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index 1575b887fa38..3e42372fa832 100644
> --- a/block/blk-zoned.c
> +++ b/block/blk-zoned.c
> @@ -46,7 +46,8 @@ static const char *const zone_cond_name[] = {
>   *       reference is dropped whenever the zone of the zone write plug is reset,
>   *       finished and when the zone becomes full (last write BIO to the zone
>   *       completes).
> - * @lock: Spinlock to atomically manipulate the plug.
> + * @lock: Spinlock to atomically manipulate the plug. Outer lock relative to
> + *	disk->zone_wplugs_lock.

That's pretty odd wording.  If you think this information is important
we should probably have a comment at the top of the file explaining the
lock order like in many MM or VFS source files.
diff mbox series

Patch

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 1575b887fa38..3e42372fa832 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -46,7 +46,8 @@  static const char *const zone_cond_name[] = {
  *       reference is dropped whenever the zone of the zone write plug is reset,
  *       finished and when the zone becomes full (last write BIO to the zone
  *       completes).
- * @lock: Spinlock to atomically manipulate the plug.
+ * @lock: Spinlock to atomically manipulate the plug. Outer lock relative to
+ *	disk->zone_wplugs_lock.
  * @flags: Flags indicating the plug state.
  * @zone_no: The number of the zone the plug is managing.
  * @wp_offset: The zone write pointer location relative to the start of the zone