All block device data fields and functions returning a number of 512B sectors are by convention named xxx_sectors while names in the form xxx_size are generally used for a number of bytes. The blk_queue_zone_size and bdev_zone_size functions were not following this convention so rename them. No functional change is introduced by this patch. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Collapsed the two patches, they were nonsensically split and broke bisection.
Unified · Split
| @@ -16,7 +16,7 @@ · 15 unmodified lines | |||
| 16 | static inline sector_t blk_zone_start(struct request_queue *q, | 16 | static inline sector_t blk_zone_start(struct request_queue *q, |
| 17 | sector_t sector) | 17 | sector_t sector) |
| 18 | { | 18 | { |
| 19 | sector_t zone_mask = blk_queue_zone_size(q) - 1; | 19 | sector_t zone_mask = blk_queue_zone_sectors(q) - 1; |
| 20 | 20 | ||
| 21 | return sector & ~zone_mask; | 21 | return sector & ~zone_mask; |
| 22 | } | 22 | } |
| @@ -222,7 +222,7 @@ int blkdev_reset_zones(struct block_device *bdev, · 199 unmodified lines | |||
| 222 | return -EINVAL; | 222 | return -EINVAL; |
| 223 | 223 | ||
| 224 | /* Check alignment (handle eventual smaller last zone) */ | 224 | /* Check alignment (handle eventual smaller last zone) */ |
| 225 | zone_sectors = blk_queue_zone_size(q); | 225 | zone_sectors = blk_queue_zone_sectors(q); |
| 226 | if (sector & (zone_sectors - 1)) | 226 | if (sector & (zone_sectors - 1)) |
| 227 | return -EINVAL; | 227 | return -EINVAL; |
| 228 | 228 | ||
| @@ -434,7 +434,7 @@ static bool part_zone_aligned(struct gendisk *disk, · 433 unmodified lines | |||
| 434 | struct block_device *bdev, | 434 | struct block_device *bdev, |
| 435 | sector_t from, sector_t size) | 435 | sector_t from, sector_t size) |
| 436 | { | 436 | { |
| 437 | unsigned int zone_size = bdev_zone_size(bdev); | 437 | unsigned int zone_sectors = bdev_zone_sectors(bdev); |
| 438 | 438 | ||
| 439 | /* | 439 | /* |
| 440 | * If this function is called, then the disk is a zoned block device | 440 | * If this function is called, then the disk is a zoned block device |
| @@ -446,7 +446,7 @@ static bool part_zone_aligned(struct gendisk *disk, · 5 unmodified lines | |||
| 446 | * regular block devices (no zone operation) and their zone size will | 446 | * regular block devices (no zone operation) and their zone size will |
| 447 | * be reported as 0. Allow this case. | 447 | * be reported as 0. Allow this case. |
| 448 | */ | 448 | */ |
| 449 | if (!zone_size) | 449 | if (!zone_sectors) |
| 450 | return true; | 450 | return true; |
| 451 | 451 | ||
| 452 | /* | 452 | /* |
| @@ -455,24 +455,24 @@ static bool part_zone_aligned(struct gendisk *disk, · 2 unmodified lines | |||
| 455 | * use it. Check the zone size too: it should be a power of 2 number | 455 | * use it. Check the zone size too: it should be a power of 2 number |
| 456 | * of sectors. | 456 | * of sectors. |
| 457 | */ | 457 | */ |
| 458 | if (WARN_ON_ONCE(!is_power_of_2(zone_size))) { | 458 | if (WARN_ON_ONCE(!is_power_of_2(zone_sectors))) { |
| 459 | u32 rem; | 459 | u32 rem; |
| 460 | 460 | ||
| 461 | div_u64_rem(from, zone_size, &rem); | 461 | div_u64_rem(from, zone_sectors, &rem); |
| 462 | if (rem) | 462 | if (rem) |
| 463 | return false; | 463 | return false; |
| 464 | if ((from + size) < get_capacity(disk)) { | 464 | if ((from + size) < get_capacity(disk)) { |
| 465 | div_u64_rem(size, zone_size, &rem); | 465 | div_u64_rem(size, zone_sectors, &rem); |
| 466 | if (rem) | 466 | if (rem) |
| 467 | return false; | 467 | return false; |
| 468 | } | 468 | } |
| 469 | 469 | ||
| 470 | } else { | 470 | } else { |
| 471 | 471 | ||
| 472 | if (from & (zone_size - 1)) | 472 | if (from & (zone_sectors - 1)) |
| 473 | return false; | 473 | return false; |
| 474 | if ((from + size) < get_capacity(disk) && | 474 | if ((from + size) < get_capacity(disk) && |
| 475 | (size & (zone_size - 1))) | 475 | (size & (zone_sectors - 1))) |
| 476 | return false; | 476 | return false; |
| 477 | 477 | ||
| 478 | } | 478 | } |
| @@ -713,8 +713,8 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi, · 712 unmodified lines | |||
| 713 | } | 713 | } |
| 714 | sector = SECTOR_FROM_BLOCK(blkstart); | 714 | sector = SECTOR_FROM_BLOCK(blkstart); |
| 715 | 715 | ||
| 716 | if (sector & (bdev_zone_size(bdev) - 1) || | 716 | if (sector & (bdev_zone_sectors(bdev) - 1) || |
| 717 | nr_sects != bdev_zone_size(bdev)) { | 717 | nr_sects != bdev_zone_sectors(bdev)) { |
| 718 | f2fs_msg(sbi->sb, KERN_INFO, | 718 | f2fs_msg(sbi->sb, KERN_INFO, |
| 719 | "(%d) %s: Unaligned discard attempted (block %x + %x)", | 719 | "(%d) %s: Unaligned discard attempted (block %x + %x)", |
| 720 | devi, sbi->s_ndevs ? FDEV(devi).path: "", | 720 | devi, sbi->s_ndevs ? FDEV(devi).path: "", |
| @@ -1553,16 +1553,16 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi) · 1552 unmodified lines | |||
| 1553 | return 0; | 1553 | return 0; |
| 1554 | 1554 | ||
| 1555 | if (sbi->blocks_per_blkz && sbi->blocks_per_blkz != | 1555 | if (sbi->blocks_per_blkz && sbi->blocks_per_blkz != |
| 1556 | SECTOR_TO_BLOCK(bdev_zone_size(bdev))) | 1556 | SECTOR_TO_BLOCK(bdev_zone_sectors(bdev))) |
| 1557 | return -EINVAL; | 1557 | return -EINVAL; |
| 1558 | sbi->blocks_per_blkz = SECTOR_TO_BLOCK(bdev_zone_size(bdev)); | 1558 | sbi->blocks_per_blkz = SECTOR_TO_BLOCK(bdev_zone_sectors(bdev)); |
| 1559 | if (sbi->log_blocks_per_blkz && sbi->log_blocks_per_blkz != | 1559 | if (sbi->log_blocks_per_blkz && sbi->log_blocks_per_blkz != |
| 1560 | __ilog2_u32(sbi->blocks_per_blkz)) | 1560 | __ilog2_u32(sbi->blocks_per_blkz)) |
| 1561 | return -EINVAL; | 1561 | return -EINVAL; |
| 1562 | sbi->log_blocks_per_blkz = __ilog2_u32(sbi->blocks_per_blkz); | 1562 | sbi->log_blocks_per_blkz = __ilog2_u32(sbi->blocks_per_blkz); |
| 1563 | FDEV(devi).nr_blkz = SECTOR_TO_BLOCK(nr_sectors) >> | 1563 | FDEV(devi).nr_blkz = SECTOR_TO_BLOCK(nr_sectors) >> |
| 1564 | sbi->log_blocks_per_blkz; | 1564 | sbi->log_blocks_per_blkz; |
| 1565 | if (nr_sectors & (bdev_zone_size(bdev) - 1)) | 1565 | if (nr_sectors & (bdev_zone_sectors(bdev) - 1)) |
| 1566 | FDEV(devi).nr_blkz++; | 1566 | FDEV(devi).nr_blkz++; |
| 1567 | 1567 | ||
| 1568 | FDEV(devi).blkz_type = kmalloc(FDEV(devi).nr_blkz, GFP_KERNEL); | 1568 | FDEV(devi).blkz_type = kmalloc(FDEV(devi).nr_blkz, GFP_KERNEL); |
| @@ -739,7 +739,7 @@ static inline bool blk_queue_is_zoned(struct request_queue *q) · 738 unmodified lines | |||
| 739 | } | 739 | } |
| 740 | } | 740 | } |
| 741 | 741 | ||
| 742 | static inline unsigned int blk_queue_zone_size(struct request_queue *q) | 742 | static inline unsigned int blk_queue_zone_sectors(struct request_queue *q) |
| 743 | { | 743 | { |
| 744 | return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0; | 744 | return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0; |
| 745 | } | 745 | } |
| @@ -1536,12 +1536,12 @@ static inline bool bdev_is_zoned(struct block_device *bdev) · 790 unmodified lines | |||
| 1536 | return false; | 1536 | return false; |
| 1537 | } | 1537 | } |
| 1538 | 1538 | ||
| 1539 | static inline unsigned int bdev_zone_size(struct block_device *bdev) | 1539 | static inline unsigned int bdev_zone_sectors(struct block_device *bdev) |
| 1540 | { | 1540 | { |
| 1541 | struct request_queue *q = bdev_get_queue(bdev); | 1541 | struct request_queue *q = bdev_get_queue(bdev); |
| 1542 | 1542 | ||
| 1543 | if (q) | 1543 | if (q) |
| 1544 | return blk_queue_zone_size(q); | 1544 | return blk_queue_zone_sectors(q); |
| 1545 | 1545 | ||
| 1546 | return 0; | 1546 | return 0; |
| 1547 | } | 1547 | } |