Lots of devices exhibit very high latencies for big discards, hurting
reads and writes. By default, limit the max discard we will build to
64MB. This value has shown good results across a number of devices.
This will potentially hurt discard throughput, from a provisioning
point of view (when the user does mkfs.xfs, for instance, and mkfs
issues a full device discard). If that becomes an issue, we could
have different behavior for provisioning vs runtime discards.
Signed-off-by: Jens Axboe <axboe@fb.com>
{
q->limits.max_hw_discard_sectors = max_discard_sectors;
q->limits.max_discard_sectors = max_discard_sectors;
+ if (q->limits.max_discard_sectors > BLK_DISCARD_MAX_SECTORS)
+ q->limits.max_discard_sectors = BLK_DISCARD_MAX_SECTORS;
}
EXPORT_SYMBOL(blk_queue_max_discard_sectors);
BLK_SAFE_MAX_SECTORS = 255,
BLK_MAX_SEGMENT_SIZE = 65536,
BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL,
+
+ /*
+ * Default to max 64MB of discards, to keep latencies in check
+ */
+ BLK_DISCARD_MAX_SECTORS = (64 * 1024 * 1024UL) >> 9,
};
#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)