From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0770CC433ED for ; Tue, 11 May 2021 06:09:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C090361606 for ; Tue, 11 May 2021 06:09:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230330AbhEKGKK (ORCPT ); Tue, 11 May 2021 02:10:10 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:2622 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229840AbhEKGKI (ORCPT ); Tue, 11 May 2021 02:10:08 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FfS9k3bqZzklf3; Tue, 11 May 2021 14:06:50 +0800 (CST) Received: from [10.136.110.154] (10.136.110.154) by smtp.huawei.com (10.3.19.208) with Microsoft SMTP Server (TLS) id 14.3.498.0; Tue, 11 May 2021 14:07:29 +0800 Subject: Re: [PATCH] f2fs: set file as cold when file defragmentation To: Jaegeuk Kim , CC: "chao@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" References: <20210429062005epcms2p352ef77f96ab66cbffe0c0ab6c1b62d8a@epcms2p3> <3a0ab201-9546-d523-abc7-79df5f637f14@huawei.com> <6e95edca-4802-7650-4771-5389067935dc@huawei.com> From: Chao Yu Message-ID: Date: Tue, 11 May 2021 14:07:29 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.136.110.154] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/5/11 13:09, Jaegeuk Kim wrote: > On 05/11, Chao Yu wrote: >> On 2021/5/10 22:47, Jaegeuk Kim wrote: >>> On 05/06, Chao Yu wrote: >>>> On 2021/5/6 12:46, Jaegeuk Kim wrote: >>>>> On 05/06, Chao Yu wrote: >>>>>> On 2021/4/29 14:20, Daejun Park wrote: >>>>>>> In file defragmentation by ioctl, all data blocks in the file are >>>>>>> re-written out-of-place. File defragmentation implies user will not update >>>>>>> and mostly read the file. So before the defragmentation, we set file >>>>>>> temperature as cold for better block allocation. >>>>>> >>>>>> I don't think all fragmented files are cold, e.g. db file. >>>>> >>>>> I have a bit different opinion. I think one example would be users want to >>>>> defragment a file, when the they want to get higher read bandwidth for >>>> >>>> Multimedia file was already defined as cold file now via default extension >>>> list? >>> >>> I just gave an example. And default is default. >>> >>>> >>>>> usually multimedia files. That's likely to be cold files. Moreover, I don't >>>>> think they want to defragment db files which will be fragmented soon? >>>> >>>> I guess like db files have less update but more access? >>> >>> I think both, and we set it as hot. >> >> Then hot and cold bit will set to the same db file after defragmentation? > > Do you set cold bit to db files? I mean, generally db is not cold, but hot. I never set cold bit to db files, I mean if we defragment db file which has less update and more access, db file may have bot hot and cold bit. To Daejun, may I ask that is Samsung planning to use this defragment ioctl in products? what's the user scenario? Thanks, > >> >> Thanks, >> >>> >>>> >>>> Thanks, >>>> >>>>> >>>>>> >>>>>> We have separated interface (via f2fs_xattr_advise_handler, e.g. setfattr -n >>>>>> "system.advise" -v value) to indicate this file is a hot/cold file, so my >>>>>> suggestion is after file defragmentation, if you think this file is cold, and >>>>>> use setxattr() to set it as cold. >>>>>> >>>>>> Thanks, >>>>>> >>>>>>> >>>>>>> Signed-off-by: Daejun Park >>>>>>> --- >>>>>>> fs/f2fs/file.c | 3 +++ >>>>>>> 1 file changed, 3 insertions(+) >>>>>>> >>>>>>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c >>>>>>> index d697c8900fa7..dcac965a05fe 100644 >>>>>>> --- a/fs/f2fs/file.c >>>>>>> +++ b/fs/f2fs/file.c >>>>>>> @@ -2669,6 +2669,9 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi, >>>>>>> map.m_len = pg_end - pg_start; >>>>>>> total = 0; >>>>>>> + if (!file_is_cold(inode)) >>>>>>> + file_set_cold(inode); >>>>>>> + >>>>>>> while (map.m_lblk < pg_end) { >>>>>>> pgoff_t idx; >>>>>>> int cnt = 0; >>>>>>> >>>>> . >>>>> >>> . >>> > . > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6935C433ED for ; Tue, 11 May 2021 06:09:14 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 294A761606 for ; Tue, 11 May 2021 06:09:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 294A761606 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1lgLZx-0006jQ-Ax; Tue, 11 May 2021 06:09:13 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgLZv-0006jB-QT for linux-f2fs-devel@lists.sourceforge.net; Tue, 11 May 2021 06:09:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:CC:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Ii3IpsKUe6hMWt54vNIwaFm2id6tkLURak2lBHiXaeA=; b=M8AhTBmbH08mNtsTJbxN/l8Szk 3mwAiky4M2I8vY5rBDPd/OPnqWFn8foTOOZzAN5LKg54hHHoVhc+Wg87BuF8HIJdhnlNwpkBVGu7+ pZ6GjeIKgtaW73qXTursHQIWXqTXTFQB/+akjJSv2boPQBEGD7nbLBJVgBOJZiISIFeI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:CC:To:Subject:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Ii3IpsKUe6hMWt54vNIwaFm2id6tkLURak2lBHiXaeA=; b=XMaZ0szpr08qEZSw4tSN8g2EoO vBwAxRzKTBLW4hqiExz4wqL7LZFcQdqwR721Brgop9WglbUVqgrmdZV3KsEsjht7fYkAf3CWCzf4/ I64h2Xu3S0xhvQpaUY362IKk991Er+xl07r1zB6YMnlIZZmILxXXYUrOIYcrouGMMJ2U=; Received: from szxga06-in.huawei.com ([45.249.212.32]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1lgLZt-003Szh-MX for linux-f2fs-devel@lists.sourceforge.net; Tue, 11 May 2021 06:09:12 +0000 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FfS9k3bqZzklf3; Tue, 11 May 2021 14:06:50 +0800 (CST) Received: from [10.136.110.154] (10.136.110.154) by smtp.huawei.com (10.3.19.208) with Microsoft SMTP Server (TLS) id 14.3.498.0; Tue, 11 May 2021 14:07:29 +0800 To: Jaegeuk Kim , References: <20210429062005epcms2p352ef77f96ab66cbffe0c0ab6c1b62d8a@epcms2p3> <3a0ab201-9546-d523-abc7-79df5f637f14@huawei.com> <6e95edca-4802-7650-4771-5389067935dc@huawei.com> From: Chao Yu Message-ID: Date: Tue, 11 May 2021 14:07:29 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Originating-IP: [10.136.110.154] X-CFilter-Loop: Reflected X-Headers-End: 1lgLZt-003Szh-MX Subject: Re: [f2fs-dev] [PATCH] f2fs: set file as cold when file defragmentation X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-kernel@vger.kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 2021/5/11 13:09, Jaegeuk Kim wrote: > On 05/11, Chao Yu wrote: >> On 2021/5/10 22:47, Jaegeuk Kim wrote: >>> On 05/06, Chao Yu wrote: >>>> On 2021/5/6 12:46, Jaegeuk Kim wrote: >>>>> On 05/06, Chao Yu wrote: >>>>>> On 2021/4/29 14:20, Daejun Park wrote: >>>>>>> In file defragmentation by ioctl, all data blocks in the file are >>>>>>> re-written out-of-place. File defragmentation implies user will not update >>>>>>> and mostly read the file. So before the defragmentation, we set file >>>>>>> temperature as cold for better block allocation. >>>>>> >>>>>> I don't think all fragmented files are cold, e.g. db file. >>>>> >>>>> I have a bit different opinion. I think one example would be users want to >>>>> defragment a file, when the they want to get higher read bandwidth for >>>> >>>> Multimedia file was already defined as cold file now via default extension >>>> list? >>> >>> I just gave an example. And default is default. >>> >>>> >>>>> usually multimedia files. That's likely to be cold files. Moreover, I don't >>>>> think they want to defragment db files which will be fragmented soon? >>>> >>>> I guess like db files have less update but more access? >>> >>> I think both, and we set it as hot. >> >> Then hot and cold bit will set to the same db file after defragmentation? > > Do you set cold bit to db files? I mean, generally db is not cold, but hot. I never set cold bit to db files, I mean if we defragment db file which has less update and more access, db file may have bot hot and cold bit. To Daejun, may I ask that is Samsung planning to use this defragment ioctl in products? what's the user scenario? Thanks, > >> >> Thanks, >> >>> >>>> >>>> Thanks, >>>> >>>>> >>>>>> >>>>>> We have separated interface (via f2fs_xattr_advise_handler, e.g. setfattr -n >>>>>> "system.advise" -v value) to indicate this file is a hot/cold file, so my >>>>>> suggestion is after file defragmentation, if you think this file is cold, and >>>>>> use setxattr() to set it as cold. >>>>>> >>>>>> Thanks, >>>>>> >>>>>>> >>>>>>> Signed-off-by: Daejun Park >>>>>>> --- >>>>>>> fs/f2fs/file.c | 3 +++ >>>>>>> 1 file changed, 3 insertions(+) >>>>>>> >>>>>>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c >>>>>>> index d697c8900fa7..dcac965a05fe 100644 >>>>>>> --- a/fs/f2fs/file.c >>>>>>> +++ b/fs/f2fs/file.c >>>>>>> @@ -2669,6 +2669,9 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi, >>>>>>> map.m_len = pg_end - pg_start; >>>>>>> total = 0; >>>>>>> + if (!file_is_cold(inode)) >>>>>>> + file_set_cold(inode); >>>>>>> + >>>>>>> while (map.m_lblk < pg_end) { >>>>>>> pgoff_t idx; >>>>>>> int cnt = 0; >>>>>>> >>>>> . >>>>> >>> . >>> > . > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel