[PATCH v4 01/20] list: introduce LIST_HEAD_GUARDED

Christoph Hellwig hch at lst.de
Wed Jul 22 05:15:01 PDT 2026


On Mon, Jul 13, 2026 at 05:24:02PM +0530, Nilay Shroff wrote:
> Introduce LIST_HEAD_GUARDED(name, lock) to define a struct list_head
> annotated with __guarded_by(lock). This provides a convenient shorthand
> for defining lock-protected list heads and allows compiler context
> analysis to validate accesses to the list against the associated lock.
> 
> The new helper also reduces boilerplate and improves consistency across
> callers that annotate struct list_head objects with __guarded_by().
> 
> This is a preparatory change for subsequent patches that annotate
> LIST_HEAD() instances with their protecting lock.
> 
> Suggested-by: Christoph Hellwig <hch at lst.de>
> Signed-off-by: Nilay Shroff <nilay at linux.ibm.com>

Looks good:

Reviewed-by: Christoph Hellwig <hch at lst.de>




More information about the Linux-nvme mailing list