diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/blkdev.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 784a919aa0d0..59b832be3044 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -1116,11 +1116,18 @@ static inline int queue_alignment_offset(struct request_queue *q) | |||
1116 | return q->limits.alignment_offset; | 1116 | return q->limits.alignment_offset; |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t offset) | ||
1120 | { | ||
1121 | unsigned int granularity = max(lim->physical_block_size, lim->io_min); | ||
1122 | |||
1123 | offset &= granularity - 1; | ||
1124 | return (granularity + lim->alignment_offset - offset) & (granularity - 1); | ||
1125 | } | ||
1126 | |||
1119 | static inline int queue_sector_alignment_offset(struct request_queue *q, | 1127 | static inline int queue_sector_alignment_offset(struct request_queue *q, |
1120 | sector_t sector) | 1128 | sector_t sector) |
1121 | { | 1129 | { |
1122 | return ((sector << 9) - q->limits.alignment_offset) | 1130 | return queue_limit_alignment_offset(&q->limits, sector << 9); |
1123 | & (q->limits.io_min - 1); | ||
1124 | } | 1131 | } |
1125 | 1132 | ||
1126 | static inline int bdev_alignment_offset(struct block_device *bdev) | 1133 | static inline int bdev_alignment_offset(struct block_device *bdev) |