From patchwork Fri Dec 20 15:47:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13916941 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 6F3B6E7718B for ; Fri, 20 Dec 2024 15:49:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16E116B009C; Fri, 20 Dec 2024 10:48:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F8F76B009D; Fri, 20 Dec 2024 10:48:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3D2C6B009E; Fri, 20 Dec 2024 10:48:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C074D6B009C for ; Fri, 20 Dec 2024 10:48:51 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7AC0544825 for ; Fri, 20 Dec 2024 15:48:51 +0000 (UTC) X-FDA: 82915769370.30.F2D7F45 Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) by imf27.hostedemail.com (Postfix) with ESMTP id CD7A240015 for ; Fri, 20 Dec 2024 15:48:11 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=S4AKQo1D; spf=pass (imf27.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.46 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734709697; a=rsa-sha256; cv=none; b=xYKvKSC0yV34K6WZq5YRf4RwjbISeM9BRjfvuL7OsuD189VfrThHr1bmSNdHqhS9DSzyWf n9Fc2uPfhHgkZ+mDY/j7cRkviewrL06F6M4fp4r7yuYqp7XDudU2d/he1GO/ZuNC/IKXH5 PM98uGqeGrVvCzuZ92IaB3v5ZVaR4fw= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=S4AKQo1D; spf=pass (imf27.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.46 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=1734709697; 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=Z4qQwDJE6vdlPLyJQIpmMrltr90cAGUkJZOMxstE6os=; b=0m/YbHondvlxajIHSsFS3IMvCi7isr/N8oDBwgpiYTbZ+PzvEVH/ft8tijDZ9PoneBBckn 1JaN5fac2UZCjpM6yydYXAMl8OhTGwc7mWTuDh9D+5ASnMX2t10rHnKBQcRH4hrBG0JVMX t4EaqccEWEsl0svMm7t/T0RkOx2AyvQ= Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-844e10ef3cfso154742339f.2 for ; Fri, 20 Dec 2024 07:48:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1734709728; x=1735314528; 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=Z4qQwDJE6vdlPLyJQIpmMrltr90cAGUkJZOMxstE6os=; b=S4AKQo1DJSkhSznA/WEuA6y8EHgiCOAj8dC7l2MPBNkqW319iXnayNThKZ6EIxdL4I OdU4Xylkty4IYppioo89MKtGv8tt7B+djavKPJ5GKkPTTrgpa59uq606p4XGJgO9/fZo IFgnosMwYH6JKLPrlT0BXn+qGLmJ6ybwOkUANIdSqPxGxSPTpci9cD6+xYzNNlzWQogX ZPvaUIX4Dsuta7ztOm4os/VFPV8vdeNrKEd141u53XlRbUzREyGtH4WAXny1DwHGkjdS foIRNgcJKtdK13WrXum7IGV8XYXpE4vXQo57r7+vjn0rUbXMIlVDhLxEUIkvRAlwC3e5 13jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734709728; x=1735314528; 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=Z4qQwDJE6vdlPLyJQIpmMrltr90cAGUkJZOMxstE6os=; b=mvkHETzqCLHOdqaN/Iu82PBOf+ytU4G7hc7D3p7El6QxMCer0XwtCc+abpLMJmIOsr PSb1BD1+n3XrdZLfMX7PXPPjP2eWVv56GLNlM4wVajrj/xvwWIpjGg/GRdFcnxT/YERp FQV7fq/rl2z8Xz0cJTQoGo4lF3N34ZWLNmjn/nkRc1n3BMDKWpfJAVoXAShi4cVlir9c f8Qs+B1L/gC5q6XU+eTLl02+IMzGQTDbIrr8JXSXzwSGlLsjClGMMW0xIh4XYcGobvhk t4BxXxN1/B/8RfIdYxDF5w0nS08viYYo4SHT+yRPU64WctoYZ3Cjif0Y9khdRNchAlui 8VPA== X-Gm-Message-State: AOJu0YwJXf7j8XLQ8g50xZt1kLvUMiUR8aqlYHnuSMJ6E/DHsySUurbT U2tHeksssm9u8KWgRyi+nNJR4YdciRf2KaX3vb6s3wv6U03g8/jJSXSqP4vXX7T+7zB3FjTrgN3 v X-Gm-Gg: ASbGnctMw6kuowCEjBgCU5n3im+w2nLcf6WSFsdv+Hbicy5aUvNxdPACWKH+siA4ozL lzNtIN1uScsFtw19mEYXx8jvCEFi67uKYm41h2FuCuDyKPYeVyvFQVAn6ntPWd9ZssXwV7kcGYM TMzksEptw4d/Kg0FGhqwUkgbYa+wWeLI4KkCxvK2VSYqpGQAtUDP9ndAsGPKig9sQruT4CJ1iBq 3j5kdW2HcvoObI+fViPxeqH8lRTHs73TI1xsoz8cgNunJD3pcgNNQ+uJHaG X-Google-Smtp-Source: AGHT+IFGv05g9yMPyknBeMlKwprAW5pwl3vrHXnYcOynrc2BQ0O5hQEIENaNx6lgdvRHQ9LzhuK/ng== X-Received: by 2002:a05:6602:158e:b0:844:e06e:53c5 with SMTP id ca18e2360f4ac-8499e4fafe3mr298729939f.8.1734709728444; Fri, 20 Dec 2024 07:48:48 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e68bf66ed9sm837821173.45.2024.12.20.07.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 07:48:47 -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/12] mm/filemap: add filemap_fdatawrite_range_kick() helper Date: Fri, 20 Dec 2024 08:47:48 -0700 Message-ID: <20241220154831.1086649-11-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241220154831.1086649-1-axboe@kernel.dk> References: <20241220154831.1086649-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Queue-Id: CD7A240015 X-Stat-Signature: n1kz8d416ur1q9a8mwohoco6zscbo7bh X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1734709691-642805 X-HE-Meta: U2FsdGVkX1/sEXJ6Mby+qw7eQtXb1LlVWMake4tLTLAAhsPa4AiaI+Zt4ZH3sTjD0wXYTDgZA7ImxdfpkCVC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nssDnRDxxmogVxHYMD1pugJbOeO6M5vm+JMPgV7xetw4cb13viiSuSfds/zyUukBU9yFSo7zyTa0J3K0gWb9RBw7qxfBrlALrrbo/ttOx18QTUC0M1Jvn+zWLL0oE4H2NV/HLcB1UHFHpFk5Wjrgq2kIyA/BDQiprGEwUinHM78R74E2J X-Bogosity: Ham, tests=bogofilter, spamicity=0.003928, 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 aa0b3af6533d..9842258ba343 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