History

block: Rename blk_queue_zone_size and bdev_zone_size

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.

Damien Le Moal committed 9 years ago

Commit f99e8641 parent b5a10c55 files · +17 −17Browse files

Unified · Split

5 files
  1. block/blk-zoned.c +2 −2
  2. block/partition-generic.c +7 −7
  3. fs/f2fs/segment.c +2 −2
  4. fs/f2fs/super.c +3 −3
  5. include/linux/blkdev.h +3 −3
block/blk-zoned.c+2−2
@@ -16,7 +16,7 @@ · 15 unmodified lines
1616 static inline sector_t blk_zone_start(struct request_queue *q,
1717 sector_t sector)
1818 {
19− sector_t zone_mask = blk_queue_zone_size(q) - 1;
19+ sector_t zone_mask = blk_queue_zone_sectors(q) - 1;
2020
2121 return sector & ~zone_mask;
2222 }
@@ -222,7 +222,7 @@ int blkdev_reset_zones(struct block_device *bdev, · 199 unmodified lines
222222 return -EINVAL;
223223
224224 /* Check alignment (handle eventual smaller last zone) */
225− zone_sectors = blk_queue_zone_size(q);
225+ zone_sectors = blk_queue_zone_sectors(q);
226226 if (sector & (zone_sectors - 1))
227227 return -EINVAL;
228228
block/partition-generic.c+7−7
@@ -434,7 +434,7 @@ static bool part_zone_aligned(struct gendisk *disk, · 433 unmodified lines
434434 struct block_device *bdev,
435435 sector_t from, sector_t size)
436436 {
437− unsigned int zone_size = bdev_zone_size(bdev);
437+ unsigned int zone_sectors = bdev_zone_sectors(bdev);
438438
439439 /*
440440 * 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
446446 * regular block devices (no zone operation) and their zone size will
447447 * be reported as 0. Allow this case.
448448 */
449− if (!zone_size)
449+ if (!zone_sectors)
450450 return true;
451451
452452 /*
@@ -455,24 +455,24 @@ static bool part_zone_aligned(struct gendisk *disk, · 2 unmodified lines
455455 * use it. Check the zone size too: it should be a power of 2 number
456456 * of sectors.
457457 */
458− if (WARN_ON_ONCE(!is_power_of_2(zone_size))) {
458+ if (WARN_ON_ONCE(!is_power_of_2(zone_sectors))) {
459459 u32 rem;
460460
461− div_u64_rem(from, zone_size, &rem);
461+ div_u64_rem(from, zone_sectors, &rem);
462462 if (rem)
463463 return false;
464464 if ((from + size) < get_capacity(disk)) {
465− div_u64_rem(size, zone_size, &rem);
465+ div_u64_rem(size, zone_sectors, &rem);
466466 if (rem)
467467 return false;
468468 }
469469
470470 } else {
471471
472− if (from & (zone_size - 1))
472+ if (from & (zone_sectors - 1))
473473 return false;
474474 if ((from + size) < get_capacity(disk) &&
475− (size & (zone_size - 1)))
475+ (size & (zone_sectors - 1)))
476476 return false;
477477
478478 }
fs/f2fs/segment.c+2−2
@@ -713,8 +713,8 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi, · 712 unmodified lines
713713 }
714714 sector = SECTOR_FROM_BLOCK(blkstart);
715715
716− if (sector & (bdev_zone_size(bdev) - 1) ||
717− nr_sects != bdev_zone_size(bdev)) {
716+ if (sector & (bdev_zone_sectors(bdev) - 1) ||
717+ nr_sects != bdev_zone_sectors(bdev)) {
718718 f2fs_msg(sbi->sb, KERN_INFO,
719719 "(%d) %s: Unaligned discard attempted (block %x + %x)",
720720 devi, sbi->s_ndevs ? FDEV(devi).path: "",
fs/f2fs/super.c+3−3
@@ -1553,16 +1553,16 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi) · 1552 unmodified lines
15531553 return 0;
15541554
15551555 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)))
15571557 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));
15591559 if (sbi->log_blocks_per_blkz && sbi->log_blocks_per_blkz !=
15601560 __ilog2_u32(sbi->blocks_per_blkz))
15611561 return -EINVAL;
15621562 sbi->log_blocks_per_blkz = __ilog2_u32(sbi->blocks_per_blkz);
15631563 FDEV(devi).nr_blkz = SECTOR_TO_BLOCK(nr_sectors) >>
15641564 sbi->log_blocks_per_blkz;
1565− if (nr_sectors & (bdev_zone_size(bdev) - 1))
1565+ if (nr_sectors & (bdev_zone_sectors(bdev) - 1))
15661566 FDEV(devi).nr_blkz++;
15671567
15681568 FDEV(devi).blkz_type = kmalloc(FDEV(devi).nr_blkz, GFP_KERNEL);
include/linux/blkdev.h+3−3
@@ -739,7 +739,7 @@ static inline bool blk_queue_is_zoned(struct request_queue *q) · 738 unmodified lines
739739 }
740740 }
741741
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)
743743 {
744744 return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0;
745745 }
@@ -1536,12 +1536,12 @@ static inline bool bdev_is_zoned(struct block_device *bdev) · 790 unmodified lines
15361536 return false;
15371537 }
15381538
1539−static inline unsigned int bdev_zone_size(struct block_device *bdev)
1539+static inline unsigned int bdev_zone_sectors(struct block_device *bdev)
15401540 {
15411541 struct request_queue *q = bdev_get_queue(bdev);
15421542
15431543 if (q)
1544− return blk_queue_zone_size(q);
1544+ return blk_queue_zone_sectors(q);
15451545
15461546 return 0;
15471547 }