linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	kernel test robot <lkp@intel.com>,
	Max Gurtovoy <mgurtovoy@nvidia.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Jens Axboe <axboe@kernel.dk>, Feng Li <lifeng1519@gmail.com>,
	Israel Rukshin <israelr@nvidia.com>,
	virtualization <virtualization@lists.linux-foundation.org>,
	linux-block@vger.kernel.org
Subject: Re: [PATCH] virtio_blk: corrent types for status handling
Date: Tue, 26 Oct 2021 12:41:47 +0800	[thread overview]
Message-ID: <CACGkMEucDHon_2uBqZpcSc8hNdOzJGRCz6U_ZmFaP6pbU5sBQw@mail.gmail.com> (raw)
In-Reply-To: <20211025075825.1603118-1-mst@redhat.com>

On Mon, Oct 25, 2021 at 3:59 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> virtblk_setup_cmd returns blk_status_t in an int, callers then assign it
> back to a blk_status_t variable. blk_status_t is either u32 or (more
> typically) u8 so it works, but is inelegant and causes sparse warnings.
>
> Pass the status in blk_status_t in a consistent way.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Fixes: b2c5221fd074 ("virtio-blk: avoid preallocating big SGL for data")
> Cc: Max Gurtovoy <mgurtovoy@nvidia.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Acked-by: Jason Wang <jasowang@redhat.com>

> ---
>  drivers/block/virtio_blk.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index c336d9bb9105..c7d05ff24084 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -208,8 +208,9 @@ static void virtblk_cleanup_cmd(struct request *req)
>                 kfree(bvec_virt(&req->special_vec));
>  }
>
> -static int virtblk_setup_cmd(struct virtio_device *vdev, struct request *req,
> -               struct virtblk_req *vbr)
> +static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev,
> +                                     struct request *req,
> +                                     struct virtblk_req *vbr)
>  {
>         bool unmap = false;
>         u32 type;
> @@ -317,14 +318,15 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx,
>         unsigned long flags;
>         unsigned int num;
>         int qid = hctx->queue_num;
> -       int err;
>         bool notify = false;
> +       blk_status_t status;
> +       int err;
>
>         BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems);
>
> -       err = virtblk_setup_cmd(vblk->vdev, req, vbr);
> -       if (unlikely(err))
> -               return err;
> +       status = virtblk_setup_cmd(vblk->vdev, req, vbr);
> +       if (unlikely(status))
> +               return status;
>
>         blk_mq_start_request(req);
>
> --
> MST
>


      parent reply	other threads:[~2021-10-26  4:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25  7:58 [PATCH] virtio_blk: corrent types for status handling Michael S. Tsirkin
2021-10-25  8:22 ` Stefan Hajnoczi
2021-10-25  8:24 ` Max Gurtovoy
2021-10-25  8:41   ` Christoph Hellwig
2021-10-26  4:41 ` Jason Wang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACGkMEucDHon_2uBqZpcSc8hNdOzJGRCz6U_ZmFaP6pbU5sBQw@mail.gmail.com \
    --to=jasowang@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=israelr@nvidia.com \
    --cc=lifeng1519@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mgurtovoy@nvidia.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).