From patchwork Tue Dec 3 15:31:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13892627 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 1D57CE69EA6 for ; Tue, 3 Dec 2024 15:33:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C865E6B009D; Tue, 3 Dec 2024 10:33:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C31B76B009E; Tue, 3 Dec 2024 10:33:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AAEF46B009F; Tue, 3 Dec 2024 10:33:03 -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 8A68A6B009D for ; Tue, 3 Dec 2024 10:33:03 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 41804140AFD for ; Tue, 3 Dec 2024 15:33:03 +0000 (UTC) X-FDA: 82854040626.10.D070C8F Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) by imf11.hostedemail.com (Postfix) with ESMTP id 9226540017 for ; Tue, 3 Dec 2024 15:32:48 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=fdLET6XF; spf=pass (imf11.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.176 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=1733239967; 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=ckrp5/MogNB2HvhzJuNOPyu1ag5BruWn5XeKlERZse0=; b=w7ITQo+UswNuNo5u0bs0LFZav8+eHw7+d/Agv+49Y0G0TYpmlmPcT5rvEn94Ew3S4uPjte /GA0tPtBS27YNMgE0j7HSa2/1XaS1p7xjxmCzIC36xTm5KnwF8ox84EO44Zp4crJnVMhfJ Sr/bjrGLB00cW59EK6f4dAC8oK1daoM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733239967; a=rsa-sha256; cv=none; b=vPh5oHVzWjqJJvEp3iwmk0L/0kerFlQ8GHnpqqIIHKnkhYvVyPARBFFmg/7+9p4arlct6/ nE9Gb9PuFAqNy1sW8+YrTTrDEHyWdsu+7L/1TOk/eeVbYcwv0tq4uPLKg1k0y+ZAYko88t ergt47mxhZczKF+6JNshPdufDD+RUHk= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=fdLET6XF; spf=pass (imf11.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.176 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3ea4c550a3fso2766381b6e.2 for ; Tue, 03 Dec 2024 07:33:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1733239980; x=1733844780; 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=ckrp5/MogNB2HvhzJuNOPyu1ag5BruWn5XeKlERZse0=; b=fdLET6XFAdUxlQKyWs51WOE13dkUX3j4XmObPWhTEUGlJX8U7kFPH0duXqlzjpnBXN FMDmmNYBED+JH5FO3nCe5bMtdKZo0c5SwySkwqaZDeb590iZmqoPLHcYAm6+TqPMitBW 0r50cArkWOlIORros03YtXXll3zsbS757Ad67Z+ytB1PK/SA3b/Q+DLJ2uOYzZHT5GOt 1RQFAA9f73U95Dyjsg0aeTJgRjHTII8+HgNepuIApgldBqjRFbP/JqdVmArmqh8mrMPt lvQ4aX3MT0+YrV+0pXLtbJ9WCwdcSs/oHZ4ewwELDNNzmgGiU6cdRErRLW0JWutEIlQ0 BO4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733239980; x=1733844780; 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=ckrp5/MogNB2HvhzJuNOPyu1ag5BruWn5XeKlERZse0=; b=rN3r+7ZXwIV8t2lyVZQOZgOj5xm1e1U6MWkIkANI7X3uDJwIhLCuf0w5O81HTJihZL Z2OA+gx75AqFWIbWuVOcWzz/VOgjXXuNuOMUo+Lc8iiTei4BeyAjTde6f4cDdrpaEuDz iTcFgTi4ne8uK+wSMx3U0jmByftb11IwYuZFmZerUGV9PQmMaVRvNZJyW4IneoYeT08O k14r1hm94t7PEoTxvq5asVdU2NPn33hYAmzv4iKWV9JGWwLa1uAzU7ZPcC/s7XEXL/dd jS8WR/LkISvzeb90vUD5F9Y959Ca4suC6aovsGQgH5mQtacKb+dqBGQ6x2Rv6g5TAIXz HXTg== X-Gm-Message-State: AOJu0YwK3kARMeDgHwKAyQ2z5/g3zZw34Z5KuyGJ290jTeZisiRuJkTF TwLjt695EwreLZdyeJJk1R2p/iWa7M9c1l/lFiy3Rf+g45l/d8On2It7XNghridMUY1NPymAKcr C X-Gm-Gg: ASbGncshArrdCccQTVSzurbcQqqFAxmXMd82GkE9olzfP1Iq7TObvkwZY3SbjpB4uTR +z0VtWyCsP3yfPAcbkLo8rHrKw3wL1ms0tQutIErDbniPk2uKJdaXZf05DQOF7AkMVygtyTmvss wjcfT3rJwF9PX3DYecSJSib3+Pa98OnGBgRcVViOBX9Qm9FJ8+BcNKJJ4IvzULPJXmoUkrIe61+ SIM3c73iREwaHkFOBP/kbrpJnFc/dNeRfFcb8c5Odo2t5LG0tYPnEjzGoQ= X-Google-Smtp-Source: AGHT+IG43FQHTFqL4PqM6F3qojzARV1JxsiCZ9D3Zgsdfa2TEHjYK26CmkPy2H7KTh+zkEYZWpQaaw== X-Received: by 2002:a05:6808:3085:b0:3ea:52b7:ebdd with SMTP id 5614622812f47-3eae50c51b8mr2904392b6e.42.1733239980115; Tue, 03 Dec 2024 07:33:00 -0800 (PST) Received: from localhost.localdomain ([130.250.255.163]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3ea86036cbbsm2891878b6e.8.2024.12.03.07.32.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 07:32:59 -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: Tue, 3 Dec 2024 08:31:46 -0700 Message-ID: <20241203153232.92224-12-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241203153232.92224-2-axboe@kernel.dk> References: <20241203153232.92224-2-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Queue-Id: 9226540017 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: d1wnenu3qc7okcuhst1rzbau9hz5xs3e X-HE-Tag: 1733239968-774086 X-HE-Meta: U2FsdGVkX18C2UpC8gPPYcz7YRlAiQM3m5pykSZSN/viUvvvdq3QrR0rV8XwqDm7Mmbopgp2wVctjPDZ28CPBhThExa+919ow1DKT2etOeSLSt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v5aXgjr72hBM0DFab63mVb7C4xXI2UU7bTmHbngFIZnXNqJ+8pPpNVU9k4jleVB5EHhANkJMDmsduxxB/EuW5JQ5Dr1pTS5Yu8tw6NuGz5xSowBAFfacrhVQyDz4tLPOJT8bMFDVk5sxdJl+Bac+Ep 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 b64a78582f06..40383f5cc6a2 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 eb6a8d39f9d0..826df99e294f 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