aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/blkdev.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 9b98173a8184..a41bcc8e140f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1148,8 +1148,11 @@ static inline int queue_discard_alignment(struct request_queue *q)
1148static inline int queue_sector_discard_alignment(struct request_queue *q, 1148static inline int queue_sector_discard_alignment(struct request_queue *q,
1149 sector_t sector) 1149 sector_t sector)
1150{ 1150{
1151 return ((sector << 9) - q->limits.discard_alignment) 1151 struct queue_limits *lim = &q->limits;
1152 & (q->limits.discard_granularity - 1); 1152 unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1);
1153
1154 return (lim->discard_granularity + lim->discard_alignment - alignment)
1155 & (lim->discard_granularity - 1);
1153} 1156}
1154 1157
1155static inline unsigned int queue_discard_zeroes_data(struct request_queue *q) 1158static inline unsigned int queue_discard_zeroes_data(struct request_queue *q)