Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: dm-devel@lists.linux.dev,
	Andreas Gruenbacher <agruenba@redhat.com>,
	linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-block@vger.kernel.org, linux-bcache@vger.kernel.org,
	drbd-dev@lists.linbit.com
Subject: [PATCH 2/4] block: get rid of blk_status_to_{errno, str} inconsistency
Date: Wed,  4 Mar 2026 20:04:07 +0100	[thread overview]
Message-ID: <20260304190424.291743-3-agruenba@redhat.com> (raw)
In-Reply-To: <20260304190424.291743-1-agruenba@redhat.com>

Change blk_status_to_str() to be consistent with blk_status_to_errno()
and return "I/O" for undefined status codes.

With that, the fallback case in the blk_errors array can be removed with
no change in behavior.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 block/blk-core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 474700ffaa1c..a20042f15790 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -161,9 +161,6 @@ static const struct {
 	[BLK_STS_DURATION_LIMIT]	= { -ETIME, "duration limit exceeded" },
 
 	[BLK_STS_INVAL]		= { -EINVAL,	"invalid" },
-
-	/* everything else not covered above: */
-	[BLK_STS_IOERR]		= { -EIO,	"I/O" },
 };
 
 blk_status_t errno_to_blk_status(int errno)
@@ -194,7 +191,7 @@ const char *blk_status_to_str(blk_status_t status)
 	int idx = (__force int)status;
 
 	if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors)))
-		return "<null>";
+		return "I/O";
 	return blk_errors[idx].name;
 }
 EXPORT_SYMBOL_GPL(blk_status_to_str);
-- 
2.52.0


  parent reply	other threads:[~2026-03-04 19:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 19:04 [PATCH 0/4] simple bio cleanups Andreas Gruenbacher
2026-03-04 19:04 ` [PATCH 1/4] block: consecutive blk_status_t error codes Andreas Gruenbacher
2026-03-05 14:12   ` Christoph Hellwig
2026-03-05 22:36   ` John Garry
2026-03-04 19:04 ` Andreas Gruenbacher [this message]
2026-03-05 14:13   ` [PATCH 2/4] block: get rid of blk_status_to_{errno,str} inconsistency Christoph Hellwig
2026-03-06 15:51   ` John Garry
2026-03-04 19:04 ` [PATCH 3/4] bio: rename bio_chain arguments Andreas Gruenbacher
2026-03-04 19:04 ` [PATCH 4/4] bio: use bio_io_error more often Andreas Gruenbacher
2026-03-05 14:14   ` Christoph Hellwig
2026-03-05 18:37     ` Andreas Gruenbacher
2026-03-05 14:32   ` Coly Li
2026-03-13 12:53 ` [PATCH 0/4] simple bio cleanups Shinichiro Kawasaki
2026-03-13 14:35   ` Andreas Gruenbacher

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=20260304190424.291743-3-agruenba@redhat.com \
    --to=agruenba@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@lists.linux.dev \
    --cc=drbd-dev@lists.linbit.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.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