diff options
author | Ming Lei <ming.lei@redhat.com> | 2020-08-17 13:01:30 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-08-17 16:58:36 +0300 |
commit | bcb21c8cc9947286211327d663ace69f07d37a76 (patch) | |
tree | 37bafa8348d4fbbddcdbc024c57202022fa222a6 /include/linux/reboot.h | |
parent | d7d8535f377e9ba87edbf7fbbd634ac942f3f54f (diff) | |
download | linux-bcb21c8cc9947286211327d663ace69f07d37a76.tar.xz |
block: loop: set discard granularity and alignment for block device backed loop
In case of block device backend, if the backend supports write zeros, the
loop device will set queue flag of QUEUE_FLAG_DISCARD. However,
limits.discard_granularity isn't setup, and this way is wrong,
see the following description in Documentation/ABI/testing/sysfs-block:
A discard_granularity of 0 means that the device does not support
discard functionality.
Especially 9b15d109a6b2 ("block: improve discard bio alignment in
__blkdev_issue_discard()") starts to take q->limits.discard_granularity
for computing max discard sectors. And zero discard granularity may cause
kernel oops, or fail discard request even though the loop queue claims
discard support via QUEUE_FLAG_DISCARD.
Fix the issue by setup discard granularity and alignment.
Fixes: c52abf563049 ("loop: Better discard support for block devices")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Coly Li <colyli@suse.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Xiao Ni <xni@redhat.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Evan Green <evgreen@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Cc: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/reboot.h')
0 files changed, 0 insertions, 0 deletions