From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751660AbdBXBdf (ORCPT ); Thu, 23 Feb 2017 20:33:35 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:2892 "EHLO dggrg02-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751246AbdBXBdd (ORCPT ); Thu, 23 Feb 2017 20:33:33 -0500 Subject: Re: [PATCH] f2fs: put allocate_segment after refresh_sit_entry To: Yunlong Song , , , , , References: <1487667566-2110-1-git-send-email-yunlong.song@huawei.com> CC: , , , From: Chao Yu Message-ID: <00a9826a-f6a7-cba5-ba3f-e740b060e03c@huawei.com> Date: Fri, 24 Feb 2017 09:33:16 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1487667566-2110-1-git-send-email-yunlong.song@huawei.com> Content-Type: text/plain; charset="windows-1252" 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.0A0B0204.58AF8D69.003F,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: 02bd898890cc390e55b87dfcb7c12e59 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/2/21 16:59, Yunlong Song wrote: > SIT information should be updated before segment allocation, since SSR needs > latest valid block information. Current code does not update the old_blkaddr > info in sit_entry, so adjust the allocate_segment to its proper location. Commit > 5e443818fa0b2a2845561ee25bec181424fb2889 ("f2fs: handle dirty segments inside > refresh_sit_entry") puts it into wrong location. Not a big deal, because we only count invalid block which has been checkpointed, so current order won't change the result of allocation with SSR. Anyway, it's OK to me. :) Reviewed-by: Chao Yu > > Signed-off-by: Yunlong Song > --- > fs/f2fs/segment.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index df2ff5c..89052df 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -1743,14 +1743,15 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, > > stat_inc_block_count(sbi, curseg); > > - if (!__has_curseg_space(sbi, type)) > - sit_i->s_ops->allocate_segment(sbi, type, false); > /* > * 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); > + > mutex_unlock(&sit_i->sentry_lock); > > if (page && IS_NODESEG(type)) >