Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: refactor disk_zone_wplug_sync_wp_offset()

The helper function blk_zone_wp_offset() is called from
disk_zone_wplug_sync_wp_offset(), and again called from
blk_revalidate_seq_zone() right after the call to
disk_zone_wplug_sync_wp_offset().

Change disk_zone_wplug_sync_wp_offset() to return the value of obtained
with blk_zone_wp_offset() to avoid this double call, which simplifies a
little blk_revalidate_seq_zone().

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Damien Le Moal and committed by
Jens Axboe
e2b0ec77 bbac6e0f

+13 -14
+13 -14
block/blk-zoned.c
··· 817 817 } 818 818 } 819 819 820 - static void disk_zone_wplug_sync_wp_offset(struct gendisk *disk, 821 - struct blk_zone *zone) 820 + static unsigned int disk_zone_wplug_sync_wp_offset(struct gendisk *disk, 821 + struct blk_zone *zone) 822 822 { 823 823 struct blk_zone_wplug *zwplug; 824 - unsigned long flags; 824 + unsigned int wp_offset = blk_zone_wp_offset(zone); 825 825 826 826 zwplug = disk_get_zone_wplug(disk, zone->start); 827 - if (!zwplug) 828 - return; 827 + if (zwplug) { 828 + unsigned long flags; 829 829 830 - spin_lock_irqsave(&zwplug->lock, flags); 831 - if (zwplug->flags & BLK_ZONE_WPLUG_NEED_WP_UPDATE) 832 - disk_zone_wplug_set_wp_offset(disk, zwplug, 833 - blk_zone_wp_offset(zone)); 834 - spin_unlock_irqrestore(&zwplug->lock, flags); 830 + spin_lock_irqsave(&zwplug->lock, flags); 831 + if (zwplug->flags & BLK_ZONE_WPLUG_NEED_WP_UPDATE) 832 + disk_zone_wplug_set_wp_offset(disk, zwplug, wp_offset); 833 + spin_unlock_irqrestore(&zwplug->lock, flags); 834 + disk_put_zone_wplug(zwplug); 835 + } 835 836 836 - disk_put_zone_wplug(zwplug); 837 + return wp_offset; 837 838 } 838 839 839 840 /** ··· 2102 2101 if (!queue_emulates_zone_append(disk->queue) || !disk->zone_wplugs_hash) 2103 2102 return 0; 2104 2103 2105 - disk_zone_wplug_sync_wp_offset(disk, zone); 2106 - 2107 - wp_offset = blk_zone_wp_offset(zone); 2104 + wp_offset = disk_zone_wplug_sync_wp_offset(disk, zone); 2108 2105 if (!wp_offset || wp_offset >= zone->capacity) 2109 2106 return 0; 2110 2107