[dm-devel] [device-mapper-dm:for-next 2/4] drivers/md/persistent-data/dm-extent-allocator.c:88: warning: Function parameter or member 'n' not described in '__free_node'
kernel test robot
lkp at intel.com
Fri Sep 15 04:32:17 UTC 2023
tree: https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
head: 805d736ee48c10d8770f998127887795ffb0106f
commit: 064fc5e0e09b49033693b07003c142d0be27a009 [2/4] dm persistent data: Introduce extent allocator
config: riscv-defconfig (https://download.01.org/0day-ci/archive/20230915/202309151251.TkVrLtEd-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230915/202309151251.TkVrLtEd-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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309151251.TkVrLtEd-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/md/persistent-data/dm-extent-allocator.c:88: warning: Function parameter or member 'n' not described in '__free_node'
>> drivers/md/persistent-data/dm-extent-allocator.c:88: warning: Excess function parameter 'node' description in '__free_node'
>> drivers/md/persistent-data/dm-extent-allocator.c:111: warning: Cannot understand * @ea: Pointer to the extent allocator.
on line 111 - I thought it was a doc line
>> drivers/md/persistent-data/dm-extent-allocator.c:217: warning: Function parameter or member 'flags' not described in '__prealloc_nodes'
>> drivers/md/persistent-data/dm-extent-allocator.c:313: warning: Function parameter or member 'n' not described in '__split_leaf'
>> drivers/md/persistent-data/dm-extent-allocator.c:313: warning: Excess function parameter 'node' description in '__split_leaf'
vim +88 drivers/md/persistent-data/dm-extent-allocator.c
81
82 /**
83 * __free_node - Frees a node in the extent allocator.
84 * @ea: Pointer to the extent allocator.
85 * @node: Node to free.
86 */
87 static inline void __free_node(struct dm_extent_allocator *ea, struct node *n)
> 88 {
89 struct list_head *l = (struct list_head *)n;
90
91 list_add(l, &ea->free_nodes);
92 ea->nr_free_nodes++;
93 }
94
95 /**
96 * __alloc_node - Allocates a node from the extent allocator.
97 * @ea: Pointer to the extent allocator.
98 */
99 static inline struct node *__alloc_node(struct dm_extent_allocator *ea)
100 {
101 struct list_head *l;
102
103 l = ea->free_nodes.next;
104 list_del(l);
105 ea->nr_free_nodes--;
106
107 return (struct node *) l;
108 }
109
110 /**
> 111 * @ea: Pointer to the extent allocator.
112 * @node: Index of the node to query.
113 *
114 * Returns: The number of free blocks in the node.
115 */
116 static inline uint64_t __nr_free_blocks(struct node *n)
117 {
118 if (!n)
119 return 0;
120
121 if (n->is_leaf)
122 return n->end - n->begin;
123 else
124 return n->u.internal.nr_free;
125 }
126
127 /**
128 * __free_tree - Frees all nodes in a tree.
129 * @ea: Pointer to the extent allocator.
130 * @n: Pointer to the root node of the tree to free.
131 */
132 static void __free_tree(struct dm_extent_allocator *ea, struct node *n)
133 {
134 if (!n)
135 return;
136
137 if (n->is_leaf)
138 __free_node(ea, n);
139 else {
140 __free_tree(ea, n->u.internal.left);
141 __free_tree(ea, n->u.internal.right);
142 }
143 }
144
145 /**
146 * __setup_initial_root - Sets up the initial root node for the extent allocator.
147 * @ea: Pointer to the extent allocator.
148 *
149 * The root node is a leaf node that spans the entire device.
150 */
151 static void __setup_initial_root(struct dm_extent_allocator *ea)
152 {
153 struct node *n;
154 struct leaf *l;
155
156 n = ea->root = __alloc_node(ea);
157 n->is_left_child = true;
158 n->is_leaf = true;
159 n->nr_holders = 0;
160 n->begin = 0;
161 n->end = ea->nr_blocks;
162 n->parent = NULL;
163
164 l = &n->u.leaf;
165 INIT_LIST_HEAD(&l->holders);
166 }
167
168 /**
169 * free_node_list - Frees a list of nodes.
170 * @l: Pointer to the list head of the nodes to free.
171 */
172 static void free_node_list(struct list_head *l)
173 {
174 struct list_head *e, *tmp;
175
176 list_for_each_safe(e, tmp, l) {
177 list_del(e);
178 kfree(e);
179 }
180 }
181
182 /**
183 * alloc_node_list - Allocates a list of nodes.
184 * @nr: Number of nodes to allocate.
185 * @flags: Flags to pass to kmalloc.
186 * @result: Pointer to the list head to store the allocated nodes.
187 *
188 * Used to initialise the free list of nodes.
189 * Returns: 0 on success, or -ENOMEM if allocation failed.
190 */
191 static int alloc_node_list(unsigned nr, int flags, struct list_head *result)
192 {
193 int i;
194
195 INIT_LIST_HEAD(result);
196
197 for (i = 0; i < nr; i++) {
198 struct node *n = kmalloc(sizeof(*n), flags);
199 struct list_head *l = (struct list_head *) n;
200 if (!n) {
201 free_node_list(result);
202 return -ENOMEM;
203 }
204
205 list_add(l, result);
206 }
207
208 return 0;
209 }
210
211 /**
212 * __prealloc_nodes - Preallocates nodes for allocation contexts.
213 * @ea: Pointer to the extent allocator.
214 * @nr: Number of nodes to preallocate.
215 */
216 static void __prealloc_nodes(struct dm_extent_allocator *ea, unsigned nr, int flags)
> 217 {
218 int r;
219 struct list_head new_nodes;
220
221 r = alloc_node_list(nr, flags, &new_nodes);
222 if (!r) {
223 struct list_head *e, *tmp;
224 list_for_each_safe(e, tmp, &new_nodes) {
225 list_del(e);
226 __free_node(ea, (struct node *)e);
227 }
228 ea->nr_preallocated_nodes += nr;
229 }
230 }
231
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the dm-devel
mailing list