[dm-devel] [bug report] dm: introduce zone append emulation

Dan Carpenter dan.carpenter at oracle.com
Fri Jun 18 12:24:17 UTC 2021


On Fri, Jun 18, 2021 at 03:22:03PM +0300, Dan Carpenter wrote:
> Hello Damien Le Moal,
> 
> The patch bb37d77239af: "dm: introduce zone append emulation" from
> May 26, 2021, leads to the following static checker warning:
> 
> 	drivers/md/dm-zone.c:207 dm_zone_revalidate_cb()
> 	error: kvmalloc() only makes sense with GFP_KERNEL
> 
> drivers/md/dm-zone.c
>    179  static int dm_zone_revalidate_cb(struct blk_zone *zone, unsigned int idx,
>    180                                   void *data)
>    181  {
>    182          struct mapped_device *md = data;
>    183          struct request_queue *q = md->queue;
>    184  
>    185          switch (zone->type) {
>    186          case BLK_ZONE_TYPE_CONVENTIONAL:
>    187                  if (!q->conv_zones_bitmap) {
>    188                          q->conv_zones_bitmap =
>    189                                  kcalloc(BITS_TO_LONGS(q->nr_zones),
>    190                                          sizeof(unsigned long), GFP_NOIO);
>    191                          if (!q->conv_zones_bitmap)
>    192                                  return -ENOMEM;
>    193                  }
>    194                  set_bit(idx, q->conv_zones_bitmap);
>    195                  break;
>    196          case BLK_ZONE_TYPE_SEQWRITE_REQ:
>    197          case BLK_ZONE_TYPE_SEQWRITE_PREF:
>    198                  if (!q->seq_zones_wlock) {
>    199                          q->seq_zones_wlock =
>    200                                  kcalloc(BITS_TO_LONGS(q->nr_zones),
>    201                                          sizeof(unsigned long), GFP_NOIO);
>    202                          if (!q->seq_zones_wlock)
>    203                                  return -ENOMEM;
>    204                  }
>    205                  if (!md->zwp_offset) {
>    206                          md->zwp_offset =
>    207                                  kvcalloc(q->nr_zones, sizeof(unsigned int),
>    208                                           GFP_NOIO);
> 
> kvcalloc() does not respect the GFP_NOIO flag.
> 

Ugh, what I meant was kvcalloc() with the GFP_NOIO flag is the same as
calling kcalloc(), it won't vmalloc() the memory.

regards,
dan carpenter




More information about the dm-devel mailing list