]> git.baikalelectronics.ru Git - kernel.git/commitdiff
block: move bdev_alignment_offset and queue_limit_alignment_offset out of line
authorChristoph Hellwig <hch@lst.de>
Fri, 15 Apr 2022 04:52:49 +0000 (06:52 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Apr 2022 01:49:59 +0000 (19:49 -0600)
No need to inline these fairly larger helpers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20220415045258.199825-19-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-settings.c
include/linux/blkdev.h

index b83df3d2eebcaac76dccdbc6427c9f172012f28c..94410a13c0deef9db66a7886b81527156ad6a79f 100644 (file)
@@ -468,6 +468,16 @@ void blk_queue_io_opt(struct request_queue *q, unsigned int opt)
 }
 EXPORT_SYMBOL(blk_queue_io_opt);
 
+static int queue_limit_alignment_offset(struct queue_limits *lim,
+               sector_t sector)
+{
+       unsigned int granularity = max(lim->physical_block_size, lim->io_min);
+       unsigned int alignment = sector_div(sector, granularity >> SECTOR_SHIFT)
+               << SECTOR_SHIFT;
+
+       return (granularity + lim->alignment_offset - alignment) % granularity;
+}
+
 static unsigned int blk_round_down_sectors(unsigned int sectors, unsigned int lbs)
 {
        sectors = round_down(sectors, lbs >> SECTOR_SHIFT);
@@ -901,3 +911,16 @@ void blk_queue_set_zoned(struct gendisk *disk, enum blk_zoned_model model)
        }
 }
 EXPORT_SYMBOL_GPL(blk_queue_set_zoned);
+
+int bdev_alignment_offset(struct block_device *bdev)
+{
+       struct request_queue *q = bdev_get_queue(bdev);
+
+       if (q->limits.misaligned)
+               return -1;
+       if (bdev_is_partition(bdev))
+               return queue_limit_alignment_offset(&q->limits,
+                               bdev->bd_start_sect);
+       return q->limits.alignment_offset;
+}
+EXPORT_SYMBOL_GPL(bdev_alignment_offset);
index d5346e72e36450b90f98874fa693d22ed4b3622b..0a1795ac2627548a815876f9d770e9e503804857 100644 (file)
@@ -1251,26 +1251,7 @@ bdev_zone_write_granularity(struct block_device *bdev)
        return queue_zone_write_granularity(bdev_get_queue(bdev));
 }
 
-static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector)
-{
-       unsigned int granularity = max(lim->physical_block_size, lim->io_min);
-       unsigned int alignment = sector_div(sector, granularity >> SECTOR_SHIFT)
-               << SECTOR_SHIFT;
-
-       return (granularity + lim->alignment_offset - alignment) % granularity;
-}
-
-static inline int bdev_alignment_offset(struct block_device *bdev)
-{
-       struct request_queue *q = bdev_get_queue(bdev);
-
-       if (q->limits.misaligned)
-               return -1;
-       if (bdev_is_partition(bdev))
-               return queue_limit_alignment_offset(&q->limits,
-                               bdev->bd_start_sect);
-       return q->limits.alignment_offset;
-}
+int bdev_alignment_offset(struct block_device *bdev);
 
 static inline int queue_discard_alignment(const struct request_queue *q)
 {