diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2009-10-03 14:52:01 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-10-03 14:52:01 -0400 |
commit | ac481c20ef8f6c6f2be75d581863f40c43874ef7 (patch) | |
tree | 90512cadc1c9dea89c0a24149166d3ab464d065e /include | |
parent | 61f0c1dcaaac71faabac6ef7c839b29f20204bea (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')
-rw-r--r-- | include/linux/blkdev.h | 35 | ||||
-rw-r--r-- | include/linux/fs.h | 4 |
2 files changed, 34 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 | ||
1084 | static inline int bdev_physical_block_size(struct block_device *bdev) | ||
1085 | { | ||
1086 | return queue_physical_block_size(bdev_get_queue(bdev)); | ||
1087 | } | ||
1088 | |||
1084 | static inline unsigned int queue_io_min(struct request_queue *q) | 1089 | static 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 | ||
1094 | static inline int bdev_io_min(struct block_device *bdev) | ||
1095 | { | ||
1096 | return queue_io_min(bdev_get_queue(bdev)); | ||
1097 | } | ||
1098 | |||
1089 | static inline unsigned int queue_io_opt(struct request_queue *q) | 1099 | static 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 | ||
1104 | static inline int bdev_io_opt(struct block_device *bdev) | ||
1105 | { | ||
1106 | return queue_io_opt(bdev_get_queue(bdev)); | ||
1107 | } | ||
1108 | |||
1094 | static inline int queue_alignment_offset(struct request_queue *q) | 1109 | static 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 | ||
1105 | static inline int queue_sector_alignment_offset(struct request_queue *q, | 1117 | static 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 | ||
1124 | static 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 | |||
1112 | static inline int queue_dma_alignment(struct request_queue *q) | 1137 | static 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; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 2adaa2529f18..883eaacfd924 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -300,6 +300,10 @@ struct inodes_stat_t { | |||
300 | #define BLKTRACESTOP _IO(0x12,117) | 300 | #define BLKTRACESTOP _IO(0x12,117) |
301 | #define BLKTRACETEARDOWN _IO(0x12,118) | 301 | #define BLKTRACETEARDOWN _IO(0x12,118) |
302 | #define BLKDISCARD _IO(0x12,119) | 302 | #define BLKDISCARD _IO(0x12,119) |
303 | #define BLKIOMIN _IO(0x12,120) | ||
304 | #define BLKIOOPT _IO(0x12,121) | ||
305 | #define BLKALIGNOFF _IO(0x12,122) | ||
306 | #define BLKPBSZGET _IO(0x12,123) | ||
303 | 307 | ||
304 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ | 308 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ |
305 | #define FIBMAP _IO(0x00,1) /* bmap access */ | 309 | #define FIBMAP _IO(0x00,1) /* bmap access */ |