diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/blkdev.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4afa4f8f6090..a693c6d29328 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1232,10 +1232,9 @@ static inline int queue_alignment_offset(struct request_queue *q) 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 << 9) & (granularity - 1); + unsigned int alignment = sector_div(sector, granularity >> 9) << 9; - return (granularity + lim->alignment_offset - alignment) - & (granularity - 1); + return (granularity + lim->alignment_offset - alignment) % granularity; } static inline int bdev_alignment_offset(struct block_device *bdev) |