Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2653251pxj; Mon, 10 May 2021 07:51:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFYtqBckIPo6AGgngbTWMpj+oLE7NrfmenpPvOY6KzO2vrQuuVQx4qYxZBBzR2dYz5jQsU X-Received: by 2002:a05:6402:848:: with SMTP id b8mr29981438edz.159.1620658261678; Mon, 10 May 2021 07:51:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620658261; cv=none; d=google.com; s=arc-20160816; b=mht0CdzsMYwL00ZZO+HjDlt/kFz4NmHDb52ufQ0o9BOEtiAkzAJUY4ddvj5xWNBkkO M7hx4qQEjGM0TP4s8SFbwXilCMEMoq4tJ1EIiPmQ9t5/mzXMONiI1HWP2u9QVLUilDIl zXHuIT1dqaJwoq4IpnbhlEnTUFuQPOssfvBNNmKdLIBvOzuwYonVyORoCcF1SkuOAii5 Zg6mE+WGzgKbFrkdJEmsZTeaRgaoRZRyyflBlDSoKBurIRH+UhxQVF6LNdzXTuZpTDQo n73ZWAc4Y2LAT6ayT7ST+Qe93Wuj0iS1jWU/eJDIOBrQll0lQERJdMY8p6y3dXr7VER3 FhKQ== 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=RsG0lqRedzUe0rqGCW+xMZt7nh5oNpAqzfSP+gJFUpA=; b=TwOyDfHbXGPazuOsoHcHlOR24zcabRXuFDeoiYu6RMu4qPJ7M5MmbOlYarMpy+pWfm NdOhpNlVgYKRcJcPbSHs9gueA0fwnEi3WZ+yRszL21nHkPQMv5vpa7N58cY8MbPzrAp4 u2r7ECKT0IBUUeqvtHdFRnDp4XU/ICQ65n3c05z5AJZ/5V8Whc24d5mvoa+1d7lNxRUd EZBTUwPshVX85kWPk3Sgl0HweE3dL5k0BXjq8GJkPrt1TkuGcgHY/CLy8MiGE45vuVjH 1OURExQlD65Pp+nxSlQItWJ46SF8CsxTj9gmPvXU9ay7PfqJ+r1aiMgdwGOMBrpy7LNx BXgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=keNT+x7e; 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 a21si173451edv.218.2021.05.10.07.50.38; Mon, 10 May 2021 07:51:01 -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=keNT+x7e; 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 S236514AbhEJOu1 (ORCPT + 99 others); Mon, 10 May 2021 10:50:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:43566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240155AbhEJOs7 (ORCPT ); Mon, 10 May 2021 10:48:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D39C6613EE; Mon, 10 May 2021 14:47:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620658074; bh=U1Sin8G9z22lt/bG16uwURi9Dx9x0iPEy+hh0JwsyFU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=keNT+x7eXINKGEsJIphXo/QIJgeq7qQ7hSW/4o7eDnsiV3M2kbnWFnQjxQfNNkWOP QRFQwO6m1qJm8z23q27NduE8oC6dFpzAC1BCf6M/FVBiJHjTYBIqkmybdCi5D4A8Zp te+AzqDsju6ArT4jrY4sjg4XMZpRNE52wLzW+PGfn6EEREeA1MiQIDgA3lsqX8bzld NjG5MlM3PZ5XtO+OAndj28ryhCy2Bqsz3+ds+olNXNzWkdA9HHq+ZcrWe51Ef5i218 xM+l2lg9lOKjZUxMfOCZHTQyNPHue+mjAiDJ7I9iq4bA+TCE2GJsbVQpjv+8Z90Rz9 sn2IV4Q8m8O3A== Date: Mon, 10 May 2021 07:47:52 -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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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; > > > > > > . > >