[linux-next:master 3611/4062] lib/maple_tree.c:4022 mas_wr_spanning_store() warn: inconsistent indenting

[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:   c6d7e3b385f19869ab96e9404c92ff1abc34f2c8
commit: 5b979a0bc9ed8749e385a651f53c3a923cbaba9e [3611/4062] maple_tree: change spanning store to work on larger trees
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220616/202206162357.8GGQoQpW-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

smatch warnings:
lib/maple_tree.c:4022 mas_wr_spanning_store() warn: inconsistent indenting

vim +4022 lib/maple_tree.c

  3886	
  3887	/*
  3888	 * mas_new_root() - Create a new root node that only contains the entry passed
  3889	 * in.
  3890	 * @mas: The maple state
  3891	 * @entry: The entry to store.
  3892	 *
  3893	 * Only valid when the index == 0 and the last == ULONG_MAX
  3894	 *
  3895	 * Return 0 on error, 1 on success.
  3896	 */
  3897	static inline int mas_new_root(struct ma_state *mas, void *entry)
  3898	{
  3899		struct maple_enode *root = mas_root_locked(mas);
  3900		enum maple_type type = maple_leaf_64;
  3901		struct maple_node *node;
  3902		void __rcu **slots;
  3903		unsigned long *pivots;
  3904	
  3905		if (!entry && !mas->index && mas->last == ULONG_MAX) {
  3906			mas->depth = 0;
  3907			mas_set_height(mas);
  3908			rcu_assign_pointer(mas->tree->ma_root, entry);
  3909			mas->node = MAS_START;
  3910			goto done;
  3911		}
  3912	
  3913		mas_node_count(mas, 1);
  3914		if (mas_is_err(mas))
  3915			return 0;
  3916	
  3917		node = mas_pop_node(mas);
  3918		pivots = ma_pivots(node, type);
  3919		slots = ma_slots(node, type);
  3920		node->parent = ma_parent_ptr(
  3921			      ((unsigned long)mas->tree | MA_ROOT_PARENT));
  3922		mas->node = mt_mk_node(node, type);
  3923		rcu_assign_pointer(slots[0], entry);
  3924		pivots[0] = mas->last;
  3925		mas->depth = 1;
  3926		mas_set_height(mas);
  3927		rcu_assign_pointer(mas->tree->ma_root, mte_mk_root(mas->node));
  3928	
  3929	done:
  3930		if (xa_is_node(root))
  3931			mte_destroy_walk(root, mas->tree);
  3932	
  3933		return 1;
  3934	}
  3935	/*
  3936	 * mas_wr_spanning_store() - Create a subtree with the store operation completed
  3937	 * and new nodes where necessary, then place the sub-tree in the actual tree.
  3938	 * Note that mas is expected to point to the node which caused the store to
  3939	 * span.
  3940	 * @wr_mas: The maple write state
  3941	 *
  3942	 * Return: 0 on error, positive on success.
  3943	 */
  3944	static inline int mas_wr_spanning_store(struct ma_wr_state *wr_mas)
  3945	{
  3946		struct maple_subtree_state mast;
  3947		struct maple_big_node b_node;
  3948		struct ma_state *mas;
  3949		unsigned char height;
  3950	
  3951		/* Left and Right side of spanning store */
  3952		MA_STATE(l_mas, NULL, 0, 0);
  3953		MA_STATE(r_mas, NULL, 0, 0);
  3954	
  3955		MA_WR_STATE(r_wr_mas, &r_mas, wr_mas->entry);
  3956		MA_WR_STATE(l_wr_mas, &l_mas, wr_mas->entry);
  3957	
  3958		/*
  3959		 * A store operation that spans multiple nodes is called a spanning
  3960		 * store and is handled early in the store call stack by the function
  3961		 * mas_is_span_wr().  When a spanning store is identified, the maple
  3962		 * state is duplicated.  The first maple state walks the left tree path
  3963		 * to ``index``, the duplicate walks the right tree path to ``last``.
  3964		 * The data in the two nodes are combined into a single node, two nodes,
  3965		 * or possibly three nodes (see the 3-way split above).  A ``NULL``
  3966		 * written to the last entry of a node is considered a spanning store as
  3967		 * a rebalance is required for the operation to complete and an overflow
  3968		 * of data may happen.
  3969		 */
  3970		mas = wr_mas->mas;
  3971		trace_ma_op(__func__, mas);
  3972	
  3973		if (unlikely(!mas->index && mas->last == ULONG_MAX))
  3974			return mas_new_root(mas, wr_mas->entry);
  3975		/*
  3976		 * Node rebalancing may occur due to this store, so there may be two new
  3977		 * entries per level plus a new root.
  3978		 */
  3979		height = mas_mt_height(mas);
  3980		mas_node_count(mas, 1 + height * 3);
  3981		if (mas_is_err(mas))
  3982			return 0;
  3983	
  3984		/*
  3985		 * Set up right side.  Need to get to the next offset after the spanning
  3986		 * store to ensure it's not NULL and to combine both the next node and
  3987		 * the node with the start together.
  3988		 */
  3989		r_mas = *mas;
  3990		/* Avoid overflow, walk to next slot in the tree. */
  3991		if (r_mas.last + 1)
  3992			r_mas.last++;
  3993	
  3994		r_mas.index = r_mas.last;
  3995		mas_wr_walk_index(&r_wr_mas);
  3996		r_mas.last = r_mas.index = mas->last;
  3997	
  3998		/* Set up left side. */
  3999		l_mas = *mas;
  4000		mas_wr_walk_index(&l_wr_mas);
  4001	
  4002		if (!wr_mas->entry) {
  4003			mas_extend_spanning_null(&l_wr_mas, &r_wr_mas);
  4004			mas->offset = l_mas.offset;
  4005			mas->index = l_mas.index;
  4006			mas->last = l_mas.last = r_mas.last;
  4007		}
  4008	
  4009		memset(&b_node, 0, sizeof(struct maple_big_node));
  4010		/* Copy l_mas and store the value in b_node. */
  4011		mas_store_b_node(&l_wr_mas, &b_node, l_wr_mas.node_end);
  4012		/* Copy r_mas into b_node. */
  4013		if (r_mas.offset <= r_wr_mas.node_end)
  4014			mas_mab_cp(&r_mas, r_mas.offset, r_wr_mas.node_end,
  4015				   &b_node, b_node.b_end + 1);
  4016		/* Stop spanning searches by searching for just index. */
  4017		l_mas.index = l_mas.last = mas->index;
  4018	
  4019		mast.bn = &b_node;
  4020		mast.orig_l = &l_mas;
  4021		mast.orig_r = &r_mas;
> 4022			if (mte_dead_node(mast.orig_l->node) ||
  4023			    mte_dead_node(mast.orig_r->node)) {
  4024				printk("FUCKED.  l is %s and r is %s\n",
  4025			       mte_dead_node(mast.orig_l->node) ? "dead" : "alive",
  4026			       mte_dead_node(mast.orig_r->node) ? "dead" : "alive");
  4027				printk("Writing %lu-%lu\n", mas->index, mas->last);
  4028			}
  4029		/* Combine l_mas and r_mas and split them up evenly again. */
  4030		return mas_spanning_rebalance(mas, &mast, height + 1);
  4031	}
  4032	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp




[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