]> git.baikalelectronics.ru Git - kernel.git/commitdiff
block: remove queue_discard_alignment
authorChristoph Hellwig <hch@lst.de>
Fri, 15 Apr 2022 04:52:50 +0000 (06:52 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Apr 2022 01:49:59 +0000 (19:49 -0600)
Just use bdev_alignment_offset in disk_discard_alignment_show instead.
That helpers is the same except for an always false branch that doesn't
matter in this slow path.

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-20-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/genhd.c
include/linux/blkdev.h

index 712031ce190706c04af75f353ce8aba8da35c969..36532b93184191e08f5ab8048ecb6ce99cfc33ee 100644 (file)
@@ -1019,7 +1019,7 @@ static ssize_t disk_discard_alignment_show(struct device *dev,
 {
        struct gendisk *disk = dev_to_disk(dev);
 
-       return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue));
+       return sprintf(buf, "%d\n", bdev_alignment_offset(disk->part0));
 }
 
 static ssize_t diskseq_show(struct device *dev,
index 0a1795ac2627548a815876f9d770e9e503804857..5a9b7aeda010b5e54cbca32b6fac561ae20e5dc6 100644 (file)
@@ -1253,14 +1253,6 @@ bdev_zone_write_granularity(struct block_device *bdev)
 
 int bdev_alignment_offset(struct block_device *bdev);
 
-static inline int queue_discard_alignment(const struct request_queue *q)
-{
-       if (q->limits.discard_misaligned)
-               return -1;
-
-       return q->limits.discard_alignment;
-}
-
 static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector)
 {
        unsigned int alignment, granularity, offset;