summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-07-21 13:34:22 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:43 -0400
commit63b214e75b1c941d3fc81da5b7fc4aa997e40873 (patch)
treeb3bb966218e4c869747396c674135090473b6ad6 /fs
parenta2b5313a39dfb0c027ef3f9d79efa531e1c0a736 (diff)
downloadlwn-63b214e75b1c941d3fc81da5b7fc4aa997e40873.tar.gz
lwn-63b214e75b1c941d3fc81da5b7fc4aa997e40873.zip
bcachefs: Add bch2_blk_status_to_str()
We define our own BLK_STS_REMOVED, so we need our own to_str helper too. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/btree_io.c4
-rw-r--r--fs/bcachefs/ec.c2
-rw-r--r--fs/bcachefs/io.c11
-rw-r--r--fs/bcachefs/io.h2
-rw-r--r--fs/bcachefs/journal_io.c3
-rw-r--r--fs/bcachefs/super-io.c2
6 files changed, 17 insertions, 7 deletions
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index a7d150811f7a..c8870a15a44f 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -1149,7 +1149,7 @@ static void btree_node_read_work(struct work_struct *work)
}
start:
bch2_dev_io_err_on(bio->bi_status, ca, "btree read: %s",
- blk_status_to_str(bio->bi_status));
+ bch2_blk_status_to_str(bio->bi_status));
if (rb->have_ioref)
percpu_ref_put(&ca->io_ref);
rb->have_ioref = false;
@@ -1435,7 +1435,7 @@ static void btree_node_write_endio(struct bio *bio)
bch2_latency_acct(ca, wbio->submit_time, WRITE);
if (bch2_dev_io_err_on(bio->bi_status, ca, "btree write: %s",
- blk_status_to_str(bio->bi_status)) ||
+ bch2_blk_status_to_str(bio->bi_status)) ||
bch2_meta_write_fault("btree")) {
spin_lock_irqsave(&c->btree_write_error_lock, flags);
bch2_dev_list_add_dev(&orig->failed, wbio->dev);
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index 54a95edc9901..8c04e7ced88b 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -328,7 +328,7 @@ static void ec_block_endio(struct bio *bio)
if (bch2_dev_io_err_on(bio->bi_status, ca, "erasure coding %s: %s",
bio_data_dir(bio) ? "write" : "read",
- blk_status_to_str(bio->bi_status)))
+ bch2_blk_status_to_str(bio->bi_status)))
clear_bit(ec_bio->idx, ec_bio->buf->valid);
bio_put(&ec_bio->bio);
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index ae2688d3aee6..7e57ca2e1071 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -34,6 +34,13 @@
#include <linux/random.h>
#include <linux/sched/mm.h>
+const char *bch2_blk_status_to_str(blk_status_t status)
+{
+ if (status == BLK_STS_REMOVED)
+ return "device removed";
+ return blk_status_to_str(status);
+}
+
#ifndef CONFIG_BCACHEFS_NO_LATENCY_ACCT
static bool bch2_target_congested(struct bch_fs *c, u16 target)
@@ -626,7 +633,7 @@ static void bch2_write_endio(struct bio *bio)
struct bch_dev *ca = bch_dev_bkey_exists(c, wbio->dev);
if (bch2_dev_io_err_on(bio->bi_status, ca, "data write: %s",
- blk_status_to_str(bio->bi_status)))
+ bch2_blk_status_to_str(bio->bi_status)))
set_bit(wbio->dev, op->failed.d);
if (wbio->have_ioref) {
@@ -1921,7 +1928,7 @@ static void bch2_read_endio(struct bio *bio)
rbio->bio.bi_end_io = rbio->end_io;
if (bch2_dev_io_err_on(bio->bi_status, ca, "data read; %s",
- blk_status_to_str(bio->bi_status))) {
+ bch2_blk_status_to_str(bio->bi_status))) {
bch2_rbio_error(rbio, READ_RETRY_AVOID, bio->bi_status);
return;
}
diff --git a/fs/bcachefs/io.h b/fs/bcachefs/io.h
index b8fbfef29176..be4aa3875360 100644
--- a/fs/bcachefs/io.h
+++ b/fs/bcachefs/io.h
@@ -26,6 +26,8 @@ void bch2_submit_wbio_replicas(struct bch_write_bio *, struct bch_fs *,
#define BLK_STS_REMOVED ((__force blk_status_t)128)
+const char *bch2_blk_status_to_str(blk_status_t);
+
enum bch_write_flags {
BCH_WRITE_ALLOC_NOWAIT = (1 << 0),
BCH_WRITE_CACHED = (1 << 1),
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index a4c2b80e8aa5..1e505f294095 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -6,6 +6,7 @@
#include "buckets.h"
#include "checksum.h"
#include "error.h"
+#include "io.h"
#include "journal.h"
#include "journal_io.h"
#include "journal_reclaim.h"
@@ -961,7 +962,7 @@ static void journal_write_endio(struct bio *bio)
struct journal *j = &ca->fs->journal;
if (bch2_dev_io_err_on(bio->bi_status, ca, "journal write: %s",
- blk_status_to_str(bio->bi_status)) ||
+ bch2_blk_status_to_str(bio->bi_status)) ||
bch2_meta_write_fault("journal")) {
struct journal_buf *w = journal_prev_buf(j);
unsigned long flags;
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index 0913ffd23776..5406315340e1 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -641,7 +641,7 @@ static void write_super_endio(struct bio *bio)
/* XXX: return errors directly */
if (bch2_dev_io_err_on(bio->bi_status, ca, "superblock write: %s",
- blk_status_to_str(bio->bi_status)))
+ bch2_blk_status_to_str(bio->bi_status)))
ca->sb_write_error = 1;
closure_put(&ca->fs->sb_write);