public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [bcachefs:bcachefs-testing 404/405] fs/bcachefs/alloc/background.c:811:5: warning: format specifies type 'unsigned int' but the argument has type '__u64' (aka 'unsigned long long')
@ 2026-02-19  4:45 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-02-19  4:45 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: llvm, oe-kbuild-all

tree:   https://evilpiepirate.org/git/bcachefs.git bcachefs-testing
head:   3d8e2e3e57fe808ecc7fd11e9bbe1d2894116cf9
commit: 85cde1245a273a5b44dbb108f98d51c77468d730 [404/405] bcachefs: alloc trigger: convert BUG_ON to fsck_err for bucket going empty while not open
config: sparc64-allmodconfig (https://download.01.org/0day-ci/archive/20260219/202602191218.C8PZpcL4-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project e86750b29fa0ff207cd43213d66dabe565417638)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260219/202602191218.C8PZpcL4-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/202602191218.C8PZpcL4-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/bcachefs/alloc/background.c:811:5: warning: format specifies type 'unsigned int' but the argument has type '__u64' (aka 'unsigned long long') [-Wformat]
     810 |                                 "bucket %u:%llu going empty but not open\n%s",
         |                                         ~~
         |                                         %llu
     811 |                                 new.k->p.inode, new.k->p.offset,
         |                                 ^~~~~~~~~~~~~~
   fs/bcachefs/init/error.h:145:16: note: expanded from macro 'log_fsck_err_on'
     145 |                 log_fsck_err(__VA_ARGS__);                              \
         |                              ^~~~~~~~~~~
   fs/bcachefs/init/error.h:139:44: note: expanded from macro 'log_fsck_err'
     139 |         __fsck_err(c, FSCK_CAN_IGNORE, _err_type, __VA_ARGS__)
         |                                                   ^~~~~~~~~~~
   fs/bcachefs/init/error.h:110:54: note: expanded from macro '__fsck_err'
     110 | #define __fsck_err(...)         fsck_err_wrap(bch2_fsck_err(__VA_ARGS__))
         |                                                             ^~~~~~~~~~~
   fs/bcachefs/init/error.h:93:38: note: expanded from macro 'bch2_fsck_err'
      93 |                         _flags, BCH_FSCK_ERR_##_err_type, __VA_ARGS__)
         |                                                           ^~~~~~~~~~~
   fs/bcachefs/init/error.h:100:13: note: expanded from macro 'fsck_err_wrap'
     100 |         int _ret = _do;                                                 \
         |                    ^~~
   1 warning generated.


vim +811 fs/bcachefs/alloc/background.c

   770	
   771	int bch2_trigger_alloc(struct btree_trans *trans,
   772			       enum btree_id btree, unsigned level,
   773			       struct bkey_s_c old, struct bkey_s new,
   774			       enum btree_iter_update_trigger_flags flags)
   775	{
   776		struct bch_fs *c = trans->c;
   777		int ret = 0;
   778	
   779		CLASS(bch2_dev_bucket_tryget, ca)(c, new.k->p);
   780		if (!ca)
   781			return bch_err_throw(c, trigger_alloc);
   782	
   783		struct bch_alloc_v4 old_a_convert;
   784		const struct bch_alloc_v4 *old_a = bch2_alloc_to_v4(old, &old_a_convert);
   785	
   786		struct bch_alloc_v4 *new_a;
   787		if (likely(new.k->type == KEY_TYPE_alloc_v4)) {
   788			new_a = bkey_s_to_alloc_v4(new).v;
   789		} else {
   790			BUG_ON(!(flags & (BTREE_TRIGGER_gc|BTREE_TRIGGER_check_repair)));
   791	
   792			struct bkey_i_alloc_v4 *new_ka =
   793				errptr_try(bch2_alloc_to_v4_mut_inlined(trans, new.s_c));
   794			new_a = &new_ka->v;
   795		}
   796	
   797		if (flags & BTREE_TRIGGER_transactional) {
   798			alloc_data_type_set(new_a, new_a->data_type);
   799	
   800			int is_empty_delta = (int) data_type_is_empty(new_a->data_type) -
   801					     (int) data_type_is_empty(old_a->data_type);
   802	
   803			if (is_empty_delta < 0 &&
   804			    (new_a->data_type != BCH_DATA_sb &&
   805			     new_a->data_type != BCH_DATA_journal) &&
   806			    !bch2_bucket_is_open_safe(c, new.k->p.inode, new.k->p.offset)) {
   807				CLASS(printbuf, buf)();
   808				log_fsck_err_on(true, trans,
   809					alloc_key_bucket_nonempty_to_empty_not_open,
   810					"bucket %u:%llu going empty but not open\n%s",
 > 811					new.k->p.inode, new.k->p.offset,
   812					(bch2_bkey_val_to_text(&buf, c, new.s_c), buf.buf));
   813			}
   814	
   815			if (is_empty_delta < 0) {
   816				new_a->io_time[READ] = bch2_current_io_time(c, READ);
   817				new_a->io_time[WRITE]= bch2_current_io_time(c, WRITE);
   818				SET_BCH_ALLOC_V4_NEED_INC_GEN(new_a, true);
   819				SET_BCH_ALLOC_V4_NEED_DISCARD(new_a, true);
   820			}
   821	
   822			if (data_type_is_empty(new_a->data_type) &&
   823			    BCH_ALLOC_V4_NEED_INC_GEN(new_a) &&
   824			    !bch2_bucket_is_open_safe(c, new.k->p.inode, new.k->p.offset)) {
   825				if (new_a->oldest_gen == new_a->gen &&
   826				    !bch2_bucket_sectors_total(*new_a))
   827					new_a->oldest_gen++;
   828				new_a->gen++;
   829				SET_BCH_ALLOC_V4_NEED_INC_GEN(new_a, false);
   830				alloc_data_type_set(new_a, new_a->data_type);
   831			}
   832	
   833			if (old_a->data_type != new_a->data_type ||
   834			    (new_a->data_type == BCH_DATA_free &&
   835			     alloc_freespace_genbits(*old_a) != alloc_freespace_genbits(*new_a))) {
   836				try(bch2_bucket_do_index(trans, ca, old, old_a, false));
   837				try(bch2_bucket_do_index(trans, ca, new.s_c, new_a, true));
   838			}
   839	
   840			if (new_a->data_type == BCH_DATA_cached &&
   841			    !new_a->io_time[READ])
   842				new_a->io_time[READ] = bch2_current_io_time(c, READ);
   843	
   844			try(bch2_lru_change(trans, new.k->p.inode,
   845					    bucket_to_u64(new.k->p),
   846					    alloc_lru_idx_read(*old_a),
   847					    alloc_lru_idx_read(*new_a)));
   848	
   849			try(bch2_lru_change(trans,
   850					    BCH_LRU_BUCKET_FRAGMENTATION,
   851					    bucket_to_u64(new.k->p),
   852					    alloc_lru_idx_fragmentation(*old_a, ca),
   853					    alloc_lru_idx_fragmentation(*new_a, ca)));
   854	
   855			if (old_a->gen != new_a->gen)
   856				try(bch2_bucket_gen_update(trans, new.k->p, new_a->gen));
   857	
   858			try(bch2_alloc_key_to_dev_counters(trans, ca, old_a, new_a, flags));
   859		}
   860	
   861		if ((flags & BTREE_TRIGGER_atomic) && (flags & BTREE_TRIGGER_insert)) {
   862			u64 transaction_seq = trans->journal_res.seq;
   863			BUG_ON(!transaction_seq);
   864	
   865			CLASS(printbuf, buf)();
   866			if (log_fsck_err_on(transaction_seq && new_a->journal_seq_nonempty > transaction_seq,
   867					    trans, alloc_key_journal_seq_in_future,
   868					    "bucket journal seq in future (currently at %llu)\n%s",
   869					    journal_cur_seq(&c->journal),
   870					    (bch2_bkey_val_to_text(&buf, c, new.s_c), buf.buf)))
   871				new_a->journal_seq_nonempty = transaction_seq;
   872	
   873			int is_empty_delta = (int) data_type_is_empty(new_a->data_type) -
   874					     (int) data_type_is_empty(old_a->data_type);
   875	
   876			/*
   877			 * Record journal sequence number of empty -> nonempty transition:
   878			 * Note that there may be multiple empty -> nonempty
   879			 * transitions, data in a bucket may be overwritten while we're
   880			 * still writing to it - so be careful to only record the first:
   881			 * */
   882			if (is_empty_delta < 0 &&
   883			    new_a->journal_seq_empty <= c->journal.flushed_seq_ondisk) {
   884				new_a->journal_seq_nonempty	= transaction_seq;
   885				new_a->journal_seq_empty	= 0;
   886			}
   887	
   888			/*
   889			 * Bucket becomes empty: mark it as waiting for a journal flush,
   890			 * unless updates since empty -> nonempty transition were never
   891			 * flushed - we may need to ask the journal not to flush
   892			 * intermediate sequence numbers:
   893			 */
   894			if (is_empty_delta > 0) {
   895				if (new_a->journal_seq_nonempty == transaction_seq ||
   896				    bch2_journal_noflush_seq(&c->journal,
   897							     new_a->journal_seq_nonempty,
   898							     transaction_seq)) {
   899					new_a->journal_seq_nonempty = new_a->journal_seq_empty = 0;
   900				} else {
   901					new_a->journal_seq_empty = transaction_seq;
   902	
   903					ret = bch2_set_bucket_needs_journal_commit(&c->buckets_waiting_for_journal,
   904										   c->journal.flushed_seq_ondisk,
   905										   new.k->p.inode, new.k->p.offset,
   906										   transaction_seq);
   907					if (bch2_fs_fatal_err_on(ret, c,
   908							"setting bucket_needs_journal_commit: %s",
   909							bch2_err_str(ret)))
   910						return ret;
   911				}
   912			}
   913	
   914			if (new_a->gen != old_a->gen) {
   915				guard(rcu)();
   916				u8 *gen = bucket_gen(ca, new.k->p.offset);
   917				if (unlikely(!gen))
   918					return inval_bucket_key(trans, new.s_c);
   919				*gen = new_a->gen;
   920			}
   921	

-- 
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:[~2026-02-19  4:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-19  4:45 [bcachefs:bcachefs-testing 404/405] fs/bcachefs/alloc/background.c:811:5: warning: format specifies type 'unsigned int' but the argument has type '__u64' (aka 'unsigned long long') kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox