From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Damien Le Moal <dlemoal@kernel.org>,
Bart Van Assche <bvanassche@acm.org>,
Nathan Chancellor <nathan@kernel.org>,
Keith Busch <kbusch@kernel.org>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>,
Chaitanya Kulkarni <kch@nvidia.com>,
Genjian Zhang <zhanggenjian@kylinos.cn>,
Nilay Shroff <nilay@linux.ibm.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Kees Cook <kees@kernel.org>
Subject: [PATCH v2 07/12] null_blk: Add more lock context annotations
Date: Mon, 16 Mar 2026 13:08:44 -0700 [thread overview]
Message-ID: <20260316200901.4111651-9-bvanassche@acm.org> (raw)
In-Reply-To: <20260316200901.4111651-1-bvanassche@acm.org>
Prepare for enabling lock context analysis by adding the lock context
annotations that are required by Clang.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/block/null_blk/main.c | 7 +++++--
drivers/block/null_blk/zoned.c | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index f8c0fd57e041..677ac829ef80 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1004,8 +1004,7 @@ static struct nullb_page *null_lookup_page(struct nullb *nullb,
static struct nullb_page *null_insert_page(struct nullb *nullb,
sector_t sector, bool ignore_cache)
- __releases(&nullb->lock)
- __acquires(&nullb->lock)
+ __must_hold(&nullb->lock)
{
u64 idx;
struct nullb_page *t_page;
@@ -1038,6 +1037,7 @@ static struct nullb_page *null_insert_page(struct nullb *nullb,
}
static int null_flush_cache_page(struct nullb *nullb, struct nullb_page *c_page)
+ __must_hold(&nullb->lock)
{
int i;
unsigned int offset;
@@ -1087,6 +1087,7 @@ static int null_flush_cache_page(struct nullb *nullb, struct nullb_page *c_page)
}
static int null_make_cache_space(struct nullb *nullb, unsigned long n)
+ __must_hold(&nullb->lock)
{
int i, err, nr_pages;
struct nullb_page *c_pages[FREE_BATCH];
@@ -1141,6 +1142,7 @@ static int null_make_cache_space(struct nullb *nullb, unsigned long n)
static blk_status_t copy_to_nullb(struct nullb *nullb, void *source,
loff_t pos, size_t n, bool is_fua)
+ __must_hold(&nullb->lock)
{
size_t temp, count = 0;
struct nullb_page *t_page;
@@ -1242,6 +1244,7 @@ static blk_status_t null_handle_flush(struct nullb *nullb)
static blk_status_t null_transfer(struct nullb *nullb, struct page *page,
unsigned int len, unsigned int off, bool is_write, loff_t pos,
bool is_fua)
+ __must_hold(&nullb->lock)
{
struct nullb_device *dev = nullb->dev;
blk_status_t err = BLK_STS_OK;
diff --git a/drivers/block/null_blk/zoned.c b/drivers/block/null_blk/zoned.c
index 384bdce6a9b7..a7f94e76034f 100644
--- a/drivers/block/null_blk/zoned.c
+++ b/drivers/block/null_blk/zoned.c
@@ -32,6 +32,7 @@ static inline void null_init_zone_lock(struct nullb_device *dev,
static inline void null_lock_zone(struct nullb_device *dev,
struct nullb_zone *zone)
+ __no_context_analysis /* conditional locking */
{
if (!dev->memory_backed)
spin_lock_irq(&zone->spinlock);
@@ -41,6 +42,7 @@ static inline void null_lock_zone(struct nullb_device *dev,
static inline void null_unlock_zone(struct nullb_device *dev,
struct nullb_zone *zone)
+ __no_context_analysis /* conditional locking */
{
if (!dev->memory_backed)
spin_unlock_irq(&zone->spinlock);
next prev parent reply other threads:[~2026-03-16 20:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 20:08 [PATCH v2 00/12] Enable lock context analysis Bart Van Assche
2026-03-16 20:08 ` [PATCH v2 01/12] drbd: Balance RCU calls in drbd_adm_dump_devices() Bart Van Assche
2026-03-16 20:08 ` [PATCH v2] powerpc/powermac: Remove pmac_low_i2c_{lock,unlock}() Bart Van Assche
2026-03-16 20:12 ` Bart Van Assche
2026-03-16 20:08 ` [PATCH v2 02/12] block: Make the lock context annotations compatible with Clang Bart Van Assche
2026-03-17 14:04 ` Christoph Hellwig
2026-03-17 16:36 ` Bart Van Assche
2026-03-16 20:08 ` [PATCH v2 03/12] aoe: Add a lock context annotation Bart Van Assche
2026-03-16 20:08 ` [PATCH v2 04/12] drbd: Make the lock context annotations compatible with Clang Bart Van Assche
2026-03-16 20:08 ` [PATCH v2 05/12] loop: Add lock context annotations Bart Van Assche
2026-03-17 14:05 ` Christoph Hellwig
2026-03-16 20:08 ` [PATCH v2 06/12] nbd: " Bart Van Assche
2026-03-16 20:08 ` Bart Van Assche [this message]
2026-03-16 20:08 ` [PATCH v2 08/12] rbd: " Bart Van Assche
2026-03-16 20:08 ` [PATCH v2 09/12] ublk: Fix the " Bart Van Assche
2026-03-16 20:08 ` [PATCH v2 10/12] zloop: Add a " Bart Van Assche
2026-03-17 14:07 ` Christoph Hellwig
2026-03-16 20:08 ` [PATCH v2 11/12] zram: Add " Bart Van Assche
2026-03-17 14:08 ` Christoph Hellwig
2026-03-17 16:24 ` Bart Van Assche
2026-03-16 20:08 ` [PATCH v2 12/12] block: Enable lock context analysis for all block drivers Bart Van Assche
2026-03-17 14:08 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260316200901.4111651-9-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dlemoal@kernel.org \
--cc=hch@lst.de \
--cc=johannes.thumshirn@wdc.com \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=kees@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nilay@linux.ibm.com \
--cc=zhanggenjian@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox