Please ignore this... I'll send a new version. Thanks.
> -----Original Message----- > From: 常凤楠 > Sent: Sunday, April 24, 2022 11:21 AM > To: [email protected]; [email protected] > Cc: [email protected]; 常凤楠 > <[email protected]> > Subject: [RFC PATCH] f2fs: support follword recovery for compressed files > > Try support follword recovery for compressed files, this is a rough version, > need more test to improve it. > > Signed-off-by: Fengnan Chang <[email protected]> > --- > fs/f2fs/node.c | 7 +++++++ > fs/f2fs/recovery.c | 10 +++++++++- > 2 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index > c280f482c741..50211e8e7ec3 100644 > --- a/fs/f2fs/node.c > +++ b/fs/f2fs/node.c > @@ -2803,6 +2803,13 @@ int f2fs_recover_inode_page(struct f2fs_sb_info > *sbi, struct page *page) > dst->i_crtime = src->i_crtime; > dst->i_crtime_nsec = src->i_crtime_nsec; > } > + if (f2fs_sb_has_compression(sbi) && src->i_flags & > F2FS_COMPR_FL > + && F2FS_FITS_IN_INODE(src, src->i_extra_isize, > i_log_cluster_size)) { > + dst->i_blocks = src->i_blocks; > + dst->i_compress_algorithm = src->i_compress_algorithm; > + dst->i_compr_blocks = src->i_compr_blocks; > + dst->i_log_cluster_size = src->i_log_cluster_size; > + } > } > > new_ni = old_ni; > diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index > 3cb7f8a43b4d..c01d3a3e5410 100644 > --- a/fs/f2fs/recovery.c > +++ b/fs/f2fs/recovery.c > @@ -636,7 +636,6 @@ static int do_recover_data(struct f2fs_sb_info *sbi, > struct inode *inode, > > src = f2fs_data_blkaddr(&dn); > dest = data_blkaddr(dn.inode, page, dn.ofs_in_node); > - > if (__is_valid_data_blkaddr(src) && > !f2fs_is_valid_blkaddr(sbi, src, META_POR)) { > err = -EFSCORRUPTED; > @@ -669,6 +668,11 @@ static int do_recover_data(struct f2fs_sb_info *sbi, > struct inode *inode, > * and then reserve one new block in dnode page. > */ > if (dest == NEW_ADDR) { > + if (f2fs_compressed_file(inode)) { > + recovered++; > + f2fs_update_data_blkaddr(&dn, dest); > + continue; > + } > f2fs_truncate_data_blocks_range(&dn, 1); > f2fs_reserve_new_block(&dn); > continue; > @@ -702,6 +706,10 @@ static int do_recover_data(struct f2fs_sb_info *sbi, > struct inode *inode, > f2fs_replace_block(sbi, &dn, src, dest, > ni.version, false, false); > recovered++; > + } else if (f2fs_compressed_file(inode) && > + (dest == COMPRESS_ADDR)) { > + recovered++; > + f2fs_update_data_blkaddr(&dn, dest); > } > } > > -- _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
