tree:   
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git 
for-next
head:   526abb2e9c152c30d398d46e48fe8176640192c2
commit: 1c684a9c9a6efbcb28a4d00bc9b6d40a4a141921 [3/5] dm persistent data: 
Introduce extent allocator
config: i386-randconfig-062-20230916 
(https://download.01.org/0day-ci/archive/20230916/202309161339.iy8ardef-...@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20230916/202309161339.iy8ardef-...@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 <l...@intel.com>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202309161339.iy8ardef-...@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/md/persistent-data/dm-extent-allocator.c:204:57: sparse: sparse: 
>> incorrect type in argument 2 (different base types) @@     expected 
>> restricted gfp_t [usertype] flags @@     got int flags @@
   drivers/md/persistent-data/dm-extent-allocator.c:204:57: sparse:     
expected restricted gfp_t [usertype] flags
   drivers/md/persistent-data/dm-extent-allocator.c:204:57: sparse:     got int 
flags
>> drivers/md/persistent-data/dm-extent-allocator.c:252:48: sparse: sparse: 
>> incorrect type in argument 3 (different base types) @@     expected int 
>> flags @@     got restricted gfp_t @@
   drivers/md/persistent-data/dm-extent-allocator.c:252:48: sparse:     
expected int flags
   drivers/md/persistent-data/dm-extent-allocator.c:252:48: sparse:     got 
restricted gfp_t
>> drivers/md/persistent-data/dm-extent-allocator.c:532:41: sparse: sparse: 
>> incorrect type in argument 3 (different base types) @@     expected int 
>> flags @@     got restricted gfp_t [usertype] @@
   drivers/md/persistent-data/dm-extent-allocator.c:532:41: sparse:     
expected int flags
   drivers/md/persistent-data/dm-extent-allocator.c:532:41: sparse:     got 
restricted gfp_t [usertype]

vim +204 drivers/md/persistent-data/dm-extent-allocator.c

   187  
   188  /**
   189   * alloc_node_list - Allocates a list of nodes.
   190   * @nr: Number of nodes to allocate.
   191   * @flags: Flags to pass to kmalloc.
   192   * @result: Pointer to the list head to store the allocated nodes.
   193   *
   194   * Used to initialise the free list of nodes.
   195   * Returns: 0 on success, or -ENOMEM if allocation failed.
   196   */
   197  static int alloc_node_list(unsigned nr, int flags, struct list_head 
*result)
   198  {
   199          int i;
   200  
   201          INIT_LIST_HEAD(result);
   202  
   203          for (i = 0; i < nr; i++) {
 > 204                  struct ea_node *n = kmalloc(sizeof(*n), flags);
   205                  struct list_head *l = (struct list_head *) n;
   206                  if (!n) {
   207                          free_node_list(result);
   208                          return -ENOMEM;
   209                  }
   210  
   211                  list_add(l, result);
   212          }
   213  
   214          return 0;
   215  }
   216  
   217  /**
   218   * __prealloc_nodes - Preallocates nodes for allocation contexts.
   219   * @ea: Pointer to the extent allocator.
   220   * @nr: Number of nodes to preallocate.
   221   */
   222  static void __prealloc_nodes(struct dm_extent_allocator *ea, unsigned 
nr, int flags)
   223  {
   224          int r;
   225          struct list_head new_nodes;
   226  
   227          r = alloc_node_list(nr, flags, &new_nodes);
   228          if (!r) {
   229                  struct list_head *e, *tmp;
   230                  list_for_each_safe(e, tmp, &new_nodes) {
   231                          list_del(e);
   232                          __free_node(ea, (struct ea_node *)e);
   233                  }
   234                  ea->nr_preallocated_nodes += nr;
   235          }
   236  }
   237  
   238  struct dm_extent_allocator *dm_extent_allocator_create(uint64_t 
nr_blocks)
   239  {
   240          struct dm_extent_allocator *ea = kmalloc(sizeof(*ea), 
GFP_KERNEL);
   241  
   242          if (!ea)
   243                  return NULL;
   244  
   245          spin_lock_init(&ea->lock);
   246          ea->nr_blocks = nr_blocks;
   247          ea->nr_preallocated_nodes = 0;
   248          ea->nr_free_nodes = 0;
   249          ea->nr_allocation_contexts = 0;
   250  
   251          INIT_LIST_HEAD(&ea->free_nodes);
 > 252          __prealloc_nodes(ea, INITIAL_NR_NODES, GFP_KERNEL);
   253          INIT_LIST_HEAD(&ea->allocation_contexts);
   254          __setup_initial_root(ea);
   255  
   256          return ea;
   257  }
   258  EXPORT_SYMBOL_GPL(dm_extent_allocator_create);
   259  

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

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to