Hi Sheng Yong, On 2018/2/9 11:21, Sheng Yong wrote: > Hi, Chao > > Add Hyojun. > > On 2018/2/8 21:30, Chao Yu wrote: >> On 2018/2/6 12:31, Sheng Yong wrote: >>> /* only root inode was written before truncating dnodes */ >>> last_inode_pos = start_inode_pos + >>> - c.cur_seg[CURSEG_HOT_NODE] * c.blks_per_seg + quota_inum; >>> + c.cur_seg[CURSEG_HOT_NODE] * c.blks_per_seg + c.quota_inum; >> >> - f2fs_create_root_dir >> - f2fs_write_root_inode >> - discard_obsolete_dnode >> access c.quota_inum >> - f2fs_write_qf_inode >> update c.quota_inum >> >> Should c.quota_inum be initialized more early? > > I think we should only count quota inodes if thye are already initialized. > Otherwise, if quota_ino is not enabled, there is only one inode (root) in > CURSEG_HOT_NODE, and two blocks next to root inode will not be discarded.
IMO, we need to move discard_obsolete_dnode in to f2fs_create_root_dir as below: - f2fs_create_root_dir - f2fs_write_root_inode - f2fs_write_qf_inode - discard_obsolete_dnode So the last obsolete position can be calculated correctly. Thanks, > > I'm a bit confused about the `offset' scale in discard_obsolete_dnode. > It seems `if (offset >= start_inode_pos || offset <= last_inode_pos)' > will always be true? > > Hi, Hyojun, could you please also have a look at this, thanks :) > > diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c > index 0fc8b30..6c9ae22 100644 > --- a/mkfs/f2fs_format.c > +++ b/mkfs/f2fs_format.c > @@ -963,7 +963,7 @@ static int discard_obsolete_dnode(struct f2fs_node > *raw_node, u_int64_t offset) > } > offset = next_blkaddr; > /* should avoid recursive chain due to stale data */ > - if (offset >= start_inode_pos || offset <= last_inode_pos) > + if (offset <= last_inode_pos) > break; > } while (1); > > thanks, > Sheng >> >> Thanks, >> >> . >> > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel