Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
[platform/kernel/linux-starfive.git] / fs / f2fs / checkpoint.c
index f1693d4..982f017 100644 (file)
@@ -664,7 +664,7 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
        /* truncate all the data during iput */
        iput(inode);
 
-       err = f2fs_get_node_info(sbi, ino, &ni);
+       err = f2fs_get_node_info(sbi, ino, &ni, false);
        if (err)
                goto err_out;
 
@@ -1302,8 +1302,8 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
        unsigned long flags;
 
        if (cpc->reason & CP_UMOUNT) {
-               if (le32_to_cpu(ckpt->cp_pack_total_block_count) >
-                       sbi->blocks_per_seg - NM_I(sbi)->nat_bits_blocks) {
+               if (le32_to_cpu(ckpt->cp_pack_total_block_count) +
+                       NM_I(sbi)->nat_bits_blocks > sbi->blocks_per_seg) {
                        clear_ckpt_flags(sbi, CP_NAT_BITS_FLAG);
                        f2fs_notice(sbi, "Disable nat_bits due to no space");
                } else if (!is_set_ckpt_flags(sbi, CP_NAT_BITS_FLAG) &&