Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2049309rdh; Tue, 26 Sep 2023 10:42:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhCJJ9o8l4ORgGU2BYSaCkyw1IwkBh8DYjIF/l67GHCmRT9zx2wzwTBYIip11V79VYaN1p X-Received: by 2002:a17:902:e74a:b0:1c3:94a4:34bf with SMTP id p10-20020a170902e74a00b001c394a434bfmr9081329plf.66.1695750179491; Tue, 26 Sep 2023 10:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695750179; cv=none; d=google.com; s=arc-20160816; b=jJM6xuAz+kGAcMXzVKycd58z90uoSiWL4EoYQm2OdvXhCxEdnQq4KEv0TkxaNNmLDG zaggk40KGBpIArYE8NvlFHR/sJW799ixR574TBjiNDiXZaY3ruONHYsmlKDTWEL2dofs 5vqtoP+RG8M84BSp0zkFxYGYsXo54y/KaEKGWIiSzc+fMWsmb+VuyMZVDWTF+YSOUdmY msnBHOorMO9+8UTf0PYX2li6nxv5hPkxPsJ3p4W2Q+8HLGNlf7QIOvrr01nqeA0qlcx/ to845mwvpVaLQT20p5zwoi1iNYkDmO16PLT9SlC1Gl5jMHMrJwMG5LrHWixcHAcPXd6I Aqfw== 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=vs5a9axwAb1t1BthqXwpxjGzVJW4lzDCcpHepD1Sef0=; fh=VjxvdBepIu7ud7hHybOslKmXC6Wr9BJB/mf+8woCoOI=; b=sE/4hiFiLqWnXlncNgt5YlC1XLmbFGBKku8E6EERQiO9qiB9oXwCOdauz3jaL1/CHu f3EliEe6JVreM8vmMQqVC7RyfV42AJemBkOg6KTS6OpaljA4VSD8OD4G9n6+75Jt//pc 4EFN4rlH5SF/HB+rFA350zhjwzyU97GbQC1KeHkZsCXP+d5jYjNlCoTO70FDvyVHKg// D2ghuJiMdZP7+oxmBhrlnB2oF+w1GHlYsGGEr7eVCsbkTfrruCQClVzsuKVptKS+dTPE L+TBH8jQHsqVdpkbGY0J06V7IK7NbZb0Nu9OdupBUG33tu5P1+8QBWfoe6Uk07KekSVz 5vPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="QZqrKXQ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b7-20020a170903228700b001c3c75842f1si6353876plh.14.2023.09.26.10.42.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 10:42:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="QZqrKXQ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0230780DBAC8; Tue, 26 Sep 2023 10:41:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232053AbjIZRlD (ORCPT + 99 others); Tue, 26 Sep 2023 13:41:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231549AbjIZRlB (ORCPT ); Tue, 26 Sep 2023 13:41:01 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE1ECE5 for ; Tue, 26 Sep 2023 10:40:54 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 668C9C433C8; Tue, 26 Sep 2023 17:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695750054; bh=qFXQCm4wpcI+yE6fWi21khMp5yp/w8GEwvQJeve1l4Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QZqrKXQ/29eH0ORwoNR/vO2H3ERnP5dsLMynI8cR7r+gTzuLcsmsy7IZ9wpHf4XbU oQ2pdsG+FlHra08pFeMLIv9TtF/pwkpfodsVCrJ3eQDTUgv34dDdAGe27af+etrrVx +JvN/rnMKtWyDzHNmgwPT6KbghH+d2Wp9g4Tf6wXd8pIkpM3N2lZM0eHpcvwe0A6vs PWp17ammmMcGK3hHt8hfQJE8rWRMTeO6EzjBkUD10DmdSg2qeyTDaclZgmsKMVJTwT dMhjd21cdkuFqrsQAEj+VMWPXQGKxIy+V4Hev3PX6TbwAfd8iMpz5FqJSNYJOwmgHS 5k0HxdNT47OLQ== Date: Tue, 26 Sep 2023 10:40:52 -0700 From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Eric Biggers Subject: Re: [PATCH v2] f2fs: preload extent_cache for POSIX_FADV_WILLNEED Message-ID: References: <20230920004645.1462354-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230920004645.1462354-1-jaegeuk@kernel.org> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 26 Sep 2023 10:41:07 -0700 (PDT) This patch tries to preload extent_cache given POSIX_FADV_WILLNEED, which is more useful for generic usecases. Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- Change log from v1: - load it at offset=0 once to avoid reloading for all the calls fs/f2fs/file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 09716127e107..161826c6e200 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -4858,6 +4858,9 @@ static int f2fs_file_fadvise(struct file *filp, loff_t offset, loff_t len, filp->f_mode &= ~FMODE_RANDOM; spin_unlock(&filp->f_lock); return 0; + } else if (advice == POSIX_FADV_WILLNEED && offset == 0) { + /* Load extent cache at the first readahead. */ + f2fs_precache_extents(inode); } err = generic_fadvise(filp, offset, len, advice); -- 2.42.0.515.g380fc7ccd1-goog