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>
                }
 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;
                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);
 
 
        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);
 
 #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)
        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) {
                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;
        }
 
 
 #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),
 
 #include "buckets.h"
 #include "checksum.h"
 #include "error.h"
+#include "io.h"
 #include "journal.h"
 #include "journal_io.h"
 #include "journal_reclaim.h"
        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;
 
        /* 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);