mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
btrfs: use blkdev_report_zones_cached()
Modify btrfs_get_dev_zones() and btrfs_sb_log_location_bdev() to replace the call to blkdev_report_zones() with blkdev_report_zones_cached() to speed-up mount operations. btrfs_get_dev_zone_info() is also modified to take into account the BLK_ZONE_COND_ACTIVE condition, which is equivalent to either BLK_ZONE_COND_IMP_OPEN, BLK_ZONE_COND_EXP_OPEN or BLK_ZONE_COND_CLOSED. With this change, mounting a freshly formatted large capacity (30 TB) SMR HDD completes under 100ms compared to over 1.8s before. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Acked-by: David Sterba <dsterba@suse.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
1efbbc641e
commit
ad3c1188b4
@@ -264,8 +264,8 @@ static int btrfs_get_dev_zones(struct btrfs_device *device, u64 pos,
|
||||
}
|
||||
}
|
||||
|
||||
ret = blkdev_report_zones(device->bdev, pos >> SECTOR_SHIFT, *nr_zones,
|
||||
copy_zone_info_cb, zones);
|
||||
ret = blkdev_report_zones_cached(device->bdev, pos >> SECTOR_SHIFT,
|
||||
*nr_zones, copy_zone_info_cb, zones);
|
||||
if (ret < 0) {
|
||||
btrfs_err(device->fs_info,
|
||||
"zoned: failed to read zone %llu on %s (devid %llu)",
|
||||
@@ -494,6 +494,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
|
||||
case BLK_ZONE_COND_IMP_OPEN:
|
||||
case BLK_ZONE_COND_EXP_OPEN:
|
||||
case BLK_ZONE_COND_CLOSED:
|
||||
case BLK_ZONE_COND_ACTIVE:
|
||||
__set_bit(nreported, zone_info->active_zones);
|
||||
nactive++;
|
||||
break;
|
||||
@@ -896,9 +897,9 @@ int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw,
|
||||
if (sb_zone + 1 >= nr_zones)
|
||||
return -ENOENT;
|
||||
|
||||
ret = blkdev_report_zones(bdev, zone_start_sector(sb_zone, bdev),
|
||||
BTRFS_NR_SB_LOG_ZONES, copy_zone_info_cb,
|
||||
zones);
|
||||
ret = blkdev_report_zones_cached(bdev, zone_start_sector(sb_zone, bdev),
|
||||
BTRFS_NR_SB_LOG_ZONES,
|
||||
copy_zone_info_cb, zones);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (unlikely(ret != BTRFS_NR_SB_LOG_ZONES))
|
||||
|
||||
Reference in New Issue
Block a user