@@ -283,7 +283,8 @@ EXPORT_SYMBOL(blk_queue_max_hw_sectors);
void blk_queue_max_discard_sectors(struct request_queue *q,
unsigned int max_discard_sectors)
{
- q->limits.max_discard_sectors = max_discard_sectors;
+ q->limits.max_discard_sectors = min_t(unsigned int, max_discard_sectors,
+ BLK_DEF_MAX_DISCARD_SECTORS);
}
EXPORT_SYMBOL(blk_queue_max_discard_sectors);
@@ -1105,6 +1105,7 @@ enum blk_default_limits {
BLK_DEF_MAX_SECTORS = 1024,
BLK_MAX_SEGMENT_SIZE = 65536,
BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL,
+ BLK_DEF_MAX_DISCARD_SECTORS = UINT_MAX >> 9,
};
#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)