aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/blkdev.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r--include/linux/blkdev.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 5c8018977efa..f71f5c58620c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -463,6 +463,7 @@ struct request_queue
463#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ 463#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */
464#define QUEUE_FLAG_CQ 16 /* hardware does queuing */ 464#define QUEUE_FLAG_CQ 16 /* hardware does queuing */
465#define QUEUE_FLAG_DISCARD 17 /* supports DISCARD */ 465#define QUEUE_FLAG_DISCARD 17 /* supports DISCARD */
466#define QUEUE_FLAG_NOXMERGES 18 /* No extended merges */
466 467
467#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 468#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
468 (1 << QUEUE_FLAG_CLUSTER) | \ 469 (1 << QUEUE_FLAG_CLUSTER) | \
@@ -589,6 +590,8 @@ enum {
589#define blk_queue_queuing(q) test_bit(QUEUE_FLAG_CQ, &(q)->queue_flags) 590#define blk_queue_queuing(q) test_bit(QUEUE_FLAG_CQ, &(q)->queue_flags)
590#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 591#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
591#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 592#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
593#define blk_queue_noxmerges(q) \
594 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags)
592#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) 595#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
593#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) 596#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
594#define blk_queue_flushing(q) ((q)->ordseq) 597#define blk_queue_flushing(q) ((q)->ordseq)
@@ -1112,18 +1115,13 @@ static inline int queue_alignment_offset(struct request_queue *q)
1112 return q->limits.alignment_offset; 1115 return q->limits.alignment_offset;
1113} 1116}
1114 1117
1115static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t offset) 1118static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector)
1116{ 1119{
1117 unsigned int granularity = max(lim->physical_block_size, lim->io_min); 1120 unsigned int granularity = max(lim->physical_block_size, lim->io_min);
1121 unsigned int alignment = (sector << 9) & (granularity - 1);
1118 1122
1119 offset &= granularity - 1; 1123 return (granularity + lim->alignment_offset - alignment)
1120 return (granularity + lim->alignment_offset - offset) & (granularity - 1); 1124 & (granularity - 1);
1121}
1122
1123static 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} 1125}
1128 1126
1129static inline int bdev_alignment_offset(struct block_device *bdev) 1127static inline int bdev_alignment_offset(struct block_device *bdev)
@@ -1147,10 +1145,8 @@ static inline int queue_discard_alignment(struct request_queue *q)
1147 return q->limits.discard_alignment; 1145 return q->limits.discard_alignment;
1148} 1146}
1149 1147
1150static inline int queue_sector_discard_alignment(struct request_queue *q, 1148static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector)
1151 sector_t sector)
1152{ 1149{
1153 struct queue_limits *lim = &q->limits;
1154 unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); 1150 unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1);
1155 1151
1156 return (lim->discard_granularity + lim->discard_alignment - alignment) 1152 return (lim->discard_granularity + lim->discard_alignment - alignment)