From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753407AbdKIIX1 (ORCPT ); Thu, 9 Nov 2017 03:23:27 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:10042 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753062AbdKIIXY (ORCPT ); Thu, 9 Nov 2017 03:23:24 -0500 Subject: Re: [RFC PATHC 1/2] f2fs: apply write hints to select the type of segments for buffered write To: Hyunchul Lee , Jaegeuk Kim CC: , , , , Hyunchul Lee References: <1510206688-12767-1-git-send-email-hyc.lee@gmail.com> <1510206688-12767-2-git-send-email-hyc.lee@gmail.com> From: Chao Yu Message-ID: <89790335-1d07-9280-ef17-1bdaeaafb54b@huawei.com> Date: Thu, 9 Nov 2017 16:21:25 +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: <1510206688-12767-2-git-send-email-hyc.lee@gmail.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.0A020206.5A041069.000E,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: b18ebedc7d40bc87eca8b99de260a2b5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/11/9 13:51, Hyunchul Lee wrote: > From: Hyunchul Lee > > Write hints helps F2FS to determine which type of segments would be > selected for buffered write. > > This patch implements the mapping from write hints to segment types > as shown below. > > hints segment type > ----- ------------ > WRITE_LIFE_SHORT CURSEG_COLD_DATA > WRITE_LIFE_EXTREME CURSEG_HOT_DATA Should keep consistent with code implementation. WRITE_LIFE_SHORT CURSEG_HOT_DATA WRITE_LIFE_EXTREME CURSEG_COLD_DATA > others CURSEG_WARM_DATA > > the F2FS poliy for hot/cold seperation has precedence over this hints. > And hints are not applied in in-place update. > > Signed-off-by: Hyunchul Lee Reviewed-by: Chao Yu Thanks, > --- > fs/f2fs/segment.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index c695ff4..45aef53 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -2258,6 +2258,18 @@ static bool __has_curseg_space(struct f2fs_sb_info *sbi, int type) > return false; > } > > +int rw_hint_to_seg_type(enum rw_hint hint) > +{ > + switch (hint) { > + case WRITE_LIFE_SHORT: > + return CURSEG_HOT_DATA; > + case WRITE_LIFE_EXTREME: > + return CURSEG_COLD_DATA; > + default: > + return CURSEG_WARM_DATA; > + } > +} > + > static int __get_segment_type_2(struct f2fs_io_info *fio) > { > if (fio->type == DATA) > @@ -2292,7 +2304,7 @@ static int __get_segment_type_6(struct f2fs_io_info *fio) > return CURSEG_COLD_DATA; > if (is_inode_flag_set(inode, FI_HOT_DATA)) > return CURSEG_HOT_DATA; > - return CURSEG_WARM_DATA; > + return rw_hint_to_seg_type(inode->i_write_hint); > } else { > if (IS_DNODE(fio->page)) > return is_cold_node(fio->page) ? CURSEG_WARM_NODE : >