Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3029036rwb; Mon, 15 Aug 2022 16:27:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR50vqEoc5q80VvsebGFR+j+BXMyeu9si/kqvSxf1Yv/B5qEfrctx6eidZM9mh+t86cx7zpu X-Received: by 2002:a05:6402:28ca:b0:43b:5235:f325 with SMTP id ef10-20020a05640228ca00b0043b5235f325mr16299371edb.320.1660605940991; Mon, 15 Aug 2022 16:25:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605940; cv=none; d=google.com; s=arc-20160816; b=DWmbVvvyUf9IwnusvwWIwY5jRqaJxk9w17N7k8F8G/4Hr8U1K+vt99dVImYnqZ4/M6 PLwzKfWBfPFh9ExXhbpcQX63YQoAvJJH5WpFmcf4tYI/mbWN1PA3bAnFWDsD/FvLJB2P Q7AwUSfUwg6PHurngGfzgtNxIPlHHGGNTcezVOD+jooRAQ1XZFcDy9eUxeb0sbqYwBWj h17xvKPlHG9w2WS2zbyqgpkisl7Ex/Uz16vfdfzuSP6x6L3LFJ87RU66C7SnghmMGgqC n6BZCscnNT6XzWhGQeGw50JVlacsgGnYnhCV9P5jKPDcl9XZCAvzA8yjPXj4vg66hTpV o2Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X/nzC26s/dHP4gL9SnXRhdlY0nTz+96zMT+GENNNr6o=; b=e9VOzlPQ9/FgDjJPlv9Yy0phAa7TFgouxv3iJWL+1QgGxgJLb3ohd+LU6aE+wBaDGR cF3G/EWPk7rYEnN9nlzDKDa2pJh46212/kx8D8ZwT5ScAVgtWFonW6fH/c8Py5+zXn7/ ciLXFXC7u5F5vp4Fj2H2q5Axa7xRt3qLq1C49CSR/9JkLx8LI1V9u6AU34f/6sYfawYu KT2tnC3W6IdfwPRKkTpUszr5zvoh8wjhJIO3yY7pt64hoQr395uqNxEkODh9mtcrxhz+ IpcIM9n55L1Mjjcm14EfluA7ZfMj4hZYNBVlfAdFBMu0PA2KCpqt/7LorZaynXNkDm3W 5FOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ov+PjKJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne33-20020a1709077ba100b0072ab62ae019si10341512ejc.859.2022.08.15.16.25.16; Mon, 15 Aug 2022 16:25:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ov+PjKJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352310AbiHOW5Z (ORCPT + 99 others); Mon, 15 Aug 2022 18:57:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352242AbiHOWzV (ORCPT ); Mon, 15 Aug 2022 18:55:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6310413B88F; Mon, 15 Aug 2022 12:55:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CA264612AC; Mon, 15 Aug 2022 19:55:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF6EFC433C1; Mon, 15 Aug 2022 19:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593307; bh=++/ccFWEPTN4VQVkgkKIVVVj1aYxf7ZJD9jzJQ3EwYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ov+PjKJlosBOqHgCYeaYP4BeE4m4HA2wXhT5f3GKunAYC/cTiM3lItUkU1NSpRD4P 1L5cD5pGopOOLY4bE89C4xJDMMIzR8QA4iQ755YzpSv8wZpx0cm+UkJ541+C9Csb1f 4nxllBDO4VpswNnQj+DneOyLLMWxwORcaCXQRG2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.18 0927/1095] f2fs: check pinfile in gc_data_segment() in advance Date: Mon, 15 Aug 2022 20:05:26 +0200 Message-Id: <20220815180507.603347042@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Yu [ Upstream commit a22bb5526d7dd627b94a7ee22e5a98c36e39fceb ] In order to skip migrating section which contains data of pinned file in advance. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/gc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index ea5b93b689cd..e83c07144d8f 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1480,6 +1480,13 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, special_file(inode->i_mode)) continue; + if (is_inode_flag_set(inode, FI_PIN_FILE) && + gc_type == FG_GC) { + f2fs_pin_file_control(inode, true); + iput(inode); + return submitted; + } + if (!f2fs_down_write_trylock( &F2FS_I(inode)->i_gc_rwsem[WRITE])) { iput(inode); -- 2.35.1