From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>, Damien Le Moal <dlemoal@kernel.org>
Cc: linux-block@vger.kernel.org
Subject: [PATCH 6/6] zloop: remove irq-safe locking
Date: Tue, 14 Apr 2026 10:17:51 +0200 [thread overview]
Message-ID: <20260414081811.549755-7-hch@lst.de> (raw)
In-Reply-To: <20260414081811.549755-1-hch@lst.de>
All of zloop runs in user context, so drop the irq-safe locking.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/zloop.c | 37 +++++++++++++++----------------------
1 file changed, 15 insertions(+), 22 deletions(-)
diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
index 3f69206d674a..55eeb6aac0ea 100644
--- a/drivers/block/zloop.c
+++ b/drivers/block/zloop.c
@@ -311,7 +311,6 @@ static int zloop_update_seq_zone(struct zloop_device *zlo, unsigned int zone_no)
struct zloop_zone *zone = &zlo->zones[zone_no];
struct kstat stat;
sector_t file_sectors;
- unsigned long flags;
int ret;
lockdep_assert_held(&zone->lock);
@@ -337,7 +336,7 @@ static int zloop_update_seq_zone(struct zloop_device *zlo, unsigned int zone_no)
return -EINVAL;
}
- spin_lock_irqsave(&zone->wp_lock, flags);
+ spin_lock(&zone->wp_lock);
if (!file_sectors) {
zloop_mark_empty(zlo, zone);
} else if (file_sectors == zlo->zone_capacity) {
@@ -348,7 +347,7 @@ static int zloop_update_seq_zone(struct zloop_device *zlo, unsigned int zone_no)
zone->cond = BLK_ZONE_COND_CLOSED;
zone->wp = zone->start + file_sectors;
}
- spin_unlock_irqrestore(&zone->wp_lock, flags);
+ spin_unlock(&zone->wp_lock);
return 0;
}
@@ -381,7 +380,6 @@ static int zloop_open_zone(struct zloop_device *zlo, unsigned int zone_no)
static int zloop_close_zone(struct zloop_device *zlo, unsigned int zone_no)
{
struct zloop_zone *zone = &zlo->zones[zone_no];
- unsigned long flags;
int ret = 0;
if (test_bit(ZLOOP_ZONE_CONV, &zone->flags))
@@ -400,13 +398,13 @@ static int zloop_close_zone(struct zloop_device *zlo, unsigned int zone_no)
break;
case BLK_ZONE_COND_IMP_OPEN:
case BLK_ZONE_COND_EXP_OPEN:
- spin_lock_irqsave(&zone->wp_lock, flags);
+ spin_lock(&zone->wp_lock);
zloop_lru_remove_open_zone(zlo, zone);
if (zone->wp == zone->start)
zone->cond = BLK_ZONE_COND_EMPTY;
else
zone->cond = BLK_ZONE_COND_CLOSED;
- spin_unlock_irqrestore(&zone->wp_lock, flags);
+ spin_unlock(&zone->wp_lock);
break;
case BLK_ZONE_COND_EMPTY:
case BLK_ZONE_COND_FULL:
@@ -424,7 +422,6 @@ static int zloop_close_zone(struct zloop_device *zlo, unsigned int zone_no)
static int zloop_reset_zone(struct zloop_device *zlo, unsigned int zone_no)
{
struct zloop_zone *zone = &zlo->zones[zone_no];
- unsigned long flags;
int ret = 0;
if (test_bit(ZLOOP_ZONE_CONV, &zone->flags))
@@ -442,10 +439,10 @@ static int zloop_reset_zone(struct zloop_device *zlo, unsigned int zone_no)
goto unlock;
}
- spin_lock_irqsave(&zone->wp_lock, flags);
+ spin_lock(&zone->wp_lock);
zloop_mark_empty(zlo, zone);
clear_bit(ZLOOP_ZONE_SEQ_ERROR, &zone->flags);
- spin_unlock_irqrestore(&zone->wp_lock, flags);
+ spin_unlock(&zone->wp_lock);
unlock:
mutex_unlock(&zone->lock);
@@ -470,7 +467,6 @@ static int zloop_reset_all_zones(struct zloop_device *zlo)
static int zloop_finish_zone(struct zloop_device *zlo, unsigned int zone_no)
{
struct zloop_zone *zone = &zlo->zones[zone_no];
- unsigned long flags;
int ret = 0;
if (test_bit(ZLOOP_ZONE_CONV, &zone->flags))
@@ -488,10 +484,10 @@ static int zloop_finish_zone(struct zloop_device *zlo, unsigned int zone_no)
goto unlock;
}
- spin_lock_irqsave(&zone->wp_lock, flags);
+ spin_lock(&zone->wp_lock);
zloop_mark_full(zlo, zone);
clear_bit(ZLOOP_ZONE_SEQ_ERROR, &zone->flags);
- spin_unlock_irqrestore(&zone->wp_lock, flags);
+ spin_unlock(&zone->wp_lock);
unlock:
mutex_unlock(&zone->lock);
@@ -581,10 +577,9 @@ static int zloop_seq_write_prep(struct zloop_cmd *cmd)
bool is_append = req_op(rq) == REQ_OP_ZONE_APPEND;
struct zloop_zone *zone = &zlo->zones[zone_no];
sector_t zone_end = zone->start + zlo->zone_capacity;
- unsigned long flags;
int ret = 0;
- spin_lock_irqsave(&zone->wp_lock, flags);
+ spin_lock(&zone->wp_lock);
/*
* Zone append operations always go at the current write pointer, but
@@ -630,7 +625,7 @@ static int zloop_seq_write_prep(struct zloop_cmd *cmd)
zloop_mark_full(zlo, zone);
}
out_unlock:
- spin_unlock_irqrestore(&zone->wp_lock, flags);
+ spin_unlock(&zone->wp_lock);
return ret;
}
@@ -868,13 +863,12 @@ static bool zloop_set_zone_append_sector(struct request *rq)
struct zloop_zone *zone = &zlo->zones[zone_no];
sector_t zone_end = zone->start + zlo->zone_capacity;
sector_t nr_sectors = blk_rq_sectors(rq);
- unsigned long flags;
- spin_lock_irqsave(&zone->wp_lock, flags);
+ spin_lock(&zone->wp_lock);
if (zone->cond == BLK_ZONE_COND_FULL ||
zone->wp + nr_sectors > zone_end) {
- spin_unlock_irqrestore(&zone->wp_lock, flags);
+ spin_unlock(&zone->wp_lock);
return false;
}
@@ -883,7 +877,7 @@ static bool zloop_set_zone_append_sector(struct request *rq)
if (zone->wp >= zone_end)
zloop_mark_full(zlo, zone);
- spin_unlock_irqrestore(&zone->wp_lock, flags);
+ spin_unlock(&zone->wp_lock);
return true;
}
@@ -944,7 +938,6 @@ static int zloop_report_zones(struct gendisk *disk, sector_t sector,
struct zloop_device *zlo = disk->private_data;
struct blk_zone blkz = {};
unsigned int first, i;
- unsigned long flags;
int ret;
first = disk_zone_no(disk, sector);
@@ -968,9 +961,9 @@ static int zloop_report_zones(struct gendisk *disk, sector_t sector,
blkz.start = zone->start;
blkz.len = zlo->zone_size;
- spin_lock_irqsave(&zone->wp_lock, flags);
+ spin_lock(&zone->wp_lock);
blkz.wp = zone->wp;
- spin_unlock_irqrestore(&zone->wp_lock, flags);
+ spin_unlock(&zone->wp_lock);
blkz.cond = zone->cond;
if (test_bit(ZLOOP_ZONE_CONV, &zone->flags)) {
blkz.type = BLK_ZONE_TYPE_CONVENTIONAL;
--
2.53.0
next prev parent reply other threads:[~2026-04-14 8:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 8:17 zloop fixes Christoph Hellwig
2026-04-14 8:17 ` [PATCH 1/6] zloop: fix write pointer calculation in zloop_forget_cache Christoph Hellwig
2026-04-14 9:26 ` Damien Le Moal
2026-04-14 8:17 ` [PATCH 2/6] zloop: use vfs_truncate Christoph Hellwig
2026-04-14 9:26 ` Damien Le Moal
2026-04-14 8:17 ` [PATCH 3/6] zloop: improve the unaligned write pointer warning Christoph Hellwig
2026-04-14 9:27 ` Damien Le Moal
2026-04-14 8:17 ` [PATCH 4/6] zloop: set RQF_QUIET when completing requests on deleted devices Christoph Hellwig
2026-04-14 9:28 ` Damien Le Moal
2026-04-14 8:17 ` [PATCH 5/6] zloop: factor out zloop_mark_{full,empty} helpers Christoph Hellwig
2026-04-14 9:29 ` Damien Le Moal
2026-04-14 8:17 ` Christoph Hellwig [this message]
2026-04-14 9:30 ` [PATCH 6/6] zloop: remove irq-safe locking Damien Le Moal
2026-04-14 16:20 ` zloop fixes Johannes Thumshirn
2026-04-15 20:03 ` Jens Axboe
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=20260414081811.549755-7-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=dlemoal@kernel.org \
--cc=linux-block@vger.kernel.org \
/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