f2fs: spread f2fs_k{m,z}alloc
Use f2fs_k{m,z}alloc as much as possible to increase fault injection points. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
5d4e487b99
commit
e7db649b5f
2 changed files with 10 additions and 8 deletions
|
@ -3543,7 +3543,7 @@ static int build_curseg(struct f2fs_sb_info *sbi)
|
||||||
struct curseg_info *array;
|
struct curseg_info *array;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
array = kcalloc(NR_CURSEG_TYPE, sizeof(*array), GFP_KERNEL);
|
array = f2fs_kzalloc(sbi, sizeof(*array) * NR_CURSEG_TYPE, GFP_KERNEL);
|
||||||
if (!array)
|
if (!array)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -2154,14 +2154,15 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi)
|
||||||
if (nr_sectors & (bdev_zone_sectors(bdev) - 1))
|
if (nr_sectors & (bdev_zone_sectors(bdev) - 1))
|
||||||
FDEV(devi).nr_blkz++;
|
FDEV(devi).nr_blkz++;
|
||||||
|
|
||||||
FDEV(devi).blkz_type = kmalloc(FDEV(devi).nr_blkz, GFP_KERNEL);
|
FDEV(devi).blkz_type = f2fs_kmalloc(sbi, FDEV(devi).nr_blkz,
|
||||||
|
GFP_KERNEL);
|
||||||
if (!FDEV(devi).blkz_type)
|
if (!FDEV(devi).blkz_type)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
#define F2FS_REPORT_NR_ZONES 4096
|
#define F2FS_REPORT_NR_ZONES 4096
|
||||||
|
|
||||||
zones = kcalloc(F2FS_REPORT_NR_ZONES, sizeof(struct blk_zone),
|
zones = f2fs_kzalloc(sbi, sizeof(struct blk_zone) *
|
||||||
GFP_KERNEL);
|
F2FS_REPORT_NR_ZONES, GFP_KERNEL);
|
||||||
if (!zones)
|
if (!zones)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -2305,8 +2306,8 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
|
||||||
* Initialize multiple devices information, or single
|
* Initialize multiple devices information, or single
|
||||||
* zoned block device information.
|
* zoned block device information.
|
||||||
*/
|
*/
|
||||||
sbi->devs = kcalloc(max_devices, sizeof(struct f2fs_dev_info),
|
sbi->devs = f2fs_kzalloc(sbi, sizeof(struct f2fs_dev_info) *
|
||||||
GFP_KERNEL);
|
max_devices, GFP_KERNEL);
|
||||||
if (!sbi->devs)
|
if (!sbi->devs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -2512,8 +2513,9 @@ try_onemore:
|
||||||
int n = (i == META) ? 1: NR_TEMP_TYPE;
|
int n = (i == META) ? 1: NR_TEMP_TYPE;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
sbi->write_io[i] = kmalloc(n * sizeof(struct f2fs_bio_info),
|
sbi->write_io[i] = f2fs_kmalloc(sbi,
|
||||||
GFP_KERNEL);
|
n * sizeof(struct f2fs_bio_info),
|
||||||
|
GFP_KERNEL);
|
||||||
if (!sbi->write_io[i]) {
|
if (!sbi->write_io[i]) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto free_options;
|
goto free_options;
|
||||||
|
|
Loading…
Add table
Reference in a new issue