Skip to content

Commit b7cbc30

Browse files
damien-lemoalaxboe
authored andcommitted
block: rename struct gendisk zone_wplugs_lock field
Rename struct gendisk zone_wplugs_lock field to zone_wplugs_hash_lock to clearly indicates that this is the spinlock used for manipulating the hash table of zone write plugs. Signed-off-by: Damien Le Moal <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent c30e8c4 commit b7cbc30

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

block/blk-zoned.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,11 @@ static bool disk_insert_zone_wplug(struct gendisk *disk,
514514
* are racing with other submission context, so we may already have a
515515
* zone write plug for the same zone.
516516
*/
517-
spin_lock_irqsave(&disk->zone_wplugs_lock, flags);
517+
spin_lock_irqsave(&disk->zone_wplugs_hash_lock, flags);
518518
hlist_for_each_entry_rcu(zwplg, &disk->zone_wplugs_hash[idx], node) {
519519
if (zwplg->zone_no == zwplug->zone_no) {
520-
spin_unlock_irqrestore(&disk->zone_wplugs_lock, flags);
520+
spin_unlock_irqrestore(&disk->zone_wplugs_hash_lock,
521+
flags);
521522
return false;
522523
}
523524
}
@@ -529,15 +530,15 @@ static bool disk_insert_zone_wplug(struct gendisk *disk,
529530
* necessarilly in the active condition.
530531
*/
531532
zones_cond = rcu_dereference_check(disk->zones_cond,
532-
lockdep_is_held(&disk->zone_wplugs_lock));
533+
lockdep_is_held(&disk->zone_wplugs_hash_lock));
533534
if (zones_cond)
534535
zwplug->cond = zones_cond[zwplug->zone_no];
535536
else
536537
zwplug->cond = BLK_ZONE_COND_ACTIVE;
537538

538539
hlist_add_head_rcu(&zwplug->node, &disk->zone_wplugs_hash[idx]);
539540
atomic_inc(&disk->nr_zone_wplugs);
540-
spin_unlock_irqrestore(&disk->zone_wplugs_lock, flags);
541+
spin_unlock_irqrestore(&disk->zone_wplugs_hash_lock, flags);
541542

542543
return true;
543544
}
@@ -590,13 +591,13 @@ static void disk_free_zone_wplug(struct blk_zone_wplug *zwplug)
590591
WARN_ON_ONCE(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED);
591592
WARN_ON_ONCE(!bio_list_empty(&zwplug->bio_list));
592593

593-
spin_lock_irqsave(&disk->zone_wplugs_lock, flags);
594+
spin_lock_irqsave(&disk->zone_wplugs_hash_lock, flags);
594595
blk_zone_set_cond(rcu_dereference_check(disk->zones_cond,
595-
lockdep_is_held(&disk->zone_wplugs_lock)),
596+
lockdep_is_held(&disk->zone_wplugs_hash_lock)),
596597
zwplug->zone_no, zwplug->cond);
597598
hlist_del_init_rcu(&zwplug->node);
598599
atomic_dec(&disk->nr_zone_wplugs);
599-
spin_unlock_irqrestore(&disk->zone_wplugs_lock, flags);
600+
spin_unlock_irqrestore(&disk->zone_wplugs_hash_lock, flags);
600601

601602
call_rcu(&zwplug->rcu_head, disk_free_zone_wplug_rcu);
602603
}
@@ -1739,7 +1740,7 @@ static void blk_zone_wplug_bio_work(struct work_struct *work)
17391740

17401741
void disk_init_zone_resources(struct gendisk *disk)
17411742
{
1742-
spin_lock_init(&disk->zone_wplugs_lock);
1743+
spin_lock_init(&disk->zone_wplugs_hash_lock);
17431744
}
17441745

17451746
/*
@@ -1829,10 +1830,10 @@ static void disk_set_zones_cond_array(struct gendisk *disk, u8 *zones_cond)
18291830
{
18301831
unsigned long flags;
18311832

1832-
spin_lock_irqsave(&disk->zone_wplugs_lock, flags);
1833+
spin_lock_irqsave(&disk->zone_wplugs_hash_lock, flags);
18331834
zones_cond = rcu_replace_pointer(disk->zones_cond, zones_cond,
1834-
lockdep_is_held(&disk->zone_wplugs_lock));
1835-
spin_unlock_irqrestore(&disk->zone_wplugs_lock, flags);
1835+
lockdep_is_held(&disk->zone_wplugs_hash_lock));
1836+
spin_unlock_irqrestore(&disk->zone_wplugs_hash_lock, flags);
18361837

18371838
kfree_rcu_mightsleep(zones_cond);
18381839
}

include/linux/blkdev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ struct gendisk {
200200
u8 __rcu *zones_cond;
201201
unsigned int zone_wplugs_hash_bits;
202202
atomic_t nr_zone_wplugs;
203-
spinlock_t zone_wplugs_lock;
203+
spinlock_t zone_wplugs_hash_lock;
204204
struct mempool *zone_wplugs_pool;
205205
struct hlist_head *zone_wplugs_hash;
206206
struct workqueue_struct *zone_wplugs_wq;

0 commit comments

Comments
 (0)