dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: damien.lemoal@wdc.com
Cc: dm-devel@redhat.com
Subject: [dm-devel] [bug report] dm: introduce zone append emulation
Date: Fri, 18 Jun 2021 15:22:03 +0300	[thread overview]
Message-ID: <YMyP68Q7tNnn+ZpQ@mwanda> (raw)

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.

   209                          if (!md->zwp_offset)
   210                                  return -ENOMEM;
   211                  }
   212                  md->zwp_offset[idx] = dm_get_zone_wp_offset(zone);
   213  
   214                  break;
   215          default:
   216                  DMERR("Invalid zone type 0x%x at sectors %llu",
   217                        (int)zone->type, zone->start);
   218                  return -ENODEV;
   219          }
   220  
   221          return 0;
   222  }

regards,
dan carpenter

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


             reply	other threads:[~2021-06-18 12:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 12:22 Dan Carpenter [this message]
2021-06-18 12:24 ` [dm-devel] [bug report] dm: introduce zone append emulation Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YMyP68Q7tNnn+ZpQ@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=damien.lemoal@wdc.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).