fs/bcachefs/btree_key_cache.c:113:7: warning: result of comparison of constant 9223372036854775807 with expression of type 'unsigned int' is always true

From: kernel test robot
Date: Sun Nov 19 2023 - 04:14:30 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 037266a5f7239ead1530266f7d7af153d2a867fa
commit: b2f83e769f607409753888c95a9b46dc927dc856 bcachefs: Btree key cache shrinker fix
date: 4 weeks ago
config: s390-randconfig-001-20231119 (https://download.01.org/0day-ci/archive/20231119/202311191651.u4v7ULB0-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231119/202311191651.u4v7ULB0-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311191651.u4v7ULB0-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from fs/bcachefs/btree_key_cache.c:4:
fs/bcachefs/btree_iter.h:220:8: warning: duplicate 'inline' declaration specifier [-Wduplicate-decl-specifier]
static inline int btree_trans_restart_nounlock(struct btree_trans *trans, int err)
^
include/linux/compiler_types.h:215:16: note: expanded from macro 'inline'
#define inline inline __gnu_inline __inline_maybe_unused notrace
^
In file included from fs/bcachefs/btree_key_cache.c:4:
fs/bcachefs/btree_iter.h:230:8: warning: duplicate 'inline' declaration specifier [-Wduplicate-decl-specifier]
static inline int btree_trans_restart(struct btree_trans *trans, int err)
^
include/linux/compiler_types.h:215:16: note: expanded from macro 'inline'
#define inline inline __gnu_inline __inline_maybe_unused notrace
^
In file included from fs/bcachefs/btree_key_cache.c:6:
fs/bcachefs/btree_locking.h:88:46: warning: implicit conversion from enumeration type 'enum six_lock_type' to different enumeration type 'enum btree_node_locked_type' [-Wenum-conversion]
mark_btree_node_locked_noreset(path, level, type);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~
fs/bcachefs/btree_locking.h:175:51: warning: implicit conversion from enumeration type 'enum six_lock_type' to different enumeration type 'enum btree_node_locked_type' [-Wenum-conversion]
mark_btree_node_locked_noreset(path, b->c.level, SIX_LOCK_intent);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~
fs/bcachefs/btree_locking.h:239:33: warning: implicit conversion from enumeration type 'enum btree_node_locked_type' to different enumeration type 'enum six_lock_type' [-Wenum-conversion]
six_lock_increment(&b->lock, want);
~~~~~~~~~~~~~~~~~~ ^~~~
fs/bcachefs/btree_locking.h:259:49: warning: implicit conversion from enumeration type 'enum six_lock_type' to different enumeration type 'enum btree_node_locked_type' [-Wenum-conversion]
btree_node_lock_increment(trans, b, level, type) ||
~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~
fs/bcachefs/btree_locking.h:286:49: warning: implicit conversion from enumeration type 'enum six_lock_type' to different enumeration type 'enum btree_node_locked_type' [-Wenum-conversion]
mark_btree_node_locked_noreset(path, b->level, SIX_LOCK_write);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~
>> fs/bcachefs/btree_key_cache.c:113:7: warning: result of comparison of constant 9223372036854775807 with expression of type 'unsigned int' is always true [-Wtautological-constant-out-of-range-compare]
if (ULONG_CMP_GE(ck->btree_trans_barrier_seq,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:35:43: note: expanded from macro 'ULONG_CMP_GE'
#define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b))
~~~~~~~~~~~~~ ^ ~~~~~~~~~
8 warnings generated.


vim +113 fs/bcachefs/btree_key_cache.c

105
106 #ifdef __KERNEL__
107 static void __bkey_cached_move_to_freelist_ordered(struct btree_key_cache *bc,
108 struct bkey_cached *ck)
109 {
110 struct bkey_cached *pos;
111
112 list_for_each_entry_reverse(pos, &bc->freed_nonpcpu, list) {
> 113 if (ULONG_CMP_GE(ck->btree_trans_barrier_seq,
114 pos->btree_trans_barrier_seq)) {
115 list_move(&ck->list, &pos->list);
116 return;
117 }
118 }
119
120 list_move(&ck->list, &bc->freed_nonpcpu);
121 }
122 #endif
123

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki