Users have been asking for this, and now that errors are returned to the
top level read retry path - we can.

Signed-off-by: Kent Overstreet <[email protected]>
---
 fs/bcachefs/io_read.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/fs/bcachefs/io_read.c b/fs/bcachefs/io_read.c
index 8764e88ef574..61fb3e558450 100644
--- a/fs/bcachefs/io_read.c
+++ b/fs/bcachefs/io_read.c
@@ -488,6 +488,9 @@ static void bch2_rbio_retry(struct work_struct *work)
                rbio->ret               = 0;
        }
 
+       unsigned subvol         = rbio->subvol;
+       struct bpos read_pos    = rbio->read_pos;
+
        rbio = bch2_rbio_free(rbio);
 
        flags |= BCH_READ_in_retry;
@@ -502,6 +505,19 @@ static void bch2_rbio_retry(struct work_struct *work)
        if (ret) {
                rbio->ret = ret;
                rbio->bio.bi_status = BLK_STS_IOERR;
+       } else {
+               struct printbuf buf = PRINTBUF;
+
+               bch2_trans_do(c,
+                       bch2_inum_offset_err_msg_trans(trans, &buf,
+                                       (subvol_inum) { subvol, read_pos.inode 
},
+                                       read_pos.offset << 9));
+               if (rbio->flags & BCH_READ_data_update)
+                       prt_str(&buf, "(internal move) ");
+               prt_str(&buf, "successful retry");
+
+               bch_err_ratelimited(c, "%s", buf.buf);
+               printbuf_exit(&buf);
        }
 
        bch2_rbio_done(rbio);
-- 
2.47.2


Reply via email to