bcachefs: Print message on successful read retry
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 8 Mar 2025 23:42:34 +0000 (18:42 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 16 Mar 2025 17:47:55 +0000 (13:47 -0400)
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 <kent.overstreet@linux.dev>
fs/bcachefs/io_read.c

index e54103f79323c75d47b25d7b6cb9483d78aa9622..887e3c9ac181b49789a7133664fd9cb7a110de84 100644 (file)
@@ -494,6 +494,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;
@@ -508,6 +511,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);