Skip to content

Commit

Permalink
nvme: set discard_alignment to zero
Browse files Browse the repository at this point in the history
Similar to 7c08428 ("rbd: set discard_alignment to zero"), NVMe
devices are currently incorrectly initialised with the block queue
discard_alignment set to the NVMe stream alignment.

As per Documentation/ABI/testing/sysfs-block:
  The discard_alignment parameter indicates how many bytes the beginning
  of the device is offset from the internal allocation unit's natural
  alignment.

Correcting the discard_alignment parameter to zero has no effect on how
discard requests are propagated through the block layer - @Alignment in
__blkdev_issue_discard() remains zero. However, it does fix other
consumers, such as LIO's Block Limits VPD response.

Signed-off-by: David Disseldorp <[email protected]>
Reviewed-by: Jens Axboe <[email protected]>
Reviewed-by: Martin K. Petersen <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
  • Loading branch information
ddiss authored and Christoph Hellwig committed Dec 15, 2017
1 parent fcf38cd commit b224f61
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ static void nvme_config_discard(struct nvme_ctrl *ctrl,
BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) <
NVME_DSM_MAX_RANGES);

queue->limits.discard_alignment = size;
queue->limits.discard_alignment = 0;
queue->limits.discard_granularity = size;

blk_queue_max_discard_sectors(queue, UINT_MAX);
Expand Down

0 comments on commit b224f61

Please sign in to comment.