From: Christoph Hellwig <hch@infradead.org>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
"Jens Axboe" <axboe@kernel.dk>, "Keith Busch" <kbusch@kernel.org>,
"Christoph Hellwig" <hch@infradead.org>,
"Sagi Grimberg" <sagi@grimberg.me>,
"Alan Adamson" <alan.adamson@oracle.com>,
virtualization@lists.linux.dev, asahi@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
"Michael S . Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Sven Peter" <sven@svenpeter.dev>, "Janne Grunau" <j@jannau.net>,
"Alyssa Rosenzweig" <alyssa@rosenzweig.io>
Subject: Re: [PATCH 2/2] block: change blk_mq_add_to_batch() third argument type to blk_status_t
Date: Tue, 11 Mar 2025 01:13:01 -0700 [thread overview]
Message-ID: <Z8_wjZUNvM7JAWAQ@infradead.org> (raw)
In-Reply-To: <20250311024144.1762333-3-shinichiro.kawasaki@wdc.com>
On Tue, Mar 11, 2025 at 11:41:44AM +0900, Shin'ichiro Kawasaki wrote:
> However, blk_mq_add_to_batch() callers do not pass negative error
> values. Instead, they pass status codes defined in various ways:
>
> - NVMe PCI and Apple drivers pass NVMe status code
> - virtio_blk driver passes the virtblk request header status byte
> - null_blk driver passes blk_status_t
The __force cast in null_blk should have been a big fat warning..
> To correct the ioerror check within blk_mq_add_to_batch(), make all
> callers to uniformly pass the argument as blk_status_t. Modify the
> callers to translate their specific status codes into blk_status_t. For
> this translation, export the helper function nvme_error_status(). Adjust
> blk_mq_add_to_batch() to translate blk_status_t back into the error
> number for the appropriate check.
This still looks a bit ugly because of all the conversions to a
blk_status_t just to convert it back to a errno just to check for
a non-zero value (blk_status_to_errno can't return a positive value).
I suspect simply passing a "bool is_error" might actually be cleaner
than that, combined with a proper kerneldoc comment for
blk_mq_add_to_batch explaining how to set it?
next prev parent reply other threads:[~2025-03-11 8:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-11 2:41 [PATCH 0/2] block: nvme: fix blktests nvme/039 failure Shin'ichiro Kawasaki
2025-03-11 2:41 ` [PATCH 1/2] nvme: move error logging from nvme_end_req() to __nvme_end_req() Shin'ichiro Kawasaki
2025-03-11 6:51 ` Hannes Reinecke
2025-03-11 8:06 ` Christoph Hellwig
2025-03-11 2:41 ` [PATCH 2/2] block: change blk_mq_add_to_batch() third argument type to blk_status_t Shin'ichiro Kawasaki
2025-03-11 5:02 ` Stefan Hajnoczi
2025-03-11 6:57 ` Hannes Reinecke
2025-03-11 8:13 ` Christoph Hellwig [this message]
2025-03-11 10:42 ` Shinichiro Kawasaki
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=Z8_wjZUNvM7JAWAQ@infradead.org \
--to=hch@infradead.org \
--cc=alan.adamson@oracle.com \
--cc=alyssa@rosenzweig.io \
--cc=asahi@lists.linux.dev \
--cc=axboe@kernel.dk \
--cc=eperezma@redhat.com \
--cc=j@jannau.net \
--cc=jasowang@redhat.com \
--cc=kbusch@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=sagi@grimberg.me \
--cc=shinichiro.kawasaki@wdc.com \
--cc=stefanha@redhat.com \
--cc=sven@svenpeter.dev \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/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