Commit 63b214e7 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent a2b5313a
...@@ -1149,7 +1149,7 @@ static void btree_node_read_work(struct work_struct *work) ...@@ -1149,7 +1149,7 @@ static void btree_node_read_work(struct work_struct *work)
} }
start: start:
bch2_dev_io_err_on(bio->bi_status, ca, "btree read: %s", 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) if (rb->have_ioref)
percpu_ref_put(&ca->io_ref); percpu_ref_put(&ca->io_ref);
rb->have_ioref = false; rb->have_ioref = false;
...@@ -1435,7 +1435,7 @@ static void btree_node_write_endio(struct bio *bio) ...@@ -1435,7 +1435,7 @@ static void btree_node_write_endio(struct bio *bio)
bch2_latency_acct(ca, wbio->submit_time, WRITE); bch2_latency_acct(ca, wbio->submit_time, WRITE);
if (bch2_dev_io_err_on(bio->bi_status, ca, "btree write: %s", 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")) { bch2_meta_write_fault("btree")) {
spin_lock_irqsave(&c->btree_write_error_lock, flags); spin_lock_irqsave(&c->btree_write_error_lock, flags);
bch2_dev_list_add_dev(&orig->failed, wbio->dev); bch2_dev_list_add_dev(&orig->failed, wbio->dev);
......
...@@ -328,7 +328,7 @@ static void ec_block_endio(struct bio *bio) ...@@ -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", if (bch2_dev_io_err_on(bio->bi_status, ca, "erasure coding %s: %s",
bio_data_dir(bio) ? "write" : "read", 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); clear_bit(ec_bio->idx, ec_bio->buf->valid);
bio_put(&ec_bio->bio); bio_put(&ec_bio->bio);
......
...@@ -34,6 +34,13 @@ ...@@ -34,6 +34,13 @@
#include <linux/random.h> #include <linux/random.h>
#include <linux/sched/mm.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 #ifndef CONFIG_BCACHEFS_NO_LATENCY_ACCT
static bool bch2_target_congested(struct bch_fs *c, u16 target) static bool bch2_target_congested(struct bch_fs *c, u16 target)
...@@ -626,7 +633,7 @@ static void bch2_write_endio(struct bio *bio) ...@@ -626,7 +633,7 @@ static void bch2_write_endio(struct bio *bio)
struct bch_dev *ca = bch_dev_bkey_exists(c, wbio->dev); struct bch_dev *ca = bch_dev_bkey_exists(c, wbio->dev);
if (bch2_dev_io_err_on(bio->bi_status, ca, "data write: %s", 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); set_bit(wbio->dev, op->failed.d);
if (wbio->have_ioref) { if (wbio->have_ioref) {
...@@ -1921,7 +1928,7 @@ static void bch2_read_endio(struct bio *bio) ...@@ -1921,7 +1928,7 @@ static void bch2_read_endio(struct bio *bio)
rbio->bio.bi_end_io = rbio->end_io; rbio->bio.bi_end_io = rbio->end_io;
if (bch2_dev_io_err_on(bio->bi_status, ca, "data read; %s", 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); bch2_rbio_error(rbio, READ_RETRY_AVOID, bio->bi_status);
return; return;
} }
......
...@@ -26,6 +26,8 @@ void bch2_submit_wbio_replicas(struct bch_write_bio *, struct bch_fs *, ...@@ -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) #define BLK_STS_REMOVED ((__force blk_status_t)128)
const char *bch2_blk_status_to_str(blk_status_t);
enum bch_write_flags { enum bch_write_flags {
BCH_WRITE_ALLOC_NOWAIT = (1 << 0), BCH_WRITE_ALLOC_NOWAIT = (1 << 0),
BCH_WRITE_CACHED = (1 << 1), BCH_WRITE_CACHED = (1 << 1),
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "buckets.h" #include "buckets.h"
#include "checksum.h" #include "checksum.h"
#include "error.h" #include "error.h"
#include "io.h"
#include "journal.h" #include "journal.h"
#include "journal_io.h" #include "journal_io.h"
#include "journal_reclaim.h" #include "journal_reclaim.h"
...@@ -961,7 +962,7 @@ static void journal_write_endio(struct bio *bio) ...@@ -961,7 +962,7 @@ static void journal_write_endio(struct bio *bio)
struct journal *j = &ca->fs->journal; struct journal *j = &ca->fs->journal;
if (bch2_dev_io_err_on(bio->bi_status, ca, "journal write: %s", 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")) { bch2_meta_write_fault("journal")) {
struct journal_buf *w = journal_prev_buf(j); struct journal_buf *w = journal_prev_buf(j);
unsigned long flags; unsigned long flags;
......
...@@ -641,7 +641,7 @@ static void write_super_endio(struct bio *bio) ...@@ -641,7 +641,7 @@ static void write_super_endio(struct bio *bio)
/* XXX: return errors directly */ /* XXX: return errors directly */
if (bch2_dev_io_err_on(bio->bi_status, ca, "superblock write: %s", 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; ca->sb_write_error = 1;
closure_put(&ca->fs->sb_write); closure_put(&ca->fs->sb_write);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment