From patchwork Thu Nov 14 15:25:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13875220 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 B3DBBD68B31 for ; Thu, 14 Nov 2024 15:28:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D85346B00A1; Thu, 14 Nov 2024 10:28:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D0FEF6B00A2; Thu, 14 Nov 2024 10:28:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B86096B00A3; Thu, 14 Nov 2024 10:28:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 965B86B00A1 for ; Thu, 14 Nov 2024 10:28:20 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 52A1D141153 for ; Thu, 14 Nov 2024 15:28:20 +0000 (UTC) X-FDA: 82785081078.16.87092EA Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) by imf27.hostedemail.com (Postfix) with ESMTP id 344D440016 for ; Thu, 14 Nov 2024 15:27:33 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=D7jUcfcN; dmarc=none; spf=pass (imf27.hostedemail.com: domain of axboe@kernel.dk designates 209.85.161.54 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731597920; 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=Wvrv44z8Apd8qqgxqZBS6Do0FSmkBjZMAMWmq/c36cU=; b=EMTbmCo6U072C9beREeDHrmvLHb4pFp2wnuTRpE3pxUvlDpzDPM8pO0NqmhiSfWT/OpZvy zOOqWCjhey52t1YQ4gEWy98d0BZ1zhmh1UoZlSA9XsaN/BW/DyTiZ2aXVWBz/R60Z9Bx1h qgIVS2w2oabmyRvmb1Cu6KCOLoSnDLo= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=D7jUcfcN; dmarc=none; spf=pass (imf27.hostedemail.com: domain of axboe@kernel.dk designates 209.85.161.54 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731597920; a=rsa-sha256; cv=none; b=basBuljPgur5nS1XVko4ccT0Beetf2OviNf3atjM6rq/TKDKmsNkG6Ubk2XlDo1/E/VLfV dKpm29CIbiqYSbhymXl7gM+TkFj/iNnlHmfd5IkKD018dFKOi3qkzxJ3T6nSigvV1LqNyr fT2zlLlvHM9DJAtJ8iT33YyXOloSOQU= Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-5eb67d926c4so322169eaf.0 for ; Thu, 14 Nov 2024 07:28:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731598097; x=1732202897; 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=Wvrv44z8Apd8qqgxqZBS6Do0FSmkBjZMAMWmq/c36cU=; b=D7jUcfcNQnlSayxpbyns3fxNzokeaCDukiZSz/tC0sQZlBnkGAf9pFoO+oSkO58+Ko 3qeiGsKSRFmku4cCMDQVRUZDXNoQCi7+yP/Jm7xmGrumKsdWmy6rXs/oVYtbbDUFHVeq T/uruzoIsJmKFBsc48eX6wOup7YkTh1EdrYdUzDqC6dlCIQwR46qq3Vrvq+kS6XJMqz7 vUgJSTZlnGqqAQplqYgAnaN+J3Fi4CuuLFdtKVUrYzs6qA1ddJp1y50aRoSvUvz3fr2o PRMQJGTwknmE8Hqqtu2bpFLmCC3BUhEQYWEX9ebkYo/eqA0BJTzDQV7J+cxDXYIYZoZl Vm6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731598097; x=1732202897; 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=Wvrv44z8Apd8qqgxqZBS6Do0FSmkBjZMAMWmq/c36cU=; b=Srutm/P6+Qu4XRzgk1czNGrF6dxrgcUQ8MQJoR5kLDy54MyUjZCg9JxXVIhH2QlN87 Zi7WTRDa5i0ZvZpZUzq5wk4ybBsSBLsL2s4ChxyB9d5SBEmHAHedhd1eP/QmQ9+aHQ/1 GBERkA3GewGgdliBRFE8tnuggIUOhxY6ziizy/In5MiWZ5rFKwNeP8PwnBRKJvyzaNIh w21MVKtlX7HVLFtex7v35a9e5veY8Rp/UMIwRHEM+S1MlBP4mp6Ra6GTJ51WJxD3JMFd E25GGGtForDyXeiD1AXTqvLuPJTHFF3WvCpXRO5KyALuX2FSc7WrZPZjKApc6wPQxcsM es7A== X-Gm-Message-State: AOJu0YyzHh1y+4eS6h9LxtbUY4CX6Z/AnLHyD+koMCwah4E6OB6BGWwU G2YcD3SwXQaJa6Novs/FCCR89zxDCNY2A6mPuqiQL8cwrgS7D7pOHWYmm6rhSU1Fx08JljfrLke 6D8o= X-Google-Smtp-Source: AGHT+IEaTjdnOMAkEmoEcJnRXLnfxDNshZw+Ax439RAi/pKdYn0q0me9qe1oslEKsbvc7WBkYDa4cA== X-Received: by 2002:a4a:e906:0:b0:5eb:6b3e:ce7f with SMTP id 006d021491bc7-5ee9c6c80d1mr2431138eaf.0.1731598097161; Thu, 14 Nov 2024 07:28:17 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5eea026eb41sm368250eaf.39.2024.11.14.07.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 07:28: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, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, bfoster@redhat.com, Jens Axboe Subject: [PATCH 11/17] mm/filemap: add filemap_fdatawrite_range_kick() helper Date: Thu, 14 Nov 2024 08:25:15 -0700 Message-ID: <20241114152743.2381672-13-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114152743.2381672-2-axboe@kernel.dk> References: <20241114152743.2381672-2-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 344D440016 X-Stat-Signature: k4b16414obsaxt4ob7ffw99z8z869bpe X-Rspam-User: X-HE-Tag: 1731598053-803393 X-HE-Meta: U2FsdGVkX1+cvCY54b+cniLMPnyU987zJVarRm929nUp9MC7CJpODmHgas3Orkfut0rXgHBWxmh3b/WoBdgV8+RhKx4wSaQ2MHt/sjeh8jFKtXdnASAl/dY1FP5BmGil90wtCOIPg8vYZ+x+l8jGNnVNcHaOeYcJ6PBhr37ECMgnFewj0gMfveMV+obHMJKgg9ZXeaxh5uwngwJAuyOzb7eAN/FscyTCyfedxE06w1THR9F5Y3o/ZILkKnlLic0eOIFVrAXc6Mkoo1JdkTPlXNpjcI7lWKDEJ566FFWOWv2dc7Smx504h/ElS5vraOheKBEZiVB1X/2JE1dTPICRVner9YiNGqy0kjp/auCdvA+NMU1p/r2/L2mA6KqZ+S9DFkD9SO/IhN1cE1bMcjNSjp0Kt6Y8mzyeFTzoLIzQnaA5edsh1GVWNL/oWOYMZ12YVKladaHWVETtpufkjk1p/h9gTAbfZuMCw8D0nUOCb8TYK+gAoe6LnmXkuw7WvNTdoPmr8VbkKdHDcZrXwr0VCDGPbkJTs8W0EiCy9EkvOwPabGk6eRS0Q/FG+nG5LylELvsj6Ra3s/OOyGKdCrLc410yjORp5+bCEEm01YD0v7PzyrTvQxh4aknQIin0A+oyNLRh9zu3aH24vhrWnvWyh+njg+WEHPdb7MPa4RphUFG3l6VIurRhcIt+abNrs5UGkXOnjnam834VuKZBFroWiHbrNmsRljNiUghoUjqH9uvWp4+v2AwyWPcG+ZZJeeEIBLc2R1ihKg8hGcZdUndCZg4LgJ8rltn6CKvY8ysI7cDgID2FRpC86v8uF8T38MQwmd3UOxiMOvL/6XdDRkfQGAqytj2keVj+DpKscvVarQaxfxNQFKY3G2orZSCE7vUj50/uCuG8NKcs9Idmm9ON24gURe91vxFSt3z0RyGsFxjvIIiWcBnCr484K3tkVzMdB/9BIP8KS7R+uxY7afZ zW4IgC1+ hGc09C8vHOQlX7lZTH8CzexgwFd6EgSFuW/pb8/142H8cPXEid4ledKy64Mzb7srV/u1xJU5Lk74wNoqHWZYxLhd2Md3ozAROQex777AiY5Ao/bnBWhG7HC13UCPilrYbwJ2Lf1DPa6Xhqtl/lpmgQvin+nv1DnyvlSMoVa7gLuD328JDCjvkYFWhmHMxOYvE68f7tTBtBiMAKAaCa+JLIpAy/+CEUKK7ILPEpXDPuBkendPUggpAJ3qqORkF0byX7GahmNTrEYJhTSFHBX7uukxk8py8rbdzkpjz2Lv7s6V0gXhW624jdhroDYV+xq2lhxXvdhr2TKOKdPcDTedmms97+X7iR+x7WUPM 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: 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 122ae821989f..560d3ee1bb8a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2845,6 +2845,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 297cb53332ff..a8a9fb986d2d 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -450,6 +450,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