* [bcachefs:bcachefs-testing 316/351] fs/bcachefs/backpointers.c:969:5: error: call to undeclared function '__WARN'; ISO C99 and later do not support implicit function declarations
@ 2025-09-04 21:00 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-09-04 21:00 UTC (permalink / raw)
To: Kent Overstreet; +Cc: llvm, oe-kbuild-all, Kent Overstreet
tree: https://evilpiepirate.org/git/bcachefs.git bcachefs-testing
head: ee47b5b15f8620c81d1382cc851a1c01b96b9c96
commit: e0277fea307f1b134bbed3cb22ec32613e9140fc [316/351] bcachefs: Fix infinite loop in backpointers fsck on upgrade
config: x86_64-buildonly-randconfig-001-20250905 (https://download.01.org/0day-ci/archive/20250905/202509050437.mtgpC5gW-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250905/202509050437.mtgpC5gW-lkp@intel.com/reproduce)
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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509050437.mtgpC5gW-lkp@intel.com/
All errors (new ones prefixed by >>):
>> fs/bcachefs/backpointers.c:969:5: error: call to undeclared function '__WARN'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
969 | __WARN();
| ^
1 error generated.
vim +/__WARN +969 fs/bcachefs/backpointers.c
866
867 static int check_bucket_backpointer_mismatch(struct btree_trans *trans, struct bkey_s_c alloc_k,
868 bool *had_mismatch,
869 struct bkey_buf *last_flushed,
870 struct bpos *last_pos,
871 unsigned *nr_iters)
872 {
873 struct bch_fs *c = trans->c;
874 struct bch_alloc_v4 a_convert;
875 const struct bch_alloc_v4 *a = bch2_alloc_to_v4(alloc_k, &a_convert);
876 bool need_commit = false;
877
878 if (!bpos_eq(*last_pos, alloc_k.k->p))
879 *nr_iters = 0;
880
881 *last_pos = alloc_k.k->p;
882
883 *had_mismatch = false;
884
885 if (a->data_type == BCH_DATA_sb ||
886 a->data_type == BCH_DATA_journal ||
887 a->data_type == BCH_DATA_parity)
888 return 0;
889
890 u32 sectors[ALLOC_SECTORS_NR];
891 memset(sectors, 0, sizeof(sectors));
892
893 CLASS(bch2_dev_bucket_tryget_noerror, ca)(trans->c, alloc_k.k->p);
894 if (!ca)
895 return 0;
896
897 struct bkey_s_c bp_k;
898 int ret = 0;
899 for_each_btree_key_max_norestart(trans, iter, BTREE_ID_backpointers,
900 bucket_pos_to_bp_start(ca, alloc_k.k->p),
901 bucket_pos_to_bp_end(ca, alloc_k.k->p), 0, bp_k, ret) {
902 if (bp_k.k->type != KEY_TYPE_backpointer)
903 continue;
904
905 struct bkey_s_c_backpointer bp = bkey_s_c_to_backpointer(bp_k);
906
907 if (c->sb.version_upgrade_complete < bcachefs_metadata_version_backpointer_bucket_gen &&
908 (bp.v->bucket_gen != a->gen ||
909 bp.v->pad)) {
910 ret = bch2_backpointer_del(trans, bp_k.k->p);
911 if (ret)
912 return ret;
913
914 need_commit = true;
915 continue;
916 }
917
918 if (bp.v->bucket_gen != a->gen)
919 continue;
920
921 int alloc_counter = data_type_to_alloc_counter(bp.v->data_type);
922 if (alloc_counter < 0)
923 continue;
924
925 sectors[alloc_counter] += bp.v->bucket_len;
926 };
927 if (ret)
928 return ret;
929
930 if (need_commit) {
931 ret = bch2_trans_commit(trans, NULL, NULL, BCH_TRANS_COMMIT_no_enospc);
932 if (ret)
933 return ret;
934 }
935
936 if (sectors[ALLOC_dirty] != a->dirty_sectors ||
937 sectors[ALLOC_cached] != a->cached_sectors ||
938 sectors[ALLOC_stripe] != a->stripe_sectors) {
939 if (sectors[ALLOC_dirty] > a->dirty_sectors ||
940 sectors[ALLOC_cached] > a->cached_sectors ||
941 sectors[ALLOC_stripe] > a->stripe_sectors) {
942 if (*nr_iters) {
943 CLASS(printbuf, buf)();
944 bch2_log_msg_start(c, &buf);
945
946 prt_printf(&buf, "backpointer sectors > bucket sectors, but found no bad backpointers\n"
947 "bucket %llu:%llu data type %s, counters\n",
948 alloc_k.k->p.inode,
949 alloc_k.k->p.offset,
950 __bch2_data_types[a->data_type]);
951 if (sectors[ALLOC_dirty] > a->dirty_sectors)
952 prt_printf(&buf, "dirty: %u > %u\n",
953 sectors[ALLOC_dirty], a->dirty_sectors);
954 if (sectors[ALLOC_cached] > a->cached_sectors)
955 prt_printf(&buf, "cached: %u > %u\n",
956 sectors[ALLOC_cached], a->cached_sectors);
957 if (sectors[ALLOC_stripe] > a->stripe_sectors)
958 prt_printf(&buf, "stripe: %u > %u\n",
959 sectors[ALLOC_stripe], a->stripe_sectors);
960
961 for_each_btree_key_max_norestart(trans, iter, BTREE_ID_backpointers,
962 bucket_pos_to_bp_start(ca, alloc_k.k->p),
963 bucket_pos_to_bp_end(ca, alloc_k.k->p), 0, bp_k, ret) {
964 bch2_bkey_val_to_text(&buf, c, bp_k);
965 prt_newline(&buf);
966 }
967
968 bch2_print_str(c, KERN_ERR, buf.buf);
> 969 __WARN();
970 return ret;
971 }
972
973 *nr_iters += 1;
974
975 return check_bucket_backpointers_to_extents(trans, ca, alloc_k.k->p) ?:
976 bch_err_throw(c, transaction_restart_nested);
977 }
978
979 /*
980 * Post 1.14 upgrade, we assume that backpointers are mostly
981 * correct and a sector count mismatch is probably due to a
982 * write buffer race
983 *
984 * Pre upgrade, we expect all the buckets to be wrong, a write
985 * buffer flush is pointless:
986 */
987 if (c->sb.version_upgrade_complete >= bcachefs_metadata_version_backpointer_bucket_gen) {
988 ret = bch2_backpointers_maybe_flush(trans, alloc_k, last_flushed);
989 if (ret)
990 return ret;
991 }
992
993 bool empty = (sectors[ALLOC_dirty] +
994 sectors[ALLOC_stripe] +
995 sectors[ALLOC_cached]) == 0;
996
997 ret = bch2_bucket_bitmap_set(ca, &ca->bucket_backpointer_mismatch,
998 alloc_k.k->p.offset) ?:
999 (empty
1000 ? bch2_bucket_bitmap_set(ca, &ca->bucket_backpointer_empty,
1001 alloc_k.k->p.offset)
1002 : 0);
1003
1004 *had_mismatch = true;
1005 }
1006
1007 return 0;
1008 }
1009
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-09-04 21:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04 21:00 [bcachefs:bcachefs-testing 316/351] fs/bcachefs/backpointers.c:969:5: error: call to undeclared function '__WARN'; ISO C99 and later do not support implicit function declarations kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.