diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2010-01-11 03:21:51 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2010-01-11 08:30:09 -0500 |
commit | e03a72e13648ac6277bf2bab6b8324d51f89c0fa (patch) | |
tree | a01a2e072a5b225f22bd8bfa75f5270a527a4e4b /include | |
parent | ce289321b7dc1eb108e3df0dec872b7429ef49f7 (diff) |
block: Stop using byte offsets
All callers of the stacking functions use 512-byte sector units rather
than byte offsets. Simplify the code so the stacking functions take
sectors when specifying data offsets.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/blkdev.h | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 5c8018977efa..ffb13ad35716 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -1112,18 +1112,13 @@ static inline int queue_alignment_offset(struct request_queue *q) | |||
1112 | return q->limits.alignment_offset; | 1112 | return q->limits.alignment_offset; |
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t offset) | 1115 | static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector) |
1116 | { | 1116 | { |
1117 | unsigned int granularity = max(lim->physical_block_size, lim->io_min); | 1117 | unsigned int granularity = max(lim->physical_block_size, lim->io_min); |
1118 | unsigned int alignment = (sector << 9) & (granularity - 1); | ||
1118 | 1119 | ||
1119 | offset &= granularity - 1; | 1120 | return (granularity + lim->alignment_offset - alignment) |
1120 | return (granularity + lim->alignment_offset - offset) & (granularity - 1); | 1121 | & (granularity - 1); |
1121 | } | ||
1122 | |||
1123 | static inline int queue_sector_alignment_offset(struct request_queue *q, | ||
1124 | sector_t sector) | ||
1125 | { | ||
1126 | return queue_limit_alignment_offset(&q->limits, sector << 9); | ||
1127 | } | 1122 | } |
1128 | 1123 | ||
1129 | static inline int bdev_alignment_offset(struct block_device *bdev) | 1124 | static inline int bdev_alignment_offset(struct block_device *bdev) |
@@ -1147,10 +1142,8 @@ static inline int queue_discard_alignment(struct request_queue *q) | |||
1147 | return q->limits.discard_alignment; | 1142 | return q->limits.discard_alignment; |
1148 | } | 1143 | } |
1149 | 1144 | ||
1150 | static inline int queue_sector_discard_alignment(struct request_queue *q, | 1145 | static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector) |
1151 | sector_t sector) | ||
1152 | { | 1146 | { |
1153 | struct queue_limits *lim = &q->limits; | ||
1154 | unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); | 1147 | unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); |
1155 | 1148 | ||
1156 | return (lim->discard_granularity + lim->discard_alignment - alignment) | 1149 | return (lim->discard_granularity + lim->discard_alignment - alignment) |