[linux-next:master 4677/5666] fs/bcachefs/io_misc.c:468:6: warning: explicitly assigning value of variable of type 'int' to itself

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   dfa449a58323de195773cf928d99db4130702bf7
commit: eeb8a9793efc9509a131220064eebd7d883278e9 [4677/5666] bcachefs: Log finsert/fcollapse operations
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230917/202309170545.BvBaHv0r-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230917/202309170545.BvBaHv0r-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/202309170545.BvBaHv0r-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> fs/bcachefs/io_misc.c:468:6: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
           ret = ret;
           ~~~ ^ ~~~
   1 warning generated.


vim +/int +468 fs/bcachefs/io_misc.c

   341	
   342	static int __bch2_resume_logged_op_finsert(struct btree_trans *trans,
   343						   struct bkey_i *op_k,
   344						   u64 *i_sectors_delta)
   345	{
   346		struct bch_fs *c = trans->c;
   347		struct btree_iter iter;
   348		struct bkey_i_logged_op_finsert *op = bkey_i_to_logged_op_finsert(op_k);
   349		subvol_inum inum = { le32_to_cpu(op->v.subvol), le64_to_cpu(op->v.inum) };
   350		u64 dst_offset = le64_to_cpu(op->v.dst_offset);
   351		u64 src_offset = le64_to_cpu(op->v.src_offset);
   352		s64 shift = dst_offset - src_offset;
   353		u64 len = abs(shift);
   354		u64 pos = le64_to_cpu(op->v.pos);
   355		bool insert = shift > 0;
   356		int ret = 0;
   357	
   358		bch2_trans_iter_init(trans, &iter, BTREE_ID_extents,
   359				     POS(inum.inum, 0),
   360				     BTREE_ITER_INTENT);
   361	
   362		switch (op->v.state) {
   363	case LOGGED_OP_FINSERT_start:
   364		op->v.state = LOGGED_OP_FINSERT_shift_extents;
   365	
   366		if (insert) {
   367			ret = commit_do(trans, NULL, NULL, BTREE_INSERT_NOFAIL,
   368					adjust_i_size(trans, inum, src_offset, len) ?:
   369					bch2_logged_op_update(trans, &op->k_i));
   370			if (ret)
   371				goto err;
   372		} else {
   373			bch2_btree_iter_set_pos(&iter, POS(inum.inum, src_offset));
   374	
   375			ret = bch2_fpunch_at(trans, &iter, inum, src_offset + len, i_sectors_delta);
   376			if (ret && !bch2_err_matches(ret, BCH_ERR_transaction_restart))
   377				goto err;
   378	
   379			ret = commit_do(trans, NULL, NULL, BTREE_INSERT_NOFAIL,
   380					bch2_logged_op_update(trans, &op->k_i));
   381		}
   382	
   383		fallthrough;
   384	case LOGGED_OP_FINSERT_shift_extents:
   385		while (1) {
   386			struct disk_reservation disk_res =
   387				bch2_disk_reservation_init(c, 0);
   388			struct bkey_i delete, *copy;
   389			struct bkey_s_c k;
   390			struct bpos src_pos = POS(inum.inum, src_offset);
   391			u32 snapshot;
   392	
   393			bch2_trans_begin(trans);
   394	
   395			ret = bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot);
   396			if (ret)
   397				goto btree_err;
   398	
   399			bch2_btree_iter_set_snapshot(&iter, snapshot);
   400			bch2_btree_iter_set_pos(&iter, SPOS(inum.inum, pos, snapshot));
   401	
   402			k = insert
   403				? bch2_btree_iter_peek_prev(&iter)
   404				: bch2_btree_iter_peek_upto(&iter, POS(inum.inum, U64_MAX));
   405			if ((ret = bkey_err(k)))
   406				goto btree_err;
   407	
   408			if (!k.k ||
   409			    k.k->p.inode != inum.inum ||
   410			    bkey_le(k.k->p, POS(inum.inum, src_offset)))
   411				break;
   412	
   413			copy = bch2_bkey_make_mut_noupdate(trans, k);
   414			if ((ret = PTR_ERR_OR_ZERO(copy)))
   415				goto btree_err;
   416	
   417			if (insert &&
   418			    bkey_lt(bkey_start_pos(k.k), src_pos)) {
   419				bch2_cut_front(src_pos, copy);
   420	
   421				/* Splitting compressed extent? */
   422				bch2_disk_reservation_add(c, &disk_res,
   423						copy->k.size *
   424						bch2_bkey_nr_ptrs_allocated(bkey_i_to_s_c(copy)),
   425						BCH_DISK_RESERVATION_NOFAIL);
   426			}
   427	
   428			bkey_init(&delete.k);
   429			delete.k.p = copy->k.p;
   430			delete.k.p.snapshot = snapshot;
   431			delete.k.size = copy->k.size;
   432	
   433			copy->k.p.offset += shift;
   434			copy->k.p.snapshot = snapshot;
   435	
   436			op->v.pos = cpu_to_le64(insert ? bkey_start_offset(&delete.k) : delete.k.p.offset);
   437	
   438			ret =   bch2_btree_insert_trans(trans, BTREE_ID_extents, &delete, 0) ?:
   439				bch2_btree_insert_trans(trans, BTREE_ID_extents, copy, 0) ?:
   440				bch2_logged_op_update(trans, &op->k_i) ?:
   441				bch2_trans_commit(trans, &disk_res, NULL, BTREE_INSERT_NOFAIL);
   442	btree_err:
   443			bch2_disk_reservation_put(c, &disk_res);
   444	
   445			if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
   446				continue;
   447			if (ret)
   448				goto err;
   449	
   450			pos = le64_to_cpu(op->v.pos);
   451		}
   452	
   453		op->v.state = LOGGED_OP_FINSERT_finish;
   454	
   455		if (!insert) {
   456			ret = commit_do(trans, NULL, NULL, BTREE_INSERT_NOFAIL,
   457					adjust_i_size(trans, inum, src_offset, shift) ?:
   458					bch2_logged_op_update(trans, &op->k_i));
   459		} else {
   460			/* We need an inode update to update bi_journal_seq for fsync: */
   461			ret = commit_do(trans, NULL, NULL, BTREE_INSERT_NOFAIL,
   462					adjust_i_size(trans, inum, 0, 0) ?:
   463					bch2_logged_op_update(trans, &op->k_i));
   464		}
   465	
   466		fallthrough;
   467	case LOGGED_OP_FINSERT_finish:
 > 468		ret = ret;
   469		}
   470	err:
   471		bch2_logged_op_finish(trans, op_k);
   472		bch2_trans_iter_exit(trans, &iter);
   473		return ret;
   474	}
   475	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux