summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2010-01-11 03:21:51 -0500
committerJens Axboe <jens.axboe@oracle.com>2010-01-11 14:30:09 +0100
commite03a72e13648ac6277bf2bab6b8324d51f89c0fa (patch)
treea01a2e072a5b225f22bd8bfa75f5270a527a4e4b /include/linux
parentce289321b7dc1eb108e3df0dec872b7429ef49f7 (diff)
downloadblackbird-op-linux-e03a72e13648ac6277bf2bab6b8324d51f89c0fa.tar.gz
blackbird-op-linux-e03a72e13648ac6277bf2bab6b8324d51f89c0fa.zip
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/linux')
-rw-r--r--include/linux/blkdev.h17
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)
return q->limits.alignment_offset;
}
-static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t offset)
+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);
- offset &= granularity - 1;
- return (granularity + lim->alignment_offset - offset) & (granularity - 1);
-}
-
-static inline int queue_sector_alignment_offset(struct request_queue *q,
- sector_t sector)
-{
- return queue_limit_alignment_offset(&q->limits, sector << 9);
+ return (granularity + lim->alignment_offset - alignment)
+ & (granularity - 1);
}
static inline int bdev_alignment_offset(struct block_device *bdev)
@@ -1147,10 +1142,8 @@ static inline int queue_discard_alignment(struct request_queue *q)
return q->limits.discard_alignment;
}
-static inline int queue_sector_discard_alignment(struct request_queue *q,
- sector_t sector)
+static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector)
{
- struct queue_limits *lim = &q->limits;
unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1);
return (lim->discard_granularity + lim->discard_alignment - alignment)
OpenPOWER on IntegriCloud