From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752187AbdJ3DiF (ORCPT ); Sun, 29 Oct 2017 23:38:05 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:9543 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752153AbdJ3DiD (ORCPT ); Sun, 29 Oct 2017 23:38:03 -0400 Subject: Re: [PATCH v2 RESEND] Revert "f2fs: handle dirty segments inside refresh_sit_entry" To: Yunlong Song , , CC: , , , , , References: <20171028115709.4622-1-chao@kernel.org> <1509327221-159302-1-git-send-email-yunlong.song@huawei.com> From: Chao Yu Message-ID: <043afe52-6c41-933f-9382-07cee10f447f@huawei.com> Date: Mon, 30 Oct 2017 11:36:50 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1509327221-159302-1-git-send-email-yunlong.song@huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.59F69E92.000F,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 89cd03c13581950815ff48acc6ffbcc7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/10/30 9:33, Yunlong Song wrote: > This reverts commit 5e443818fa0b2a2845561ee25bec181424fb2889 > > The commit should be reverted because call sequence of below two parts > of code must be kept: > a. update sit information, it needs to be updated before segment > allocation since latter allocation may trigger SSR, and SSR allocation > needs latest valid block information of all segments. > b. update segment status, it needs to be updated after segment allocation > since we can skip updating current opened segment status. > > Fixes: 5e443818fa0b ("f2fs: handle dirty segments inside refresh_sit_entry") > Suggested-by: Chao Yu > Signed-off-by: Yunlong Song Reviewed-by: Chao Yu Thanks, > --- > fs/f2fs/f2fs.h | 1 - > fs/f2fs/segment.c | 20 +++++++++++++------- > 2 files changed, 13 insertions(+), 8 deletions(-) > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index 13a96b8..f166112 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -2567,7 +2567,6 @@ int restore_node_summary(struct f2fs_sb_info *sbi, > bool is_checkpointed_data(struct f2fs_sb_info *sbi, block_t blkaddr); > void init_discard_policy(struct discard_policy *dpolicy, int discard_type, > unsigned int granularity); > -void refresh_sit_entry(struct f2fs_sb_info *sbi, block_t old, block_t new); > void stop_discard_thread(struct f2fs_sb_info *sbi); > bool f2fs_wait_discard_bios(struct f2fs_sb_info *sbi); > void clear_prefree_segments(struct f2fs_sb_info *sbi, struct cp_control *cpc); > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index 46dfbca..a3509e9 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -1884,14 +1884,11 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del) > get_sec_entry(sbi, segno)->valid_blocks += del; > } > > -void refresh_sit_entry(struct f2fs_sb_info *sbi, block_t old, block_t new) > +static void refresh_sit_entry(struct f2fs_sb_info *sbi, block_t old, block_t new) > { > update_sit_entry(sbi, new, 1); > if (GET_SEGNO(sbi, old) != NULL_SEGNO) > update_sit_entry(sbi, old, -1); > - > - locate_dirty_segment(sbi, GET_SEGNO(sbi, old)); > - locate_dirty_segment(sbi, GET_SEGNO(sbi, new)); > } > > void invalidate_blocks(struct f2fs_sb_info *sbi, block_t addr) > @@ -2529,13 +2526,22 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, > > stat_inc_block_count(sbi, curseg); > > + /* > + * SIT information should be updated before segment allocation, > + * since SSR needs latest valid block information. > + */ > + refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr); > + > if (!__has_curseg_space(sbi, type)) > sit_i->s_ops->allocate_segment(sbi, type, false); > + > /* > - * SIT information should be updated after segment allocation, > - * since we need to keep dirty segments precisely under SSR. > + * segment dirty status should be updated after segment allocation, > + * so we just need to update status only one time after previous > + * segment being closed. > */ > - refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr); > + locate_dirty_segment(sbi, GET_SEGNO(sbi, old_blkaddr)); > + locate_dirty_segment(sbi, GET_SEGNO(sbi, *new_blkaddr)); > > mutex_unlock(&sit_i->sentry_lock); > >