Re: block: re-add discard_granularity and alignment checks

From: Jens Axboe
Date: Tue Oct 27 2015 - 20:14:16 EST

On 10/28/2015 06:23 AM, Ming Lin wrote:
On Thu, Oct 22, 2015 at 10:03 AM, Mike Snitzer <snitzer@xxxxxxxxxx> wrote:
On Thu, Oct 22 2015 at 12:59pm -0400,
Ming Lin <mlin@xxxxxxxxxx> wrote:

From: Ming Lin <ming.l@xxxxxxxxxxxxxxx>

In commit b49a087("block: remove split code in
blkdev_issue_{discard,write_same}"), discard_granularity and alignment
checks were removed. Ideally, with bio late splitting, the upper layers
shouldn't need to depend on device's limits.

Christoph reported a discard regression on the HGST Ultrastar SN100 NVMe
device when mkfs.xfs. We have not found the root cause yet.

This patch re-adds discard_granularity and alignment checks by reverting
the related changes in commit b49a087. The good thing is now we can
remove the 2G discard size cap and just use UINT_MAX to avoid bi_size

Reviewed-by: Christoph Hellwig <hch@xxxxxx>
Tested-by: Christoph Hellwig <hch@xxxxxx>
Signed-off-by: Ming Lin <ming.l@xxxxxxxxxxxxxxx>

Reviewed-by: Mike Snitzer <snitzer@xxxxxxxxxx>

Hi Jens,

Would you please take this one?

I was going to add it for 4.3, but hch just pointed out that it's a regression in this series. I'll send it in for 4.3.

Jens Axboe

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at