From patchwork Fri Nov 8 17:43:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13868799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9771D64074 for ; Fri, 8 Nov 2024 17:45:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D6666B00DE; Fri, 8 Nov 2024 12:45:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 985556B00E0; Fri, 8 Nov 2024 12:45:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 788776B00E1; Fri, 8 Nov 2024 12:45:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 565646B00DE for ; Fri, 8 Nov 2024 12:45:25 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 049C2120E4B for ; Fri, 8 Nov 2024 17:45:24 +0000 (UTC) X-FDA: 82763653812.18.25E78C6 Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) by imf26.hostedemail.com (Postfix) with ESMTP id 264D614001B for ; Fri, 8 Nov 2024 17:44:54 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=BPJ39qPe; spf=pass (imf26.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.173 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731087837; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SJBisbj/rGvidSFxNEf05dxDvPbQrKvqbgVXmZ2uTrI=; b=1vjdP3nlPrwhEhT0XuCs2kWKTL+yve8/Zr4EKKF24iPwZTuunPVZq99FU4KNTqp9lnuTug /G9omVnMVKSQIhDXYLJtfN92gCQHHdcMONb0h4VzAVwz4xLZb7zey+OaFilL+j3jTSs882 w25XyixVfizDddr/I7PBA5BsFGSPuPE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731087837; a=rsa-sha256; cv=none; b=jyj42Dp51yUl3fUHGSWiUM5ediO55VeUPLOHoZNYKN2E+viay0jAy0V0uNV0T6/8lwuaVK aNaA8gLbcCadf4aLGRJcTV8m010a1MzD6NOlnLwZ5J3ShGBNc5ibbNW4DLJlvPyfpozyHf Cx132etieaAq1DySOTH3GgCiIuY+a3U= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=BPJ39qPe; spf=pass (imf26.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.173 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3e5f968230bso1270848b6e.3 for ; Fri, 08 Nov 2024 09:45:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731087922; x=1731692722; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SJBisbj/rGvidSFxNEf05dxDvPbQrKvqbgVXmZ2uTrI=; b=BPJ39qPeWAyi0QNo1R5wi208IRfUo5we5Bq1JQgYkbEpwIQsIYTwcVclz64/4a3WIh kT0zFGjp9nYMBpCcApFHKP6AbBhtYALwiR0iipvsGs58wxOG7ySaIrJmhs4d5SH7M3Yd bDj/hfZybkG/XVemtm+U6kOwxQ4aGbfsCjZdSxTIeG4HdHFXm7rC6hf/VGUUQKpa+u1p iFad+iHH/GUapCQAs3bcwxa2pRDzulR5RANzi1IkWrxn9N5gSpu6euX0wjYjhXolSvkS 5RWMWt5FUN1pdQWjoO1J7QVJKrDHCdLeaSoM+DzakViA5SAQXmLxTJKPvKEPse1IuRJ7 2Lyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731087922; x=1731692722; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SJBisbj/rGvidSFxNEf05dxDvPbQrKvqbgVXmZ2uTrI=; b=r0rhQodXER4vDz9+jdb2FfHHcoJPaUN7e6nkyFfMUjRiDKlJ3P4XRukMVCphmHgT6M Qeunj3eTp4YS3U+etGtsrgbvUkf2HIP526YXZ1QyU0un8Dk/R6p4Ua5Awn5Q+7AsZLl4 jkoxquuz1FLt/13Kdd1G6yNFb6Vxxs56h3kfoPOp6W/+UAZBpll3J686bvGUUYYdjqsS 4WD1HY4k7WrE9wUYqVqv1YXM4dNjWOLIs0/Qm/tW8R6wzNftTr8v85gY2pSmbVH/IW0r vae6uTkNybBo+6L9rwx9m1P6jbiNbsT9OfXfMlL4rVvgeqJNmRtC3J1RLHIr+4r8W1TL yj+w== X-Gm-Message-State: AOJu0YxmxFL9/c581X2kMON6Ad5WnzdGClH8sMCwO/Mo6xngLeE3kzlX d8TjyNUyFksd3ShTmEnsFokP6rn3BMVAhmk5cWfs8H0l7fsFc3HhtQkyViwnx5MupT+4Q1Z54Hz Sc5o= X-Google-Smtp-Source: AGHT+IHAnYXln3VhbkemWI+8mH1zeQAS07vGHF77rvkzzA3Evd8Py7SGOWt6/hgQMWEBNANFNnt9yQ== X-Received: by 2002:a05:6808:1987:b0:3e6:1057:21af with SMTP id 5614622812f47-3e794772f73mr3805781b6e.41.1731087921963; Fri, 08 Nov 2024 09:45:21 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3e78cd28f80sm780969b6e.39.2024.11.08.09.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 09:45:21 -0800 (PST) From: Jens Axboe To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: hannes@cmpxchg.org, clm@meta.com, linux-kernel@vger.kernel.org, Jens Axboe Subject: [PATCH 06/13] mm/truncate: make invalidate_complete_folio2() public Date: Fri, 8 Nov 2024 10:43:29 -0700 Message-ID: <20241108174505.1214230-7-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241108174505.1214230-1-axboe@kernel.dk> References: <20241108174505.1214230-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Stat-Signature: nd3i3noktg5u41hzmj3bwnsrdeu3qt77 X-Rspamd-Queue-Id: 264D614001B X-Rspam-User: X-HE-Tag: 1731087894-340313 X-HE-Meta: U2FsdGVkX19GcY0QMoXIz+pxDRB2zHtxF54YtipbFX3AZvwstcTYCdFNMDECIM79vgaJm2o2AJX8H+bhduwMquZz8yzv4zd42wI78QYQK3ZXp+DfpCXkMUeZH6/ekbkEly97Iio1G/Edstf6KyK68+EYsVRb5uLMZXaNRJbANzx3c3vpnP5v32DHcQJRImuovSMqHxELkY4bdcOESSzv4pNfqIBRFj2950+dDj0W/baxbWyL8Mudt2ilI8Yx0hSIxUAlLhSxEVuNvCGAdXyZZ9fy68/O8dvTHTxUwspvNJUlxd2H5l3noH+3q8tk0F5Ddepx8KXs6rJVTpKy6EHEMmozkfq8Z5AJTU8Ql/mynga8zqL3u1Eu3lvxTOyD4f09rc7sfP5TMmP14Z0O15vF28wCygH0J0Xl2l3TKsWBrjTgWRx5ADgom3T59ZHCcT3mjaD+M0H8rhIo6KrIiuB+NQYsh66V+M33926kvUwrOdAVAEBkTtKFnrE5nZJTnYFfdeN/0F2CxTHLAWmUy1yDic75cSeUjqh+m7Q3Y/dI6n5DueOv7cvODg8wQpBPtAp7JrEVRtbBEM6kZ8L6ciH63HOuffnVfH/bD/FnsyuwKbkMKq2/ZzL6dErbI5yFwVQcFLuLfmGW6aNX58rjwfFM/ZDgZJiZjx/WfGfzShHN8rJiqJcww21yZDuy6uj8fkFXyOxzI+dEsf5mN8cYjH4CwkJAtiOEBUiUWTv/EA/BoAjuXMCenknGOhrIMQzpwiMqEm9a3fNpGHChfWE5BVvUf4QEzQVEZIFDidMMF753SmHVHwF+gbXatV0AtLE4SyW9QnL/Zjr5maJD/z25+xGb100XSgveuoDuF0G5iOOxhuF5Z/QorQ4nmdlkW5TsrTz3xCTu8/zneTEs/mRQIEu61oGvRBLdlyqtNMOyI0rifn0IIKhCRext9SZ94T6jfo7SxbxwOdxizaapT1Fb0Nr WKrODKhN 3tMQW4NLKTgNjg1Tx7CEC2fdADWwgbBXSZpN+Ro2HP17+cX1PB0busTTStIzX8ROYpdv6xWaRkAhrr0IiwRB/NGPkTnVEFTWCkax++iSUxfgfnj3/n1NR4Hn8gp4Gh5kZQjlZraQ0yXl3c+olfmlQyMuqRSow7CHhYiUL1ULl4lNygZ+CRfwHLWnGneQo0k0bDF49h6ucSItyvLYw80Xz1VHKpEMV3tw0xiaDHyUwYHdqCtIveQb28HotW2WsaiIZy91WkpxBjPaDT/1HRyg/Cc5aHM+fv6x4sEbRKApemSFhynyvqnnoX2ZMxuKwcO+wuoTG0ZtytpgtgpzqV9R25uJ4OhRrgKkpeNrw X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Make invalidate_complete_folio2() be publicly available, and have it take a gfp_t mask as well rather than hardcode GFP_KERNEL. The only caller just passes in GFP_KERNEL, no functional changes in this patch. Signed-off-by: Jens Axboe --- include/linux/pagemap.h | 2 ++ mm/truncate.c | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 8afacb7520d4..0122b3fbe2ac 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -34,6 +34,8 @@ int kiocb_invalidate_pages(struct kiocb *iocb, size_t count); void kiocb_invalidate_post_direct_write(struct kiocb *iocb, size_t count); int filemap_invalidate_pages(struct address_space *mapping, loff_t pos, loff_t end, bool nowait); +int invalidate_complete_folio2(struct address_space *mapping, + struct folio *folio, gfp_t gfp_mask); int write_inode_now(struct inode *, int sync); int filemap_fdatawrite(struct address_space *); diff --git a/mm/truncate.c b/mm/truncate.c index 0668cd340a46..e084f7aa9370 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -546,13 +546,13 @@ EXPORT_SYMBOL(invalidate_mapping_pages); * shrink_folio_list() has a temp ref on them, or because they're transiently * sitting in the folio_add_lru() caches. */ -static int invalidate_complete_folio2(struct address_space *mapping, - struct folio *folio) +int invalidate_complete_folio2(struct address_space *mapping, + struct folio *folio, gfp_t gfp_mask) { if (folio->mapping != mapping) return 0; - if (!filemap_release_folio(folio, GFP_KERNEL)) + if (!filemap_release_folio(folio, gfp_mask)) return 0; spin_lock(&mapping->host->i_lock); @@ -650,7 +650,8 @@ int invalidate_inode_pages2_range(struct address_space *mapping, ret2 = folio_launder(mapping, folio); if (ret2 == 0) { - if (!invalidate_complete_folio2(mapping, folio)) + if (!invalidate_complete_folio2(mapping, folio, + GFP_KERNEL)) ret2 = -EBUSY; } if (ret2 < 0)