From: heyunlei Subject: Re: [PATCH] f2fs: skip read if page has been uptodate Date: Tue, 27 Dec 2016 20:31:19 +0800 Message-ID: References: <20161227040548.21541-1-heyunlei@huawei.com> <853b0848-2997-e419-8faa-f41c4772f5eb@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1cLqyB-0000LD-51 for linux-f2fs-devel@lists.sourceforge.net; Tue, 27 Dec 2016 12:35:07 +0000 Received: from [45.249.212.190] (helo=dggrg04-dlp.huawei.com) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1cLqy5-0002gS-TI for linux-f2fs-devel@lists.sourceforge.net; Tue, 27 Dec 2016 12:35:07 +0000 In-Reply-To: <853b0848-2997-e419-8faa-f41c4772f5eb@huawei.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Chao Yu , linux-f2fs-devel@lists.sourceforge.net, jaegeuk@kernel.org Cc: heyunlei@huwei.com On 2016/12/27 20:04, Chao Yu wrote: > On 2016/12/27 12:05, Yunlei He wrote: >> This patch add a judgement before read, if the page has been >> uptodate, move the block directly. >> >> Signed-off-by: Yunlei He >> --- >> fs/f2fs/gc.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c >> index 88bfc3d..40776b4 100644 >> --- a/fs/f2fs/gc.c >> +++ b/fs/f2fs/gc.c >> @@ -602,6 +602,9 @@ static void move_encrypted_block(struct inode *inode, block_t bidx, >> goto recover_block; >> } >> >> + if (PageUptodate(fio.encrypted_page)) > > Seems we can't guarantee that the new allocated block address isn't been used by > another GCed encrypted page last time with SSR mode, so the updated > encrypted_page may contain other file's data? Yes, you are right! Thanks, > > Thanks, > >> + goto skip_read; >> + >> err = f2fs_submit_page_bio(&fio); >> if (err) >> goto put_page_out; >> @@ -613,11 +616,13 @@ static void move_encrypted_block(struct inode *inode, block_t bidx, >> err = -EIO; >> goto put_page_out; >> } >> + >> if (unlikely(!PageUptodate(fio.encrypted_page))) { >> err = -EIO; >> goto put_page_out; >> } >> >> +skip_read: >> set_page_dirty(fio.encrypted_page); >> f2fs_wait_on_page_writeback(fio.encrypted_page, DATA, true); >> if (clear_page_dirty_for_io(fio.encrypted_page)) >> > > > . > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot