[koverstreet-bcachefs:pr/1073 18/19] fs/bcachefs/init/dev.c:865:13: warning: unused variable 'ret'

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://github.com/koverstreet/bcachefs pr/1073
head:   f7205707584bda883ae253f4c02d3ef7786d4db0
commit: c11fcc6b8b4ad911633c2f7ae6a5318982aff2c9 [18/19] merge
config: parisc-allmodconfig (https://download.01.org/0day-ci/archive/20260718/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260718/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   fs/bcachefs/init/dev.c: In function '__bch2_dev_set_state':
>> fs/bcachefs/init/dev.c:865:13: warning: unused variable 'ret' [-Wunused-variable]
     865 |         int ret = 0;
         |             ^~~


vim +/ret +865 fs/bcachefs/init/dev.c

bf25974be5b42c Kent Overstreet 2025-10-04  860  
bf25974be5b42c Kent Overstreet 2025-10-04  861  int __bch2_dev_set_state(struct bch_fs *c, struct bch_dev *ca,
bf25974be5b42c Kent Overstreet 2025-10-04  862  			 enum bch_member_state new_state, int flags,
bf25974be5b42c Kent Overstreet 2025-10-04  863  			 struct printbuf *err)
bf25974be5b42c Kent Overstreet 2025-10-04  864  {
bf25974be5b42c Kent Overstreet 2025-10-04 @865  	int ret = 0;
bf25974be5b42c Kent Overstreet 2025-10-04  866  
336a9d7cd005d5 Kent Overstreet 2026-05-08  867  	bool was_rw = ca->mi.state == BCH_MEMBER_STATE_rw;
1b06db5b722966 Kent Overstreet 2025-12-30  868  	bool do_reconcile_scan =
1b06db5b722966 Kent Overstreet 2025-12-30  869  		new_state == BCH_MEMBER_STATE_rw ||
1b06db5b722966 Kent Overstreet 2025-12-30  870  		new_state == BCH_MEMBER_STATE_evacuating;
1b06db5b722966 Kent Overstreet 2025-12-30  871  
1b06db5b722966 Kent Overstreet 2025-12-30  872  	struct reconcile_scan s = new_state == BCH_MEMBER_STATE_rw
1b06db5b722966 Kent Overstreet 2025-12-30  873  		? (struct reconcile_scan) { .type = RECONCILE_SCAN_pending }
1b06db5b722966 Kent Overstreet 2025-12-30  874  		: (struct reconcile_scan) { .type = RECONCILE_SCAN_device, .dev = ca->dev_idx };
1b06db5b722966 Kent Overstreet 2025-12-30  875  
1b06db5b722966 Kent Overstreet 2025-12-30  876  	if (ca->mi.state == new_state) {
1b06db5b722966 Kent Overstreet 2025-12-30  877  		if (new_state == BCH_MEMBER_STATE_evacuating)
1b06db5b722966 Kent Overstreet 2025-12-30  878  			return bch2_set_reconcile_needs_scan(c, s, true);
bf25974be5b42c Kent Overstreet 2025-10-04  879  		return 0;
1b06db5b722966 Kent Overstreet 2025-12-30  880  	}
bf25974be5b42c Kent Overstreet 2025-10-04  881  
bf25974be5b42c Kent Overstreet 2025-10-04  882  	if (!bch2_dev_state_allowed(c, ca, new_state, flags, err))
bf25974be5b42c Kent Overstreet 2025-10-04  883  		return bch_err_throw(c, device_state_not_allowed);
bf25974be5b42c Kent Overstreet 2025-10-04  884  
bf25974be5b42c Kent Overstreet 2025-10-04  885  	if (new_state != BCH_MEMBER_STATE_rw)
bf25974be5b42c Kent Overstreet 2025-10-04  886  		__bch2_dev_read_only(c, ca);
bf25974be5b42c Kent Overstreet 2025-10-04  887  
ee3d225f30a142 Kent Overstreet 2025-11-23  888  	bch_notice_dev(ca, "%s", bch2_member_states[new_state]);
bf25974be5b42c Kent Overstreet 2025-10-04  889  
581f7e27bc9728 Kent Overstreet 2025-11-12  890  	if (do_reconcile_scan)
581f7e27bc9728 Kent Overstreet 2025-11-12  891  		try(bch2_set_reconcile_needs_scan(c, s, false));
7ee28fc7955287 Kent Overstreet 2025-08-23  892  
bf25974be5b42c Kent Overstreet 2025-10-04  893  	scoped_guard(mutex, &c->sb_lock) {
bf25974be5b42c Kent Overstreet 2025-10-04  894  		struct bch_member *m = bch2_members_v2_get_mut(c->disk_sb.sb, ca->dev_idx);
bf25974be5b42c Kent Overstreet 2025-10-04  895  		SET_BCH_MEMBER_STATE(m, new_state);
bf25974be5b42c Kent Overstreet 2025-10-04  896  		bch2_write_super(c);
bf25974be5b42c Kent Overstreet 2025-10-04  897  	}
bf25974be5b42c Kent Overstreet 2025-10-04  898  
70c107dddc3792 Kent Overstreet 2026-02-08  899  	if (new_state == BCH_MEMBER_STATE_rw && bch2_dev_is_online(ca))
bf25974be5b42c Kent Overstreet 2025-10-04  900  		__bch2_dev_read_write(c, ca);
bf25974be5b42c Kent Overstreet 2025-10-04  901  
c25cbe6eb98d73 Kent Overstreet 2026-05-03  902  	/*
336a9d7cd005d5 Kent Overstreet 2026-05-08  903  	 * Any RW transition (in or out) changes the EC widening target (RW
336a9d7cd005d5 Kent Overstreet 2026-05-08  904  	 * members) for this disk_label; queue a stripes scan so can_widen is
336a9d7cd005d5 Kent Overstreet 2026-05-08  905  	 * refreshed. Must come after the SB write above so the scan, which
336a9d7cd005d5 Kent Overstreet 2026-05-08  906  	 * reads ca->mi.state, sees the new state.
336a9d7cd005d5 Kent Overstreet 2026-05-08  907  	 *
336a9d7cd005d5 Kent Overstreet 2026-05-08  908  	 * Going-RW grows the target so newly-widenable stripes can be picked
336a9d7cd005d5 Kent Overstreet 2026-05-08  909  	 * up; going-from-RW shrinks it, and while get_old_stripe demotes
336a9d7cd005d5 Kent Overstreet 2026-05-08  910  	 * lazily on the reuse path, fsck and the canonical can_widen value
336a9d7cd005d5 Kent Overstreet 2026-05-08  911  	 * still need the scan to converge.
c25cbe6eb98d73 Kent Overstreet 2026-05-03  912  	 */
336a9d7cd005d5 Kent Overstreet 2026-05-08  913  	if (new_state == BCH_MEMBER_STATE_rw || was_rw)
c25cbe6eb98d73 Kent Overstreet 2026-05-03  914  		try(bch2_set_reconcile_needs_scan(c,
c25cbe6eb98d73 Kent Overstreet 2026-05-03  915  			(struct reconcile_scan) { .type = RECONCILE_SCAN_stripes }, false));
c25cbe6eb98d73 Kent Overstreet 2026-05-03  916  
581f7e27bc9728 Kent Overstreet 2025-11-12  917  	if (do_reconcile_scan)
581f7e27bc9728 Kent Overstreet 2025-11-12  918  		try(bch2_set_reconcile_needs_scan(c, s, true));
bf25974be5b42c Kent Overstreet 2025-10-04  919  
5d0734b50a4d9a Jul Lang        2026-07-14  920  	return 0;
bf25974be5b42c Kent Overstreet 2025-10-04  921  }
bf25974be5b42c Kent Overstreet 2025-10-04  922  

:::::: The code at line 865 was first introduced by commit
:::::: bf25974be5b42c0341a7f17cb7e6e835d80b41e6 bcachefs: split out init/dev.c

:::::: TO: Kent Overstreet <[email protected]>
:::::: CC: Kent Overstreet <[email protected]>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.