]> git.baikalelectronics.ru Git - kernel.git/commit
virtio-blk: Remove BUG_ON() in virtio_queue_rq()
authorXie Yongji <xieyongji@bytedance.com>
Fri, 4 Mar 2022 10:00:58 +0000 (18:00 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 6 Mar 2022 11:06:50 +0000 (06:06 -0500)
commitf6069ecb374a4818ad14a99b11cddca76c3b060e
tree70775c214722e94d19e491586189eccda4d12bdc
parentae20a1ed12be36a516b8531923461f60fb8c89dc
virtio-blk: Remove BUG_ON() in virtio_queue_rq()

Currently we have a BUG_ON() to make sure the number of sg
list does not exceed queue_max_segments() in virtio_queue_rq().
However, the block layer uses queue_max_discard_segments()
instead of queue_max_segments() to limit the sg list for
discard requests. So the BUG_ON() might be triggered if
virtio-blk device reports a larger value for max discard
segment than queue_max_segments(). To fix it, let's simply
remove the BUG_ON() which has become unnecessary after commit
7806a016514c("virtio-blk: avoid preallocating big SGL for data").
And the unused vblk->sg_elems can also be removed together.

Fixes: 17e8877ee072 ("virtio_blk: add discard and write zeroes support")
Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Link: https://lore.kernel.org/r/20220304100058.116-2-xieyongji@bytedance.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/block/virtio_blk.c