Stefan Hajnoczi
2022-Apr-20 14:54 UTC
[PATCH 1/4] virtio-blk: remove additional check in fast path
On Tue, Apr 19, 2022 at 09:10:50PM -0700, Chaitanya Kulkarni wrote:> The function virtblk_setup_cmd() calls > virtblk_setup_discard_write_zeroes() once we process the block layer > request operation setup in the switch. Even though it saves duplicate > call for REQ_OP_DISCARD and REQ_OP_WRITE_ZEROES it adds additional check > in the fast path that is redundent since we already have a switch case > for both REQ_OP_DISCARD and REQ_OP_WRITE_ZEROES. > > Move the call virtblk_setup_discard_write_zeroes() into switch case > label of REQ_OP_DISCARD and REQ_OP_WRITE_ZEROES and avoid duplicate > branch in the fast path. > > Signed-off-by: Chaitanya Kulkarni <kch at nvidia.com> > --- > drivers/block/virtio_blk.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-)Is there data that shows the performance effect of moving the code out of the fast path?> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c > index 6ccf15253dee..b77711e73422 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -223,10 +223,14 @@ static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev, > break; > case REQ_OP_DISCARD: > type = VIRTIO_BLK_T_DISCARD; > + if (virtblk_setup_discard_write_zeroes(req, unmap))unmap is never true here. The variable obscures what is going on: s/unmap/false/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: not available URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20220420/2a02e30d/attachment.sig>