All of lore.kernel.org
 help / color / mirror / Atom feed
* [sashal-linux-stable:queue-4.9 1/94] fs/btrfs/tree-log.c:5718:71: sparse: sparse: incorrect type in argument 1 (different base types)
@ 2019-12-27  7:46 kbuild test robot
  0 siblings, 0 replies; only message in thread
From: kbuild test robot @ 2019-12-27  7:46 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 8053 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git queue-4.9
head:   6796cb2db8075fdda99996f1b37724d6fb9c9704
commit: eed59e28a608af780cd49d5578fe70ab1313485b [1/94] btrfs: skip log replay on orphaned roots
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-129-g341daf20-dirty
        git checkout eed59e28a608af780cd49d5578fe70ab1313485b
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> fs/btrfs/tree-log.c:5718:71: sparse: sparse: incorrect type in argument 1 (different base types)
>> fs/btrfs/tree-log.c:5718:71: sparse:    expected struct btrfs_root *root
>> fs/btrfs/tree-log.c:5718:71: sparse:    got struct btrfs_fs_info *fs_info
   arch/x86/include/asm/bitops.h:115:37: sparse: sparse: cast truncates bits from constant value (ffffff7f becomes 7f)
   arch/x86/include/asm/bitops.h:115:37: sparse: sparse: cast truncates bits from constant value (ffffff7f becomes 7f)
   arch/x86/include/asm/bitops.h:115:37: sparse: sparse: cast truncates bits from constant value (ffffff7f becomes 7f)
   fs/btrfs/tree-log.c: In function 'btrfs_recover_log_trees':
   fs/btrfs/tree-log.c:5718:43: error: passing argument 1 of 'btrfs_pin_extent_for_log_replay' from incompatible pointer type [-Werror=incompatible-pointer-types]
        ret = btrfs_pin_extent_for_log_replay(fs_info,
                                              ^~~~~~~
   In file included from fs/btrfs/tree-log.h:22:0,
                    from fs/btrfs/tree-log.c:23:
   fs/btrfs/ctree.h:2578:5: note: expected 'struct btrfs_root *' but argument is of type 'struct btrfs_fs_info *'
    int btrfs_pin_extent_for_log_replay(struct btrfs_root *root,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +5718 fs/btrfs/tree-log.c

  5624	
  5625	/*
  5626	 * should be called during mount to recover any replay any log trees
  5627	 * from the FS
  5628	 */
  5629	int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
  5630	{
  5631		int ret;
  5632		struct btrfs_path *path;
  5633		struct btrfs_trans_handle *trans;
  5634		struct btrfs_key key;
  5635		struct btrfs_key found_key;
  5636		struct btrfs_key tmp_key;
  5637		struct btrfs_root *log;
  5638		struct btrfs_fs_info *fs_info = log_root_tree->fs_info;
  5639		struct walk_control wc = {
  5640			.process_func = process_one_buffer,
  5641			.stage = 0,
  5642		};
  5643	
  5644		path = btrfs_alloc_path();
  5645		if (!path)
  5646			return -ENOMEM;
  5647	
  5648		set_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags);
  5649	
  5650		trans = btrfs_start_transaction(fs_info->tree_root, 0);
  5651		if (IS_ERR(trans)) {
  5652			ret = PTR_ERR(trans);
  5653			goto error;
  5654		}
  5655	
  5656		wc.trans = trans;
  5657		wc.pin = 1;
  5658	
  5659		ret = walk_log_tree(trans, log_root_tree, &wc);
  5660		if (ret) {
  5661			btrfs_handle_fs_error(fs_info, ret,
  5662				"Failed to pin buffers while recovering log root tree.");
  5663			goto error;
  5664		}
  5665	
  5666	again:
  5667		key.objectid = BTRFS_TREE_LOG_OBJECTID;
  5668		key.offset = (u64)-1;
  5669		key.type = BTRFS_ROOT_ITEM_KEY;
  5670	
  5671		while (1) {
  5672			ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0);
  5673	
  5674			if (ret < 0) {
  5675				btrfs_handle_fs_error(fs_info, ret,
  5676					    "Couldn't find tree log root.");
  5677				goto error;
  5678			}
  5679			if (ret > 0) {
  5680				if (path->slots[0] == 0)
  5681					break;
  5682				path->slots[0]--;
  5683			}
  5684			btrfs_item_key_to_cpu(path->nodes[0], &found_key,
  5685					      path->slots[0]);
  5686			btrfs_release_path(path);
  5687			if (found_key.objectid != BTRFS_TREE_LOG_OBJECTID)
  5688				break;
  5689	
  5690			log = btrfs_read_fs_root(log_root_tree, &found_key);
  5691			if (IS_ERR(log)) {
  5692				ret = PTR_ERR(log);
  5693				btrfs_handle_fs_error(fs_info, ret,
  5694					    "Couldn't read tree log root.");
  5695				goto error;
  5696			}
  5697	
  5698			tmp_key.objectid = found_key.offset;
  5699			tmp_key.type = BTRFS_ROOT_ITEM_KEY;
  5700			tmp_key.offset = (u64)-1;
  5701	
  5702			wc.replay_dest = btrfs_read_fs_root_no_name(fs_info, &tmp_key);
  5703			if (IS_ERR(wc.replay_dest)) {
  5704				ret = PTR_ERR(wc.replay_dest);
  5705	
  5706				/*
  5707				 * We didn't find the subvol, likely because it was
  5708				 * deleted.  This is ok, simply skip this log and go to
  5709				 * the next one.
  5710				 *
  5711				 * We need to exclude the root because we can't have
  5712				 * other log replays overwriting this log as we'll read
  5713				 * it back in a few more times.  This will keep our
  5714				 * block from being modified, and we'll just bail for
  5715				 * each subsequent pass.
  5716				 */
  5717				if (ret == -ENOENT)
> 5718					ret = btrfs_pin_extent_for_log_replay(fs_info,
  5719								log->node->start,
  5720								log->node->len);
  5721				free_extent_buffer(log->node);
  5722				free_extent_buffer(log->commit_root);
  5723				kfree(log);
  5724	
  5725				if (!ret)
  5726					goto next;
  5727				btrfs_handle_fs_error(fs_info, ret,
  5728					"Couldn't read target root for tree log recovery.");
  5729				goto error;
  5730			}
  5731	
  5732			wc.replay_dest->log_root = log;
  5733			btrfs_record_root_in_trans(trans, wc.replay_dest);
  5734			ret = walk_log_tree(trans, log, &wc);
  5735	
  5736			if (!ret && wc.stage == LOG_WALK_REPLAY_ALL) {
  5737				ret = fixup_inode_link_counts(trans, wc.replay_dest,
  5738							      path);
  5739			}
  5740	
  5741			if (!ret && wc.stage == LOG_WALK_REPLAY_ALL) {
  5742				struct btrfs_root *root = wc.replay_dest;
  5743	
  5744				btrfs_release_path(path);
  5745	
  5746				/*
  5747				 * We have just replayed everything, and the highest
  5748				 * objectid of fs roots probably has changed in case
  5749				 * some inode_item's got replayed.
  5750				 *
  5751				 * root->objectid_mutex is not acquired as log replay
  5752				 * could only happen during mount.
  5753				 */
  5754				ret = btrfs_find_highest_objectid(root,
  5755							  &root->highest_objectid);
  5756			}
  5757	
  5758			wc.replay_dest->log_root = NULL;
  5759			free_extent_buffer(log->node);
  5760			free_extent_buffer(log->commit_root);
  5761			kfree(log);
  5762	
  5763			if (ret)
  5764				goto error;
  5765	next:
  5766			if (found_key.offset == 0)
  5767				break;
  5768			key.offset = found_key.offset - 1;
  5769		}
  5770		btrfs_release_path(path);
  5771	
  5772		/* step one is to pin it all, step two is to replay just inodes */
  5773		if (wc.pin) {
  5774			wc.pin = 0;
  5775			wc.process_func = replay_one_buffer;
  5776			wc.stage = LOG_WALK_REPLAY_INODES;
  5777			goto again;
  5778		}
  5779		/* step three is to replay everything */
  5780		if (wc.stage < LOG_WALK_REPLAY_ALL) {
  5781			wc.stage++;
  5782			goto again;
  5783		}
  5784	
  5785		btrfs_free_path(path);
  5786	
  5787		/* step 4: commit the transaction, which also unpins the blocks */
  5788		ret = btrfs_commit_transaction(trans, fs_info->tree_root);
  5789		if (ret)
  5790			return ret;
  5791	
  5792		free_extent_buffer(log_root_tree->node);
  5793		log_root_tree->log_root = NULL;
  5794		clear_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags);
  5795		kfree(log_root_tree);
  5796	
  5797		return 0;
  5798	error:
  5799		if (wc.trans)
  5800			btrfs_end_transaction(wc.trans, fs_info->tree_root);
  5801		btrfs_free_path(path);
  5802		return ret;
  5803	}
  5804	

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-27  7:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-27  7:46 [sashal-linux-stable:queue-4.9 1/94] fs/btrfs/tree-log.c:5718:71: sparse: sparse: incorrect type in argument 1 (different base types) kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.