* [dm-devel] [bug report] dm: introduce zone append emulation
@ 2021-06-18 12:22 Dan Carpenter
2021-06-18 12:24 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-06-18 12:22 UTC (permalink / raw)
To: damien.lemoal; +Cc: dm-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dm-devel] [bug report] dm: introduce zone append emulation
2021-06-18 12:22 [dm-devel] [bug report] dm: introduce zone append emulation Dan Carpenter
@ 2021-06-18 12:24 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2021-06-18 12:24 UTC (permalink / raw)
To: damien.lemoal; +Cc: dm-devel
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
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-18 12:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 12:22 [dm-devel] [bug report] dm: introduce zone append emulation Dan Carpenter
2021-06-18 12:24 ` Dan Carpenter
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).