Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1036941pxy; Wed, 5 May 2021 21:53:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSTlB5WYKKreSwvmx7G2hczwO186ACr/TIYQkLRwXVXSa+5GWJO6IyWud9GIhFH8SPPRkD X-Received: by 2002:a17:906:170d:: with SMTP id c13mr2216461eje.491.1620276786590; Wed, 05 May 2021 21:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620276786; cv=none; d=google.com; s=arc-20160816; b=iYuv2+EtwepSw0H+zBOlrdU6HkPaMNhHloZPZxjdxcy/Vu+igeVUUuytE4Gh4SV7d/ oK0UbJoDUjNFGBUe2jmKo8FPHi7a2xCVvRmMmga0jkWuLra4GUKbbRdWmGCJLdYjAgVJ 8ZXGEc1ySK/8umNcWn+wcifRvtngcFSynQZpJeFMUc15bLOvm8BO2kvXnhZIBGKhOSnA DU28Wj4+R4wCZOSXEUtCtEpEIoQG8JTvxQ+Qfb9x5BsTRq2LskluzALumGJ8/jHeiUgF n6YPE+PiymJARCizTm6uAit3HuWB6k92cu/PxxJbMTYsBQWewROz0a6Bbd61cUGz87R+ y5FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=sYTrBeoy1jSJGyPsZs6ShFZN6is2VHL2O83s5BAzuYY=; b=F5gIdDbNOnV6aBZogVwQfv3R75+Ix0cHOMApi3YYSPxTAJAKy0OOkN4Vz32hmFRoWy 0zMZIRTMXGaavIfk9M/hRtq4vhUtFdN10Ik41u1blb/wFk9v0zYqIugFVgqS3a9Do86l m6mb/aR9IqO/g0KNzUCOCL4LA+mf07P8pR8Kcfh8vDg28H2JdwHL0EXN5O53Hd9SMj2C dWfzgygeptqoWcjwcFJrT6vAZOT/gCw0eSdpTAbxqXcIurCFWTb+tz0D02WAUguFIoe0 bt79YuMBnWyiO6TzVlGj9bo3f/F5waZgbQGGFhcgljIXLEf5bkyP1JIufgWZsZls55Gf QzcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IVQUJBNy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo9si1354094ejb.184.2021.05.05.21.52.28; Wed, 05 May 2021 21:53:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IVQUJBNy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232484AbhEFEtG (ORCPT + 99 others); Thu, 6 May 2021 00:49:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:52468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232097AbhEFEsd (ORCPT ); Thu, 6 May 2021 00:48:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 032FF610FA; Thu, 6 May 2021 04:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620276383; bh=zdcpYsjq/LphvbQv7Zuthak4zPjOF67RloOr7IcUpVk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IVQUJBNyHp5vKHHfgOo4IpQlo9/7fegK57l9M3nTuzqhuWZLNtGqQF4gpQVCzlGZd D6g1IITSgS4K1xXCc0Te09mDDUWDQnbn9GakeLEPQXEW0UtR2Ln0PKBfIxbj4NfMxs jNA5YB4B66FcwVZjlSI0n5acqeW6MY5/qm8SyKZ+wzMD7XYBU/w7nC8RThXRCle7Zs +870I3Gxqc9wRfugo4PICfeq2SMKX2D5ZAC4cloUzQSDox7iKrOYKvMnxIqwi2xzaV VLqx2ujLnh/Pq4UDuTmZN8c8Lf+Bj1laUVCSAZbcmAJzVl5mlxfJ9EzzfVEgUS42oL 8DZd1RsNwujkA== Date: Wed, 5 May 2021 21:46:21 -0700 From: Jaegeuk Kim To: Chao Yu Cc: daejun7.park@samsung.com, "chao@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" Subject: Re: [PATCH] f2fs: set file as cold when file defragmentation Message-ID: References: <20210429062005epcms2p352ef77f96ab66cbffe0c0ab6c1b62d8a@epcms2p3> <3a0ab201-9546-d523-abc7-79df5f637f14@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3a0ab201-9546-d523-abc7-79df5f637f14@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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? > > 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; > >