]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
block: make sure discard bio is aligned with logical block size
authorMing Lei <ming.lei@redhat.com>
Mon, 29 Oct 2018 12:57:17 +0000 (20:57 +0800)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:58:02 +0000 (19:58 -0600)
commitb515257f186e532e0668f7deabcb04b5d27505cf
tree20a64693cc70bf5fb1101562e1148ed3a227bc08
parent3c2f83d8bcbedeb89efcaf55ae64a99dce9d7e34
block: make sure discard bio is aligned with logical block size

BugLink: https://bugs.launchpad.net/bugs/1836802
commit 1adfc5e4136f5967d591c399aff95b3b035f16b7 upstream.

Obviously the created discard bio has to be aligned with logical block size.

This patch introduces the helper of bio_allowed_max_sectors() for
this purpose.

Cc: stable@vger.kernel.org
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Xiao Ni <xni@redhat.com>
Cc: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Fixes: 744889b7cbb56a6 ("block: don't deal with discard limit in blkdev_issue_discard()")
Fixes: a22c4d7e34402cc ("block: re-add discard_granularity and alignment checks")
Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
block/blk-lib.c
block/blk-merge.c
block/blk.h