From patchwork Fri Dec 13 15:55:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13907407 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 51CAEE7717D for ; Fri, 13 Dec 2024 15:56:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F44D6B009C; Fri, 13 Dec 2024 10:56:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 17C696B009D; Fri, 13 Dec 2024 10:56:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F12DD6B009E; Fri, 13 Dec 2024 10:56:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C68876B009C for ; Fri, 13 Dec 2024 10:56:20 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 53F031C5FD3 for ; Fri, 13 Dec 2024 15:56:20 +0000 (UTC) X-FDA: 82890386922.23.10C2A92 Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.175]) by imf22.hostedemail.com (Postfix) with ESMTP id 5ADA4C0008 for ; Fri, 13 Dec 2024 15:55:51 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=OHXfHkSm; spf=pass (imf22.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.175 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=1734105351; 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=CJvpEUV5aCutO0n1vzbjd3IdvpDLlQuRWwd0hw2DTJ8=; b=z+66DkKUumlncpnYTwXCq7uLIIviHe0jPNkO29pQ+lbolsaBGExM02EcVmNupB5k/wuWoU yW3WbbckAqapc3Fth1Q86wCw8T1wrn9bh04FMaQhlgRAe61reJwFh8CWdcBx9OM0y6p7qV fCDS7TodDXIarQzoGL80VD9yCLA8uNc= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=OHXfHkSm; spf=pass (imf22.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.175 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734105351; a=rsa-sha256; cv=none; b=WOhiygi7lkc6TiGqXvKPDAd9lRzdpl5QjWSZgN4hz08bwRJmxHwYpjdgUPwGNjx0u61l1q FR0C71GQpch3AJf8BidRljq70IzPp3XysrAEb1VaOe5hVi64ap4uAAJgkjKaQAX1KlqXSx O4dC2iLm44hgobtCUTuHaqL5g1CRQJo= Received: by mail-il1-f175.google.com with SMTP id e9e14a558f8ab-3a7dd54af4bso7236845ab.2 for ; Fri, 13 Dec 2024 07:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1734105377; x=1734710177; 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=CJvpEUV5aCutO0n1vzbjd3IdvpDLlQuRWwd0hw2DTJ8=; b=OHXfHkSmxXEQfu8Lp5DjKcSLar4Q7lWonGQs8F56tgeMzgn1xZVff+6PzHrsvDYmwO mH76kmp9e9g/G7UHHYL1shOKGM2h8+In424vLlBOyzOJ9oqgpp8uksgFlslMgo4WizfK Cb2dphoMAfLiKwBgNt9f8wJRr/dtGu8hGDdl6VowX7zSPOFFF4FKn7qqg7yAmJeS+yhg ehHFkr4W0o82z5nGJoyWGC04WbnRumBEnHgkIZ0Q5t4Q22LdC1+UHgwNwX5VfdYeZyr5 fGmstLLmkJu7q63pfZ0CjpLSR0bJEQ2ohF/3a7nd5HV/u6oo9Itbb7bg1kau0qP3YEwz e9+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734105377; x=1734710177; 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=CJvpEUV5aCutO0n1vzbjd3IdvpDLlQuRWwd0hw2DTJ8=; b=KicHliW1y//XbreY6Vx+5R6Y3uTmfCeC7KZH97Ge0kyrMFY7h2Bmsjv2iAo2YIa4Zn RzyFkzAQ8uvNnSNnIp/xTAydC1pzmB7FVRAQ8+Ka/UnPerkkDGLnaTS4bhXS2UvgcK2L cXqZ6g4IbxyBjlj9Hf+o8j8JxccJKD5LAJSQgJX6K5DKVhl2fTCSMVrYTI8U3qkJGty0 AZgN2IIkwVVD4FNnUm1CkKCgl2UL4n+m+3waDhjUqOBvhZPthSIibsngiNXEGLxmx/cL v4w3p+35S3xXkljidVVNWYvtCui7UWEguoa5Jq++HGaOcmubv6AlvW+yedmaGzC2j1H4 DRSg== X-Gm-Message-State: AOJu0Yza5HLOkRMTypf4Gribjl8cUJ60FRIUDNI+bWQZK/YAb63gx/km Fo3gjCXzr42RMmIgL0GttKT/mwlx5a5gVzVpGkVEOQOsV10xV7XjUSnrP1v9YPZLC+K8Lesw4IC 2 X-Gm-Gg: ASbGnctCA6RbqciiKtMhwD71RgkHSHNfCdwFVWfxd87/W9/Z4uDepoYZpiLNmrwJqF/ rLhEXyXq2w1Qi4w99MpIcdEZMyZtsiXBMMvh2TGptLR4CWU3v0P+r74wHMN6vJd8elaiBEy/dVY QAVhnfSJbb6ElN3So0Q0N1SDj5dS91qadQCzZveEFP8dPR0H1ThI6mUMWcYxqo4OzVAzwf30i4J dzhSOOOHNOc1Lh0RLa1XMs4FBKJoqwcYZmC4L6DiDxbEvu0rkcoh3WQTdJf X-Google-Smtp-Source: AGHT+IGauJ9uKAF5WxLAKMTF0QyH5oGnff/+E24GczIOzswP0NPnXSGxgq/rQ7IZv36KxS5lv0tqHw== X-Received: by 2002:a05:6e02:1564:b0:3a2:6cd7:3250 with SMTP id e9e14a558f8ab-3aff50b64c1mr29557815ab.10.1734105377176; Fri, 13 Dec 2024 07:56:17 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a9ca03ae11sm35258405ab.41.2024.12.13.07.56.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 07:56:16 -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, willy@infradead.org, kirill@shutemov.name, bfoster@redhat.com, Jens Axboe Subject: [PATCH 10/11] mm/filemap: add filemap_fdatawrite_range_kick() helper Date: Fri, 13 Dec 2024 08:55:24 -0700 Message-ID: <20241213155557.105419-11-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241213155557.105419-1-axboe@kernel.dk> References: <20241213155557.105419-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 5ADA4C0008 X-Rspam-User: X-Stat-Signature: x3tw7zxz97rau5husx3agmq6bstz6gfj X-HE-Tag: 1734105351-932977 X-HE-Meta: U2FsdGVkX1/bJ24yf0aKmTwrgzV47BgmFMlLeV54X+jCHO5hmUe+cCBrHKSG/xdp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hwrqdFxh4r/bOSIlQB8MFNXPEUVWeccn2uSHuK7Lut987dX93b/BRuaz0N94OUdg8pXVnfxsc6qC8+1hcfs6l4L4Z9LQjwKQR07xZgRMKGkoBqxsTiynOQSkkUyLxJQbdpqSWezxw+WaDCGSg5WM5iT6O1cCR+n7NfJn2LXjLXD73CwXNEvkno0XzpIl6 X-Bogosity: Ham, tests=bogofilter, spamicity=0.003758, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Works like filemap_fdatawrite_range(), except it's a non-integrity data writeback and hence only starts writeback on the specified range. Will help facilitate generically starting uncached writeback from generic_write_sync(), as header dependencies preclude doing this inline from fs.h. Signed-off-by: Jens Axboe --- include/linux/fs.h | 2 ++ mm/filemap.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/linux/fs.h b/include/linux/fs.h index 6a838b5479a6..653b5efa3d3f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2878,6 +2878,8 @@ extern int __must_check file_fdatawait_range(struct file *file, loff_t lstart, extern int __must_check file_check_and_advance_wb_err(struct file *file); extern int __must_check file_write_and_wait_range(struct file *file, loff_t start, loff_t end); +int filemap_fdatawrite_range_kick(struct address_space *mapping, loff_t start, + loff_t end); static inline int file_write_and_wait(struct file *file) { diff --git a/mm/filemap.c b/mm/filemap.c index ec087bab1c97..7db995cb5179 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -449,6 +449,24 @@ int filemap_fdatawrite_range(struct address_space *mapping, loff_t start, } EXPORT_SYMBOL(filemap_fdatawrite_range); +/** + * filemap_fdatawrite_range_kick - start writeback on a range + * @mapping: target address_space + * @start: index to start writeback on + * @end: last (non-inclusive) index for writeback + * + * This is a non-integrity writeback helper, to start writing back folios + * for the indicated range. + * + * Return: %0 on success, negative error code otherwise. + */ +int filemap_fdatawrite_range_kick(struct address_space *mapping, loff_t start, + loff_t end) +{ + return __filemap_fdatawrite_range(mapping, start, end, WB_SYNC_NONE); +} +EXPORT_SYMBOL_GPL(filemap_fdatawrite_range_kick); + /** * filemap_flush - mostly a non-blocking flush * @mapping: target address_space