From: Chao Yu Subject: Re: [PATCH] f2fs: update inode info to inode page for new file Date: Thu, 4 Jan 2018 15:24:38 +0800 Message-ID: <8c1d2178-8255-d0df-3419-86ad0d5ece53@huawei.com> References: <1514973784-16037-1-git-send-email-heyunlei@huawei.com> <42B685BFA705F94C860C6DD0752F056548304326@DGGEMA503-MBX.china.huawei.com> <20180104064620.GB51983@jaegeuk-macbookpro.roam.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.193] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eWztt-0001l5-He for linux-f2fs-devel@lists.sourceforge.net; Thu, 04 Jan 2018 07:25:17 +0000 Received: from [45.249.212.35] (helo=huawei.com) by sfi-mx-3.v28.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) id 1eWzts-0005TJ-BH for linux-f2fs-devel@lists.sourceforge.net; Thu, 04 Jan 2018 07:25:17 +0000 In-Reply-To: <20180104064620.GB51983@jaegeuk-macbookpro.roam.corp.google.com> Content-Language: en-US List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Jaegeuk Kim , heyunlei Cc: "Jianing (Euler)" , "linux-f2fs-devel@lists.sourceforge.net" On 2018/1/4 14:46, Jaegeuk Kim wrote: > On 01/04, heyunlei wrote: >> >> >>> -----Original Message----- >>> From: Yuchao (T) >>> Sent: Thursday, January 04, 2018 11:02 AM >>> To: heyunlei; jaegeuk@kernel.org; linux-f2fs-devel@lists.sourceforge.net >>> Cc: Wangbintian; Jianing (Euler) >>> Subject: Re: [f2fs-dev][PATCH] f2fs: update inode info to inode page for new file >>> >>> On 2018/1/3 18:03, Yunlei He wrote: >>>> | >>>> | 1. creat a new file A ,(with dirty inode >>>> | && dirty inode page && xattr info) >>>> | 2. backgroud wb write back file A inode >>>> last checkpoint | page (without update from inode cache) >>>> | 3. fsync file A, write back inode page of >>>> | file A with inode cache info >>>> | 4. sudden power off before new checkpoint >>>> >>>> In this case, recovery process will try to recover a zero inode >>>> page. Inline xattr flag of file A will be miss and xattr info >>>> will be taken as blkaddr index. >>>> >>>> Signed-off-by: Yunlei He >>>> --- >>>> fs/f2fs/dir.c | 2 ++ >>>> 1 file changed, 2 insertions(+) >>>> >>>> diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c >>>> index 724304d..d04dcac 100644 >>>> --- a/fs/f2fs/dir.c >>>> +++ b/fs/f2fs/dir.c >>>> @@ -427,6 +427,8 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir, >>>> remove_orphan_inode(F2FS_I_SB(dir), inode->i_ino); >>>> f2fs_i_links_write(inode, true); >>>> } >>>> + >>>> + update_inode(inode, page); >>> >>> That would cause memory copy overhead, how about always keeping consistent >>> in-memory inode meta info with the data in recovering inode block as below: >>> >>> recover_inline_xattr() >>> >>> if (ri->i_inline & F2FS_INLINE_XATTR) { >>> set_inode_flag(inode, FI_INLINE_XATTR); >>> } else { >>> clear_inode_flag(inode, FI_INLINE_XATTR); >>> goto update_inode; >>> } > > Ah I see. That doesn't represent parallel things. :P Please add, ;) Reviewed-by: Chao Yu Thanks, > >>> >>> Thanks, >> >> Okay, My f2fs module is not support flexible inline xattr size, this change is enough >> for this problem. > > Let me merge this patch with this. > > Thanks, > >> >> Thanks. >> >>> >>>> return page; >>>> >>>> put_error: >>>> > > . > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot