On 03/05, Damien Le Moal wrote: > Johannes, > > On 2019/03/04 18:46, Johannes Thumshirn wrote: > > Hi Damien, > > > > On 04/03/2019 08:04, Damien Le Moal wrote: > >> @@ -2765,9 +2765,11 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi) > >> if (nr_sectors & (bdev_zone_sectors(bdev) - 1)) > >> FDEV(devi).nr_blkz++; > >> > >> - FDEV(devi).blkz_type = f2fs_kmalloc(sbi, FDEV(devi).nr_blkz, > >> - GFP_KERNEL); > >> - if (!FDEV(devi).blkz_type) > >> + FDEV(devi).blkz_seq = f2fs_kzalloc(sbi, > >> + BITS_TO_LONGS(FDEV(devi).nr_blkz) > >> + * sizeof(unsigned long), > >> + GFP_KERNEL); > >> + if (!FDEV(devi).blkz_seq) > >> return -ENOMEM; > > > > Not so sure about F2FS internals, but there is a bitmap_zalloc() in the > > normal kernel library. > > Yes indeed... f2fs_kzalloc uses f2fs_kmalloc(__GFP_ZERO) and f2fs_kmalloc is > basically kmalloc() or kvmalloc() but with error injection for tests. So I used > that instead of bitmap_zalloc() to preserve the error injection test. > > Jaegeuk, > > Which do you prefer ? The patch as it is or switching to bitmap_zalloc() ? > Whichever is fine with me so I can send a v2 if you prefer bitmap_zalloc(). Hi Damien, I think f2fs_kmalloc would be fine for fault injection tests. It seems it'd better to write a clean-up patch which replaces all the bitmap allocations in f2fs with single f2fs_bitmap_zalloc() at once. I'll take a look at this. Thanks, > > Best regards. > > -- > Damien Le Moal > Western Digital Research