diff options
-rw-r--r-- | fs/f2fs/node.c | 12 | ||||
-rw-r--r-- | fs/f2fs/segment.c | 3 |
2 files changed, 6 insertions, 9 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 0177f9434c25..10cbee9dc3d1 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c | |||
@@ -1666,19 +1666,17 @@ static int init_node_manager(struct f2fs_sb_info *sbi) | |||
1666 | spin_lock_init(&nm_i->free_nid_list_lock); | 1666 | spin_lock_init(&nm_i->free_nid_list_lock); |
1667 | rwlock_init(&nm_i->nat_tree_lock); | 1667 | rwlock_init(&nm_i->nat_tree_lock); |
1668 | 1668 | ||
1669 | nm_i->bitmap_size = __bitmap_size(sbi, NAT_BITMAP); | ||
1670 | nm_i->init_scan_nid = le32_to_cpu(sbi->ckpt->next_free_nid); | 1669 | nm_i->init_scan_nid = le32_to_cpu(sbi->ckpt->next_free_nid); |
1671 | nm_i->next_scan_nid = le32_to_cpu(sbi->ckpt->next_free_nid); | 1670 | nm_i->next_scan_nid = le32_to_cpu(sbi->ckpt->next_free_nid); |
1672 | 1671 | nm_i->bitmap_size = __bitmap_size(sbi, NAT_BITMAP); | |
1673 | nm_i->nat_bitmap = kzalloc(nm_i->bitmap_size, GFP_KERNEL); | ||
1674 | if (!nm_i->nat_bitmap) | ||
1675 | return -ENOMEM; | ||
1676 | version_bitmap = __bitmap_ptr(sbi, NAT_BITMAP); | 1672 | version_bitmap = __bitmap_ptr(sbi, NAT_BITMAP); |
1677 | if (!version_bitmap) | 1673 | if (!version_bitmap) |
1678 | return -EFAULT; | 1674 | return -EFAULT; |
1679 | 1675 | ||
1680 | /* copy version bitmap */ | 1676 | nm_i->nat_bitmap = kmemdup(version_bitmap, nm_i->bitmap_size, |
1681 | memcpy(nm_i->nat_bitmap, version_bitmap, nm_i->bitmap_size); | 1677 | GFP_KERNEL); |
1678 | if (!nm_i->nat_bitmap) | ||
1679 | return -ENOMEM; | ||
1682 | return 0; | 1680 | return 0; |
1683 | } | 1681 | } |
1684 | 1682 | ||
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 777f17e496e6..17581495bafb 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -1403,10 +1403,9 @@ static int build_sit_info(struct f2fs_sb_info *sbi) | |||
1403 | bitmap_size = __bitmap_size(sbi, SIT_BITMAP); | 1403 | bitmap_size = __bitmap_size(sbi, SIT_BITMAP); |
1404 | src_bitmap = __bitmap_ptr(sbi, SIT_BITMAP); | 1404 | src_bitmap = __bitmap_ptr(sbi, SIT_BITMAP); |
1405 | 1405 | ||
1406 | dst_bitmap = kzalloc(bitmap_size, GFP_KERNEL); | 1406 | dst_bitmap = kmemdup(src_bitmap, bitmap_size, GFP_KERNEL); |
1407 | if (!dst_bitmap) | 1407 | if (!dst_bitmap) |
1408 | return -ENOMEM; | 1408 | return -ENOMEM; |
1409 | memcpy(dst_bitmap, src_bitmap, bitmap_size); | ||
1410 | 1409 | ||
1411 | /* init SIT information */ | 1410 | /* init SIT information */ |
1412 | sit_i->s_ops = &default_salloc_ops; | 1411 | sit_i->s_ops = &default_salloc_ops; |