During mkfs, once we have issued discard for all device, we can set
CP_TRIMMED_FLAG in cp pack, this can make kernel module to record
undiscard blocks correctly, it will help to avoid unneeded discard.
Also this patch makes f2fs-tools be with the ability of recognizing
that new flag.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
MSG(0, "%s", " fastboot");
if (flag & CP_NAT_BITS_FLAG)
MSG(0, "%s", " nat_bits");
+ if (flag & CP_TRIMMED_FLAG)
+ MSG(0, "%s", " trimmed");
if (flag & CP_UMOUNT_FLAG)
MSG(0, "%s", " unmount");
else
int dbg_lv;
int show_dentry;
int trim;
+ int trimmed;
int func;
void *private;
int fix_on;
/*
* For checkpoint
*/
+#define CP_TRIMMED_FLAG 0x00000100
#define CP_NAT_BITS_FLAG 0x00000080
#define CP_CRC_RECOVERY_FLAG 0x00000040
#define CP_FASTBOOT_FLAG 0x00000020
c.heap = 0;
c.vol_label = "";
c.trim = 1;
+ c.trimmed = 0;
c.ro = 0;
c.kd = -1;
}
if (get_cp(cp_pack_total_block_count) <=
(1 << get_sb(log_blocks_per_seg)) - nat_bits_blocks)
flags |= CP_NAT_BITS_FLAG;
+
+ if (c.trimmed)
+ flags |= CP_TRIMMED_FLAG;
+
set_cp(ckpt_flags, flags);
set_cp(cp_pack_start_sum, 1 + get_sb(cp_payload));
set_cp(valid_node_count, 1);
for (i = 0; i < c.ndevs; i++)
if (trim_device(i))
return -1;
+ c.trimmed = 1;
return 0;
}