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>
This commit is contained in:
Kent Overstreet 2020-07-21 13:34:22 -04:00 committed by Kent Overstreet
parent a2b5313a39
commit 63b214e75b
6 changed files with 17 additions and 7 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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;
}

View file

@ -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),

View file

@ -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;

View file

@ -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);