From patchwork Thu Mar 28 16:34:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13609082 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 C7045CD11DD for ; Thu, 28 Mar 2024 16:37:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 589066B00B2; Thu, 28 Mar 2024 12:37:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 539106B00B3; Thu, 28 Mar 2024 12:37:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B2BA6B00B4; Thu, 28 Mar 2024 12:37:22 -0400 (EDT) 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 17E786B00B2 for ; Thu, 28 Mar 2024 12:37:22 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D862F1603D2 for ; Thu, 28 Mar 2024 16:37:21 +0000 (UTC) X-FDA: 81947003082.26.949E9E7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 2A4D11C0002 for ; Thu, 28 Mar 2024 16:37:19 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=abic5Itt; spf=pass (imf21.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711643840; 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=Mem7lNP+7V6c2t0lUM5oHWZtR8iLqSZVCInVABGeIfQ=; b=t87wCCCzcicwPC6SGms9DQmKAitfVY8UzmRl0ncgZf4XLBI8oonzTyGdPiGLYJgdhCecoP kSzowupdD/g243geqotdQIrcMjsfoic9AlYKFhw8RgDCWBF6f2tH0CozacjBoH1ALyX8GC Vjoc589YuTGvla3w4/oUuwHxWsLHXW0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711643840; a=rsa-sha256; cv=none; b=gwdET3Wgk7uUtXXYYwRwpmb4m4OsqUcj8AF0Z6frbcmL9BPhtLp00/NmMH7FFRiDOpgLKb +PCxP8xOBAb9IrWKcLOAsoQTvetbNzxDFKE7ObtbaFxNcC2qmTZWCkFzPSASKUWtxYrgI1 QAFTueUIqodHH9HjkR1UKCaH+H9EtKY= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=abic5Itt; spf=pass (imf21.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711643839; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mem7lNP+7V6c2t0lUM5oHWZtR8iLqSZVCInVABGeIfQ=; b=abic5Itt7boyytZ4N5mmXJGogYm9TShlkZOVbVy6Yf9GZpwh/Wn+PyW2tE8VeT/ByEhync ozkdHdupeR3aQ/Lx/SiqcFH1uUl0uvbYOhqkSwUiLmHTLElxFTS6x/ul04Cuw/yB042nl8 Cz8aZC4Ya7MR+rJ6H8ldpms/Tx3WS7A= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-350-kZUy3AvkNlqShTvnlBvVOQ-1; Thu, 28 Mar 2024 12:37:15 -0400 X-MC-Unique: kZUy3AvkNlqShTvnlBvVOQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 97891185A78E; Thu, 28 Mar 2024 16:37:14 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.146]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F62F200AFFC; Thu, 28 Mar 2024 16:37:11 +0000 (UTC) From: David Howells To: Christian Brauner , Jeff Layton , Gao Xiang , Dominique Martinet Cc: David Howells , Matthew Wilcox , Steve French , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , netfs@lists.linux.dev, linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Latchesar Ionkov , Christian Schoenebeck , Steve French , devel@lists.orangefs.org Subject: [PATCH 13/26] netfs: Remove ->launder_folio() support Date: Thu, 28 Mar 2024 16:34:05 +0000 Message-ID: <20240328163424.2781320-14-dhowells@redhat.com> In-Reply-To: <20240328163424.2781320-1-dhowells@redhat.com> References: <20240328163424.2781320-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Rspamd-Queue-Id: 2A4D11C0002 X-Rspam-User: X-Stat-Signature: dco77oq6wey1i178m98fdoiu8armesbc X-Rspamd-Server: rspam03 X-HE-Tag: 1711643839-364145 X-HE-Meta: U2FsdGVkX1/qgaCzi3IwlEQ+WWN76qA7yI9wZwevXGBZ6IrkQkn6SFPA/NgFH3YnhLC48OckxDOpS1x9HKeCgAgKG8cDvuWkLM0ifFsC78ilOmidsenhK72lgP/FHMTSzBqDkgxEI/aek4PUEqbXyA0NJ4KtGAA5O7/wNW7z7WvkkEAqokCNg82wQFZ9CQX8z5Px6pyGwaGben5OXbDK7WwS8g7mu7XIMl9WoK2LNrMHcHGcwaOYU32nBsvTiNGco0R5UKwYgQ7P9x3oS3Qawh+iAHQgT8RRoKOyLouY7o0y5w0cm+n5b7vm4WMYjYLPEmNv6lcfmZt/puCOm3rXISYQchcsJA0a9ri891VPLfX6nPvkKym1FzaYOYLUu5tiTRhoe0HHffs2quSAPbWkPSrkUIR3cdSPdl5aMNzShTTcLrhK4GBFDqoJ6f4beU5KQips6Ol1hb7o2IRXIMMI0oe2iMPuOqUVwSiRPOitZcO2qOJrZB9bwIU0Sb2774jJvLuHbS3im7OHy1XFebz0KaSgFcve9iaGwoenc4Aq5OY57tgpmcq7aVzn0G/MuG4Rej/x31um4YUNWaSRiFIx9Jqrt1tSL0D2HG12UNOQAzCUh3yR1OI9N7F3ji1hnBZL5ZuMhfufI6WvAcu7OD4uMFgDT01wnPMWDK8wQqDSxf14/7fVGZnsNWAN5b1rKoym06Gwa77zoY6XKH0II6OFyKjjp/UmXJb1WAAbximCsGQKeUgt8hH+U8C1BfdgRLGSPRx9py9PuivH3VC/QnPvUV36eS1U/fA08ycn3OwKERvp2OBa5+AoM0wO4+Y/lxBmui1O+UyNAhk4mAP/BUwPTMWxVeIk/5zABi109rLujQ5HUmwqXGPR468O40a8t/ewF/YYC5OzwlYFFo4LJRGmcWIiH80RK6PzAmhLgURUscVoKQPALV1FijD+1qdqvDt4iH2PQSkRhrEARVSqC0J W4WRwFCx 9Pw3NIwaTib4jdTsC9k0JDzL/K9P245eYN2vJb3u7IEgjUIGlkY9UARqn7t7HpzRsXm2tbODx6zOlXz42r9Z+YmFMU1uJcxHu8U4ZJnPdlWN/cPnbC0vbwTtCUOsp1MORnHuayyQUAaorpVxrgbB7hchvqEPY5zpnBAHHZyuZVjWybJA/PiBxyQ4YeEqC7VJ0T1tt/fZP0iO1LyXiZ3EQJp/NJ7kiB5S9v/WI/QV8kF8hlWuw3hO10PlWk0Mlr42VnvAu98xZ+7NEYJtu81uDKF6UV29okmiKVVGgCwTC03N0miLnr3nsSUhIB6wjW52z41dPpi/6sYuvPhvm2FcPtRcaHoyLRKuyZNOYWRfJNe5vyF6EwgBbH0i+JAUBQLd6fg/NEX/veIqK7vvc/C1a7ewVOEvBV1r0uYTAoVyFslEkSgTpOe2FK8BH0kvhoaR1Go8q+pIOyotO1G484oARwYFDAvdGjuNXXdD1O9AcG1WntOWX0gSt9QhQZQBwQsKmHniw4Uf0BH8+3SVLxeynpLUWz2jzMn9KaVZ90LeTNfN4KOTnNBaVjnfiIC8XZhefL8UVgohrmCcTQkWsayK79TNQQLPHpJMqPxIZrvW+kMmp//2snUwAvGermDJ5G8npWOxNpL3Le3JRILBsA/XwNWw/NSEfurz1VBvcvUggysXcQkvgUD8qwZ+NTEFKuPBtZjw6j70Vh0z9cFFuo9kE/BRUqG5C31YosBDMCyU3GvuFaxyvj+ZWR6HWxOJ0fdSydEWT 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: Remove support for ->launder_folio() from netfslib and expect filesystems to use filemap_invalidate_inode() instead. netfs_launder_folio() can then be got rid of. Signed-off-by: David Howells cc: Jeff Layton cc: Eric Van Hensbergen cc: Latchesar Ionkov cc: Dominique Martinet cc: Christian Schoenebeck cc: David Howells cc: Marc Dionne cc: Steve French cc: Matthew Wilcox cc: linux-mm@kvack.org cc: linux-fsdevel@vger.kernel.org cc: netfs@lists.linux.dev cc: v9fs@lists.linux.dev cc: linux-afs@lists.infradead.org cc: ceph-devel@vger.kernel.org cc: linux-cifs@vger.kernel.org cc: devel@lists.orangefs.org --- fs/netfs/buffered_write.c | 74 ------------------------------------ fs/netfs/main.c | 1 - include/linux/netfs.h | 2 - include/trace/events/netfs.h | 3 -- 4 files changed, 80 deletions(-) diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c index 576a68b7887e..624d8859c2fa 100644 --- a/fs/netfs/buffered_write.c +++ b/fs/netfs/buffered_write.c @@ -1199,77 +1199,3 @@ int netfs_writepages(struct address_space *mapping, return ret; } EXPORT_SYMBOL(netfs_writepages); - -/* - * Deal with the disposition of a laundered folio. - */ -static void netfs_cleanup_launder_folio(struct netfs_io_request *wreq) -{ - if (wreq->error) { - pr_notice("R=%08x Laundering error %d\n", wreq->debug_id, wreq->error); - mapping_set_error(wreq->mapping, wreq->error); - } -} - -/** - * netfs_launder_folio - Clean up a dirty folio that's being invalidated - * @folio: The folio to clean - * - * This is called to write back a folio that's being invalidated when an inode - * is getting torn down. Ideally, writepages would be used instead. - */ -int netfs_launder_folio(struct folio *folio) -{ - struct netfs_io_request *wreq; - struct address_space *mapping = folio->mapping; - struct netfs_folio *finfo = netfs_folio_info(folio); - struct netfs_group *group = netfs_folio_group(folio); - struct bio_vec bvec; - unsigned long long i_size = i_size_read(mapping->host); - unsigned long long start = folio_pos(folio); - size_t offset = 0, len; - int ret = 0; - - if (finfo) { - offset = finfo->dirty_offset; - start += offset; - len = finfo->dirty_len; - } else { - len = folio_size(folio); - } - len = min_t(unsigned long long, len, i_size - start); - - wreq = netfs_alloc_request(mapping, NULL, start, len, NETFS_LAUNDER_WRITE); - if (IS_ERR(wreq)) { - ret = PTR_ERR(wreq); - goto out; - } - - if (!folio_clear_dirty_for_io(folio)) - goto out_put; - - trace_netfs_folio(folio, netfs_folio_trace_launder); - - _debug("launder %llx-%llx", start, start + len - 1); - - /* Speculatively write to the cache. We have to fix this up later if - * the store fails. - */ - wreq->cleanup = netfs_cleanup_launder_folio; - - bvec_set_folio(&bvec, folio, len, offset); - iov_iter_bvec(&wreq->iter, ITER_SOURCE, &bvec, 1, len); - if (group != NETFS_FOLIO_COPY_TO_CACHE) - __set_bit(NETFS_RREQ_UPLOAD_TO_SERVER, &wreq->flags); - ret = netfs_begin_write(wreq, true, netfs_write_trace_launder); - -out_put: - folio_detach_private(folio); - netfs_put_group(group); - kfree(finfo); - netfs_put_request(wreq, false, netfs_rreq_trace_put_return); -out: - _leave(" = %d", ret); - return ret; -} -EXPORT_SYMBOL(netfs_launder_folio); diff --git a/fs/netfs/main.c b/fs/netfs/main.c index c5a73c9ed126..844efbb2e7a2 100644 --- a/fs/netfs/main.c +++ b/fs/netfs/main.c @@ -34,7 +34,6 @@ static const char *netfs_origins[nr__netfs_io_origin] = { [NETFS_COPY_TO_CACHE] = "CC", [NETFS_WRITEBACK] = "WB", [NETFS_WRITETHROUGH] = "WT", - [NETFS_LAUNDER_WRITE] = "LW", [NETFS_UNBUFFERED_WRITE] = "UW", [NETFS_DIO_READ] = "DR", [NETFS_DIO_WRITE] = "DW", diff --git a/include/linux/netfs.h b/include/linux/netfs.h index ddafc6ebff42..3af589dabd7f 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -172,7 +172,6 @@ enum netfs_io_origin { NETFS_COPY_TO_CACHE, /* This write is to copy a read to the cache */ NETFS_WRITEBACK, /* This write was triggered by writepages */ NETFS_WRITETHROUGH, /* This write was made by netfs_perform_write() */ - NETFS_LAUNDER_WRITE, /* This is triggered by ->launder_folio() */ NETFS_UNBUFFERED_WRITE, /* This is an unbuffered write */ NETFS_DIO_READ, /* This is a direct I/O read */ NETFS_DIO_WRITE, /* This is a direct I/O write */ @@ -352,7 +351,6 @@ int netfs_unpin_writeback(struct inode *inode, struct writeback_control *wbc); void netfs_clear_inode_writeback(struct inode *inode, const void *aux); void netfs_invalidate_folio(struct folio *folio, size_t offset, size_t length); bool netfs_release_folio(struct folio *folio, gfp_t gfp); -int netfs_launder_folio(struct folio *folio); /* VMA operations API. */ vm_fault_t netfs_page_mkwrite(struct vm_fault *vmf, struct netfs_group *netfs_group); diff --git a/include/trace/events/netfs.h b/include/trace/events/netfs.h index e03fafb0c1e3..30769103638f 100644 --- a/include/trace/events/netfs.h +++ b/include/trace/events/netfs.h @@ -26,7 +26,6 @@ #define netfs_write_traces \ EM(netfs_write_trace_copy_to_cache, "COPY2CACH") \ EM(netfs_write_trace_dio_write, "DIO-WRITE") \ - EM(netfs_write_trace_launder, "LAUNDER ") \ EM(netfs_write_trace_unbuffered_write, "UNB-WRITE") \ EM(netfs_write_trace_writeback, "WRITEBACK") \ E_(netfs_write_trace_writethrough, "WRITETHRU") @@ -38,7 +37,6 @@ EM(NETFS_COPY_TO_CACHE, "CC") \ EM(NETFS_WRITEBACK, "WB") \ EM(NETFS_WRITETHROUGH, "WT") \ - EM(NETFS_LAUNDER_WRITE, "LW") \ EM(NETFS_UNBUFFERED_WRITE, "UW") \ EM(NETFS_DIO_READ, "DR") \ E_(NETFS_DIO_WRITE, "DW") @@ -135,7 +133,6 @@ EM(netfs_folio_trace_end_copy, "end-copy") \ EM(netfs_folio_trace_filled_gaps, "filled-gaps") \ EM(netfs_folio_trace_kill, "kill") \ - EM(netfs_folio_trace_launder, "launder") \ EM(netfs_folio_trace_mkwrite, "mkwrite") \ EM(netfs_folio_trace_mkwrite_plus, "mkwrite+") \ EM(netfs_folio_trace_read_gaps, "read-gaps") \