aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/blkdev.h
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2009-10-03 14:52:01 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-10-03 14:52:01 -0400
commitac481c20ef8f6c6f2be75d581863f40c43874ef7 (patch)
tree90512cadc1c9dea89c0a24149166d3ab464d065e /include/linux/blkdev.h
parent61f0c1dcaaac71faabac6ef7c839b29f20204bea (diff)
block: Topology ioctls
Not all users of the topology information want to use libblkid. Provide the topology information through bdev ioctls. Also clarify sector size comments for existing BLK ioctls. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r--include/linux/blkdev.h35
1 files changed, 30 insertions, 5 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index a7323930d2ba..25119041e034 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1081,25 +1081,37 @@ static inline unsigned int queue_physical_block_size(struct request_queue *q)
1081 return q->limits.physical_block_size; 1081 return q->limits.physical_block_size;
1082} 1082}
1083 1083
1084static inline int bdev_physical_block_size(struct block_device *bdev)
1085{
1086 return queue_physical_block_size(bdev_get_queue(bdev));
1087}
1088
1084static inline unsigned int queue_io_min(struct request_queue *q) 1089static inline unsigned int queue_io_min(struct request_queue *q)
1085{ 1090{
1086 return q->limits.io_min; 1091 return q->limits.io_min;
1087} 1092}
1088 1093
1094static inline int bdev_io_min(struct block_device *bdev)
1095{
1096 return queue_io_min(bdev_get_queue(bdev));
1097}
1098
1089static inline unsigned int queue_io_opt(struct request_queue *q) 1099static inline unsigned int queue_io_opt(struct request_queue *q)
1090{ 1100{
1091 return q->limits.io_opt; 1101 return q->limits.io_opt;
1092} 1102}
1093 1103
1104static inline int bdev_io_opt(struct block_device *bdev)
1105{
1106 return queue_io_opt(bdev_get_queue(bdev));
1107}
1108
1094static inline int queue_alignment_offset(struct request_queue *q) 1109static inline int queue_alignment_offset(struct request_queue *q)
1095{ 1110{
1096 if (q && q->limits.misaligned) 1111 if (q->limits.misaligned)
1097 return -1; 1112 return -1;
1098 1113
1099 if (q && q->limits.alignment_offset) 1114 return q->limits.alignment_offset;
1100 return q->limits.alignment_offset;
1101
1102 return 0;
1103} 1115}
1104 1116
1105static inline int queue_sector_alignment_offset(struct request_queue *q, 1117static inline int queue_sector_alignment_offset(struct request_queue *q,
@@ -1109,6 +1121,19 @@ static inline int queue_sector_alignment_offset(struct request_queue *q,
1109 & (q->limits.io_min - 1); 1121 & (q->limits.io_min - 1);
1110} 1122}
1111 1123
1124static inline int bdev_alignment_offset(struct block_device *bdev)
1125{
1126 struct request_queue *q = bdev_get_queue(bdev);
1127
1128 if (q->limits.misaligned)
1129 return -1;
1130
1131 if (bdev != bdev->bd_contains)
1132 return bdev->bd_part->alignment_offset;
1133
1134 return q->limits.alignment_offset;
1135}
1136
1112static inline int queue_dma_alignment(struct request_queue *q) 1137static inline int queue_dma_alignment(struct request_queue *q)
1113{ 1138{
1114 return q ? q->dma_alignment : 511; 1139 return q ? q->dma_alignment : 511;