tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 32ffa5373540a8d1c06619f52d019c6cdc948bb4 commit: d11ad060548411650467240ea1041b4f490b0e23 [10192/10862] bcachefs: improve error messages in bch2_ec_read_extent() config: loongarch-randconfig-r063-20240911 (https://download.01.org/0day-ci/archive/20240911/202409112351.VArA2OwR-lkp@xxxxxxxxx/config) compiler: loongarch64-linux-gcc (GCC) 14.1.0 If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202409112351.VArA2OwR-lkp@xxxxxxxxx/ cocci warnings: (new ones prefixed by >>) >> fs/bcachefs/ec.c:903:24-25: Unneeded semicolon vim +903 fs/bcachefs/ec.c 830 831 /* recovery read path: */ 832 int bch2_ec_read_extent(struct btree_trans *trans, struct bch_read_bio *rbio, 833 struct bkey_s_c orig_k) 834 { 835 struct bch_fs *c = trans->c; 836 struct ec_stripe_buf *buf = NULL; 837 struct closure cl; 838 struct bch_stripe *v; 839 unsigned i, offset; 840 const char *msg = NULL; 841 struct printbuf msgbuf = PRINTBUF; 842 int ret = 0; 843 844 closure_init_stack(&cl); 845 846 BUG_ON(!rbio->pick.has_ec); 847 848 buf = kzalloc(sizeof(*buf), GFP_NOFS); 849 if (!buf) 850 return -BCH_ERR_ENOMEM_ec_read_extent; 851 852 ret = lockrestart_do(trans, get_stripe_key_trans(trans, rbio->pick.ec.idx, buf)); 853 if (ret) { 854 msg = "stripe not found"; 855 goto err; 856 } 857 858 v = &bkey_i_to_stripe(&buf->key)->v; 859 860 if (!bch2_ptr_matches_stripe(v, rbio->pick)) { 861 msg = "pointer doesn't match stripe"; 862 goto err; 863 } 864 865 offset = rbio->bio.bi_iter.bi_sector - v->ptrs[rbio->pick.ec.block].offset; 866 if (offset + bio_sectors(&rbio->bio) > le16_to_cpu(v->sectors)) { 867 msg = "read is bigger than stripe"; 868 goto err; 869 } 870 871 ret = ec_stripe_buf_init(buf, offset, bio_sectors(&rbio->bio)); 872 if (ret) { 873 msg = "-ENOMEM"; 874 goto err; 875 } 876 877 for (i = 0; i < v->nr_blocks; i++) 878 ec_block_io(c, buf, REQ_OP_READ, i, &cl); 879 880 closure_sync(&cl); 881 882 if (ec_nr_failed(buf) > v->nr_redundant) { 883 msg = "unable to read enough blocks"; 884 goto err; 885 } 886 887 ec_validate_checksums(c, buf); 888 889 ret = ec_do_recov(c, buf); 890 if (ret) 891 goto err; 892 893 memcpy_to_bio(&rbio->bio, rbio->bio.bi_iter, 894 buf->data[rbio->pick.ec.block] + ((offset - buf->offset) << 9)); 895 out: 896 ec_stripe_buf_exit(buf); 897 kfree(buf); 898 return ret; 899 err: 900 bch2_bkey_val_to_text(&msgbuf, c, orig_k); 901 bch_err_ratelimited(c, 902 "error doing reconstruct read: %s\n %s", msg, msgbuf.buf); > 903 printbuf_exit(&msgbuf);; 904 ret = -BCH_ERR_stripe_reconstruct; 905 goto out; 906 } 907 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki