public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [colyli-bcache:for-next 3/3] drivers/md/bcache/btree.c:1774:21: warning: variable 'ca' is uninitialized when used here
@ 2024-05-03  2:52 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-05-03  2:52 UTC (permalink / raw)
  To: Dongsheng Yang; +Cc: llvm, oe-kbuild-all, Coly Li

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git for-next
head:   f7093093e7a41cc15a90a97581d77d4c4af54cc5
commit: f7093093e7a41cc15a90a97581d77d4c4af54cc5 [3/3] bcache: allow allocator to invalidate bucket in gc
config: s390-defconfig (https://download.01.org/0day-ci/archive/20240503/202405031034.WlmParsM-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 37ae4ad0eef338776c7e2cffb3896153d43dcd90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240503/202405031034.WlmParsM-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/202405031034.WlmParsM-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/md/bcache/btree.c:24:
   In file included from drivers/md/bcache/bcache.h:181:
   In file included from include/linux/bio.h:10:
   In file included from include/linux/blk_types.h:10:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:10:
   In file included from include/linux/mm.h:2210:
   include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     508 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     509 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     515 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     516 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     527 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     528 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     536 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     537 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/md/bcache/btree.c:1774:21: warning: variable 'ca' is uninitialized when used here [-Wuninitialized]
    1774 |         for_each_bucket(b, ca)
         |                            ^~
   drivers/md/bcache/bcache.h:892:12: note: expanded from macro 'for_each_bucket'
     892 |         for (b = (ca)->buckets + (ca)->sb.first_bucket;                 \
         |                   ^~
   drivers/md/bcache/btree.c:1764:18: note: initialize the variable 'ca' to silence this warning
    1764 |         struct cache *ca;
         |                         ^
         |                          = NULL
   6 warnings generated.


vim +/ca +1774 drivers/md/bcache/btree.c

  1760	
  1761	static void bch_btree_gc_finish(struct cache_set *c)
  1762	{
  1763		struct bucket *b;
  1764		struct cache *ca;
  1765		unsigned int i, j;
  1766		uint64_t *k;
  1767	
  1768		mutex_lock(&c->bucket_lock);
  1769	
  1770		set_gc_sectors(c);
  1771		c->gc_mark_valid = 1;
  1772		c->need_gc	= 0;
  1773	
> 1774		for_each_bucket(b, ca)
  1775			if (b->reclaimable_in_gc)
  1776				b->reclaimable_in_gc = 0;
  1777	
  1778		for (i = 0; i < KEY_PTRS(&c->uuid_bucket); i++)
  1779			SET_GC_MARK(PTR_BUCKET(c, &c->uuid_bucket, i),
  1780				    GC_MARK_METADATA);
  1781	
  1782		/* don't reclaim buckets to which writeback keys point */
  1783		rcu_read_lock();
  1784		for (i = 0; i < c->devices_max_used; i++) {
  1785			struct bcache_device *d = c->devices[i];
  1786			struct cached_dev *dc;
  1787			struct keybuf_key *w, *n;
  1788	
  1789			if (!d || UUID_FLASH_ONLY(&c->uuids[i]))
  1790				continue;
  1791			dc = container_of(d, struct cached_dev, disk);
  1792	
  1793			spin_lock(&dc->writeback_keys.lock);
  1794			rbtree_postorder_for_each_entry_safe(w, n,
  1795						&dc->writeback_keys.keys, node)
  1796				for (j = 0; j < KEY_PTRS(&w->key); j++)
  1797					SET_GC_MARK(PTR_BUCKET(c, &w->key, j),
  1798						    GC_MARK_DIRTY);
  1799			spin_unlock(&dc->writeback_keys.lock);
  1800		}
  1801		rcu_read_unlock();
  1802	
  1803		c->avail_nbuckets = 0;
  1804	
  1805		ca = c->cache;
  1806		ca->invalidate_needs_gc = 0;
  1807	
  1808		for (k = ca->sb.d; k < ca->sb.d + ca->sb.keys; k++)
  1809			SET_GC_MARK(ca->buckets + *k, GC_MARK_METADATA);
  1810	
  1811		for (k = ca->prio_buckets;
  1812		     k < ca->prio_buckets + prio_buckets(ca) * 2; k++)
  1813			SET_GC_MARK(ca->buckets + *k, GC_MARK_METADATA);
  1814	
  1815		for_each_bucket(b, ca) {
  1816			c->need_gc	= max(c->need_gc, bucket_gc_gen(b));
  1817	
  1818			if (atomic_read(&b->pin))
  1819				continue;
  1820	
  1821			BUG_ON(!GC_MARK(b) && GC_SECTORS_USED(b));
  1822	
  1823			if (!GC_MARK(b) || GC_MARK(b) == GC_MARK_RECLAIMABLE)
  1824				c->avail_nbuckets++;
  1825		}
  1826	
  1827		mutex_unlock(&c->bucket_lock);
  1828	}
  1829	

-- 
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:[~2024-05-03  2:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-03  2:52 [colyli-bcache:for-next 3/3] drivers/md/bcache/btree.c:1774:21: warning: variable 'ca' is uninitialized when used here 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