From patchwork Fri Mar 7 13:54:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14006522 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 5FAB3C282DE for ; Fri, 7 Mar 2025 13:54:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DFC96B0098; Fri, 7 Mar 2025 08:54:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 140AC280001; Fri, 7 Mar 2025 08:54:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E36536B0096; Fri, 7 Mar 2025 08:54:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AA4E96B009A for ; Fri, 7 Mar 2025 08:54:20 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6EDE880BBE for ; Fri, 7 Mar 2025 13:54:21 +0000 (UTC) X-FDA: 83194899522.11.C9DB16C Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf10.hostedemail.com (Postfix) with ESMTP id D5BBCC0009 for ; Fri, 7 Mar 2025 13:54:19 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=XY7U93Dx; spf=none (imf10.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741355659; 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=nbz+BLNYgFlD4q+RSS71Ot7C9TdXZjDl9SBqkDnbsow=; b=kBl3JKhgNJhvLc/BhLytTc3/7bvwMlcx1l+6G0EJ1XW3DfPnLbhSJdauF4PipSkmoainX7 B/DlufOST3CvtAEWbVejPZSou7bGzJsK8Vr/sCqOJlorIjGmJw0UK/lBKRqcdTCGEwBnuD b0BdTvlwyclu7lx/sy+Pv4cLLnmHTf8= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=XY7U93Dx; spf=none (imf10.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741355659; a=rsa-sha256; cv=none; b=gBsaoM0jPbQ3pv7DXEil8wzeMDJIH6Ak3jhAj551pCjEPLSy0ERQFcxM/V8HrD2gTrCOMT f2LYaLxHHPSrr8W/i5nsEADSddSUvZ2Mzwb/kksvGTUVPUxdM8Sta3t74b7OPaPAG5VK0J Gxjqrt/2F7JT7nHGGDqjxbzLbGQ42P4= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=nbz+BLNYgFlD4q+RSS71Ot7C9TdXZjDl9SBqkDnbsow=; b=XY7U93DxQ+cGHvN+aCVMwhd7bD Q5omSA/aDlZZUo4fX5k0l7Bt7oZCdWZFxn3uYSrmnYsV+05wv3PbwCywdxZM18Sbk0MwOcLQWaWIK jKYjpk2VpjpmGP7AC7Z4KtBd4OE8uUFu1LVAs78sznRKKHgeC2KI5uPo6riG9jppW70Zfw1HDACxB zk3tAtFduAuGZ+lMVcXsHpAbD9dU+69tKdaGcCcUAOKATP3I/UZogeaTFNZZQLxYF8VYQ+QBwnzKx 727elCnkPaDIaHy3WvwUUkIBt3aQh6YLeCVtLpZK5MWWOWijpRqVdUkyPZwR/Ml0adWX/Bn9Hud/f /BzBL14g==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tqY9X-0000000CXFr-2KOb; Fri, 07 Mar 2025 13:54:15 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 01/11] f2fs: Remove check for ->writepage Date: Fri, 7 Mar 2025 13:54:01 +0000 Message-ID: <20250307135414.2987755-2-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307135414.2987755-1-willy@infradead.org> References: <20250307135414.2987755-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: D5BBCC0009 X-Rspamd-Server: rspam09 X-Stat-Signature: xj4ke8eoybsru8q8ejz6rh5y6ajy4x4k X-HE-Tag: 1741355659-940219 X-HE-Meta: U2FsdGVkX1+741v202SuqQxnKcXeSZw4fteBJxjRcjhh4rpVrlq64HUzw8UQP+i1BlLV+7hiIQcmVP9du72CogJZr8G9Cy5jUS/4UyNzVAgYoCYD+U6o1/lYjHvjOf3ogWYq0cVMHj3EkOA9lWjla/BkcpomXYrFnTehqb3tpgAStg35mIHuNmZLfy4PCW1VNHXsbnhUWIqHD/eIZ/dJRAJ7ra+aLElFrav1HTk+PSWJXhkKQCtYexf1eY0aPjSwTc2xLHbPPx3/zBy5/e+fxS2Og9fScQZq8TYWguE+iUqTTQ3tjAbdAaudbuJdBIOq/GMjGnk/lFTReT5H+fsMmIHdFfkhqQKk6MdY/kd5O1fw2kBI4gvqL/xb6YIBgnJje53CJjW4SU/xDAAVPJmx9QIzCcLq48I1sqw19t2r2k9JyJAXtuI6HVs8pgVqF7zs73l557w0WqLjiDdVSH8v3cdoni78KcyjYwOSryX7rLGNBfeM0UEofUUdPH6hrPu6PovTgAFsZpj7cctlj2L66Dojrm3Z6mASXJ30a7lCPhRawm19Uex21MIhBdO3rzDk+6/mFgusj1gT6ZrhCQZHDWWYkLDDET+rMjjiICP8quuaDZE5v8+nMaGxTXcHplUn9jVy811XNJNEl7nMf+ZYLljZ4Tv0O1Xn7D3sGsVehk4FnuwebEP2SOZKpg+OyNUWhq41hX9ocV9YmGYbKdf5H1i6OWA+OchQ9MInrI8l/nMYo0UNQSAXG65A/VLa6xGHSF1Z4Vk689BBeaZqBsCXrckR0gEnzYrzeHe0K2O38zIDzVV4ZtIkDRKaCI0CpRDQluV576KnrJp5zTraUyvU5Q0b78LFSuaG76hzy0OBpxfiP4iQkEny25jW2lLXH+gdBRk8nx6xr1QAh0G1DEc7ELEWFw7zBUQGrojzN4cwB0lqDknZPnFFGNt2yICYoJfbDGmF3tQtY7ZwD9vFS+A z4ePhkrs mmg4cM04KLHs+c76lD9BYtCcHbNeuvxf+NGX3drr5FjWXisDv1Tl/WD8WiIDrdkjHkqEYyRvw9ylRrWmSM+3OseClLPwePNb48+2EkaSe+dDn6aLQOCMDgdJ6QqSOvCc/nPwionFzVRzfUTqktzMIJ4TS/ZaK4ZDqgfM76Z2G/lHpv3eTyVoz+NLURB7MX00kVPzRaqE7DKdQ3UeQRYFKJkByct7cPR2UdEDp0xDXse7MLy1Ft30MO3eTf3MrYR2/3X/kp3ZjQD8NwqM= 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: We're almost able to remove a_ops->writepage. This check is unnecessary as we'll never call into __f2fs_write_data_pages() for character devices. Signed-off-by: Matthew Wilcox (Oracle) --- fs/f2fs/data.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index c82d949709f4..a80d5ef9acbb 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3280,10 +3280,6 @@ static int __f2fs_write_data_pages(struct address_space *mapping, int ret; bool locked = false; - /* deal with chardevs and other special file */ - if (!mapping->a_ops->writepage) - return 0; - /* skip writing if there is no dirty page in this inode */ if (!get_dirty_pages(inode) && wbc->sync_mode == WB_SYNC_NONE) return 0; From patchwork Fri Mar 7 13:54:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14006520 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 85AF1C28B25 for ; Fri, 7 Mar 2025 13:54:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC5BB6B0088; Fri, 7 Mar 2025 08:54:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B77836B009B; Fri, 7 Mar 2025 08:54:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76DDE6B0098; Fri, 7 Mar 2025 08:54:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 094776B0095 for ; Fri, 7 Mar 2025 08:54:20 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E7D92120B8A for ; Fri, 7 Mar 2025 13:54:20 +0000 (UTC) X-FDA: 83194899480.17.3B16620 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf05.hostedemail.com (Postfix) with ESMTP id 56CC0100009 for ; Fri, 7 Mar 2025 13:54:19 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=K0rUlg3+; dmarc=none; spf=none (imf05.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741355659; 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=gYAlq/IZDrN3gAui/tjJNHWS0bZWyHE15MvZlcNIc7w=; b=gn2lR5SovmBby46JjsADOZzNgkUhjETQgNuDZGRWl9Jd0kFuv8RsZ3MI8RtShocZwghkeC Oi/qZ3k6lzhLRS9NleQktKkaanEeC6kcGDKPABjlgu3cwz3Y83OvKUUWvbVPWC0KoP84LA RL+eljmKaFwpm4nkWpVU1+csLsgw7LM= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=K0rUlg3+; dmarc=none; spf=none (imf05.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741355659; a=rsa-sha256; cv=none; b=UF4viGKeaU+yM07wilQ3ejq+C8REZF1Rf+IWg5+Irahqmk5XZpPD8Aj8mD90mUjqJWwSAr M1Z5C39njV/l/7cP9h0sWXV4LOTjYmVSVh8Mprb/2qqLnrADKzrDiWXpmC8waeTzINvB3W mQvI0J1koAuD2VvnXMt3TpABFE990xo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=gYAlq/IZDrN3gAui/tjJNHWS0bZWyHE15MvZlcNIc7w=; b=K0rUlg3+uTjZX3ud/LW+9LOept eIWClltyGb551+sTtSjHCSZEBJNGkuChoXa74eq4oYYIuEdEAfgeArfvO3oklLkFCn/EYC7h2mCqI E75wHlKErYegjFzgWWReHWhUTQqWQ2FhM1ffcbZgz4t1t3Z7Tnu3hFNPX72K23UrXm1Oyka/m4Ymu vOjmwRLhefSEPrfeUv0U9xEZLAmnegRAjGVleZzIUtp00VM2cT/JnPGqEZzXEAyA3nCx5In+W7si8 K4V51BwGYhJgz2F/Pbnsyc3xyQ0uwSUWzyVps7NBtGXl7vNBcGZ79Mfg4Lgzs6lW8WsUWx55917/c pqF/8D4w==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tqY9X-0000000CXFt-2gHs; Fri, 07 Mar 2025 13:54:15 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 02/11] f2fs: Remove f2fs_write_data_page() Date: Fri, 7 Mar 2025 13:54:02 +0000 Message-ID: <20250307135414.2987755-3-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307135414.2987755-1-willy@infradead.org> References: <20250307135414.2987755-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 56CC0100009 X-Rspam-User: X-Stat-Signature: n989jkw8zf4ojajm8tzkybdmt4ufgri7 X-HE-Tag: 1741355659-304772 X-HE-Meta: U2FsdGVkX1+1BP3y3/ZMU8hSV3c3Ga5l15TsXsE0osrOjAPxMR2buJwNyiDsmK6xiLc5T8u4jyyJcTqfFK+y5nfvPier6Brn0w/lCcBVmDgtH30QEPkaVVLGcyP9ndValpS+IdrI8hESU944tLBSdiZfejYWnAv9POPTH0D5ByT7aUacqoL3T+oNVC2TBbK4j3tkZivf8CQvJdHvrPr0N2el2hQnB0ceh8/64kIPzpCp/rn9ICGfVdREcw9TmjWm5Q4tAdm8UpFUm1pSZsgjOwCvZQc3XuVCxR84D4jmCgo1BiNTTfQp2IT5Q08VJLFAqxIG1BjyllR82W9L0OZyPbZ/Jb2fXi3Eut5yHJuYaUU1iQcRpQssndw3Jn8USDSXB8fgyIw1bMjJ7x1kE7faDFkGL2h8wGaDtMRA1842uAQFpEpqKzcU+VrubXR47FZ1teth4RI3PDZuLv8MLO41mNubOpmAJjPf+P8qm1idGTuXE0asQIt/kpn8mzw05lCXxGCqeI+0Zkn8Li0E3YJod6cteVq7y3lO/m4WLherlWS/HM7Lncx8jlyogudFhilVBpIJwqClGi1Q9Lqzqqd0jl5sgCpitoTx8TLjLANivnaxKjF+xb4ly1kcdwXp0zwTYp8ycI0T5RtayYsuTrpHiAC3L4zTRjcZqmZJCoAmVDplwqzEutUMuHHYfTLj86SQea2wsmkYTkBzPpu1uczNaD4fwZNPdVOPCIozA1v0KK/CiAXreC5fUpIfMo+BNZOmBSCa6umZMIEEeVS2rnDodwUh20UpsQ6prv8w8s3hTrWYEZIUuQYRSeUgMu4U3tiFwij43clLO7CrPO8UDKMRMVcJCU/5MOtbw8gf/bFPuAZJWjSqcMVhucq0VyZxIy2kfns5JKWMjcO3OyjBHsBn5wnFJhRsxV4IA8a2WoBB+LfQm9iGDkp0a5uK3I6BK+nXkYGs1NrrVXjHhS+WWOp 68BdOIkV Scktq4QhIaSGC9Td7+ZIcLnLYY+1JPABui+j0yu11zQ2dytcL0G/2yZ8fUcydQRXmucdzxq11Iao+6mur1wsioo8jxPq9kYT7r2wkbVqpEtCstvkpD01fxyspt7KHyHcDsPoFI8ezpMBOPKkbMdwUY8CjfBbwjEpBESB5pQQZmvLcM/NmqNiC3rcmmbqKBltvt8ZRlqnsrTLQKj65zHPfct6/ljThnbi7CAX+G1S+pnz4jC8LQJR3hI5/zaHbTupxS4OWLRzPeHcyXfKyt1UkzgRkZixZmXbvRyqm 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: Mappings which implement writepages should not implement writepage as it can only harm writeback patterns. Signed-off-by: Matthew Wilcox (Oracle) --- fs/f2fs/data.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index a80d5ef9acbb..cdd63e8ad42e 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2935,29 +2935,6 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted, return err; } -static int f2fs_write_data_page(struct page *page, - struct writeback_control *wbc) -{ - struct folio *folio = page_folio(page); -#ifdef CONFIG_F2FS_FS_COMPRESSION - struct inode *inode = folio->mapping->host; - - if (unlikely(f2fs_cp_error(F2FS_I_SB(inode)))) - goto out; - - if (f2fs_compressed_file(inode)) { - if (f2fs_is_compressed_cluster(inode, folio->index)) { - folio_redirty_for_writepage(wbc, folio); - return AOP_WRITEPAGE_ACTIVATE; - } - } -out: -#endif - - return f2fs_write_single_data_page(folio, NULL, NULL, NULL, - wbc, FS_DATA_IO, 0, true); -} - /* * This function was copied from write_cache_pages from mm/page-writeback.c. * The major change is making write step of cold data page separately from @@ -4111,7 +4088,6 @@ static void f2fs_swap_deactivate(struct file *file) const struct address_space_operations f2fs_dblock_aops = { .read_folio = f2fs_read_data_folio, .readahead = f2fs_readahead, - .writepage = f2fs_write_data_page, .writepages = f2fs_write_data_pages, .write_begin = f2fs_write_begin, .write_end = f2fs_write_end, From patchwork Fri Mar 7 13:54:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14006518 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 41762C282DE for ; Fri, 7 Mar 2025 13:54:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A26A16B0095; Fri, 7 Mar 2025 08:54:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 69E766B0083; Fri, 7 Mar 2025 08:54:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B0276B009B; Fri, 7 Mar 2025 08:54:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B5A7C6B0096 for ; Fri, 7 Mar 2025 08:54:19 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AB275140AEE for ; Fri, 7 Mar 2025 13:54:20 +0000 (UTC) X-FDA: 83194899480.06.4F70690 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf14.hostedemail.com (Postfix) with ESMTP id 15902100004 for ; Fri, 7 Mar 2025 13:54:18 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=nnGr+Xt3; dmarc=none; spf=none (imf14.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741355659; a=rsa-sha256; cv=none; b=4gl7K+76N4DzalnIJZAWCy6lvdO1HrjuNEJtXJCZ1Iu+udDz5AdyBGp8lEw3vVD0zW0HVu rluYSVubCx9jYtBpC9jM55HHX2kz3F+YDVztTGVh4voww/NNIyOoKTZ6R5MZh5Py0RVoDF uYwHuu9FkfnmIRbQnVSGwByN3TfDPZA= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=nnGr+Xt3; dmarc=none; spf=none (imf14.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741355659; 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=T8fXRyaYOssoLEG59sUpr97PSMqTmPmVh2Clh/QPZVU=; b=KRRNTTLXnQ9ph2Solk3nSS9ooXj763FXPAU0Jz2AUdVa+KJB2dGRTS3b5aGz4JdoHagfb5 Ix96VJJ8FvY2pM+iVMlg1YrWhZddgqVe6pFeMjPf5vnrc8EfIRb3BLEkcF1VjxlkvYz1eI XlLBJKlD/DU0UMZobtTLdRsx1viYelo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=T8fXRyaYOssoLEG59sUpr97PSMqTmPmVh2Clh/QPZVU=; b=nnGr+Xt3+97jZBGQECj87NaDqI XK8uVQj8thhehM0zZlfDnmvlOXcBQ7SO/K8NTEb3FRquZXAarnz7wDTJEkwev+safNXqNwMRfnaif +pAsjoSitQfyymKZLmoU50i4NHcwZ0cC5EuNc9jfgqDK6BdkWuzJg40ZAJJ3uBIMmknep94icuZG/ C6WPgd5F3oI4SCW3MO4/ii3C5CxeWkeuBT+bEHgvTn8os3y6u2ttvT+5+8RkNI7GuVwyyXf3aIW0y qaE5ugvrhoXw5fNciwFpeMMJFukQfyGGRVImUAaBUB6ZgY8zt4atiw2YWormv0v03A69cDNPIGN6s cML+42aA==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tqY9X-0000000CXG1-3uYy; Fri, 07 Mar 2025 13:54:15 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 03/11] f2fs: Remove f2fs_write_meta_page() Date: Fri, 7 Mar 2025 13:54:03 +0000 Message-ID: <20250307135414.2987755-4-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307135414.2987755-1-willy@infradead.org> References: <20250307135414.2987755-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 15902100004 X-Stat-Signature: x138bpnchs86k8zmeftt7gsnds41dm5b X-Rspam-User: X-HE-Tag: 1741355658-150708 X-HE-Meta: U2FsdGVkX1++ZR68NF7tjsm4YkF+FsgEkFV7y3BGDBNDVj1shzXlrZkWahFruvXwT8pHj26gv0QUDVvfGrUmQIXGuvlsSfJzLTI+B7bzRe2WxauTGBxJMLkaO7KPufHqk6n2GaB/WKYlrTqR5VFk2nQ+/CFtCO6uhkpACZ64blS8jy5rb+mWSQFR9wB1RrjcC0CAsl7A9Mru73/291zHDYxsSYsBeVe5ZX92wEmpIOTr63O4yeMO9gpX27qJwA70haGPoutPhSTH6BFC52ZbJKERrFd8YXSZhgeaOrlCGeTRHEE7x3m4PH0kesWuDIXs9nxTYGrTKU4FSVfwQQqvSWDheEOINCNkT4iMhzVgFm6yxNa5qpBk3tQe3ffXVgBUmdRVSMBO85uPBxAQlzmGh0ye0CsiAN5zaqWdlbTjBuzVOx5BVJyEw7dNTOEf7F5JOjSTuM4NaPgKywqTlp0t9BMSdpTAnuOm/o5plUtuY+LAG2wvyMFoPrhBaoC5MMqYyeAhP7h/WnllMc32NXG7jVR+MtUKofwKVl2Hq+qF88CYqBFu5GppQk0xEw8/QKQy+XPTlwXvXgeaydoTNMvX0o1CsdDSS6BhcDpRRbT0tmu9UQsgux2J4l2jZ6StM5gsZMlTbyJyaK8JJLEazCwgxqFQCyAACG2nLIesVHiZIg6o5FxFHS0G+3Bmus4Q62OzsIuBZuXImy9Z1SOPYDfKR7wG0qxt2zvf2BOKzST7wnZvnnMp17yFyEHyR2FU2mxrgMlg20mZ6kdR+oQ8DUf+gninKY+om7qXdjLhfnoWkqZCfDALIR9Z3rmuVTpusWIAnJNd4Tt9PxmBtTByPFBAXI2s+yC6kxw1gE2Dlmw1iA5wKiZEuUjDzddvAY0mMS/sQiwJkUCX1bcPmnbcRgBeLxpluuj3FRJjEewy297q8HcBtfZIduWdu1jLQLaYjf8PoAI8/IQg7I1bT+zRYci ShKRuQMr KPtABcnz77u3I4f7iG450eKz5fdCil/bBTB3XnKEKTJixEQQXj2XYXnMmmUQEZkflH+NOT56Vhho3q+yyJ9GBjOb+xCXj5Yr1Rt6rbMcpn5naaqPEjNYUk4LwJKxgxAEXAEPp/GVd3UzBx1fZwZ1ab1Cze2HTklf4VyzNCHP4AVC9QTx0btW5wPSwrM/e0rZD+o2OZJJ9DYl2Y3ZdehahKhrMZjnx6IuYnDaev69CwDSdLvxr0dnRkbaDZSkoIFDgbMjaT9ORymSk9MiBdb95JDWJIU+QEPRXLUMh 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: Mappings which implement writepages should not implement writepage as it can only harm writeback patterns. Signed-off-by: Matthew Wilcox (Oracle) --- fs/f2fs/checkpoint.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index a35595f8d3f5..412282f50cbb 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -381,12 +381,6 @@ static int __f2fs_write_meta_page(struct page *page, return AOP_WRITEPAGE_ACTIVATE; } -static int f2fs_write_meta_page(struct page *page, - struct writeback_control *wbc) -{ - return __f2fs_write_meta_page(page, wbc, FS_META_IO); -} - static int f2fs_write_meta_pages(struct address_space *mapping, struct writeback_control *wbc) { @@ -507,7 +501,6 @@ static bool f2fs_dirty_meta_folio(struct address_space *mapping, } const struct address_space_operations f2fs_meta_aops = { - .writepage = f2fs_write_meta_page, .writepages = f2fs_write_meta_pages, .dirty_folio = f2fs_dirty_meta_folio, .invalidate_folio = f2fs_invalidate_folio, From patchwork Fri Mar 7 13:54:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14006511 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 22E98C28B23 for ; Fri, 7 Mar 2025 13:54:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 46E856B008C; Fri, 7 Mar 2025 08:54:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 41083280001; Fri, 7 Mar 2025 08:54:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2FC136B008C; Fri, 7 Mar 2025 08:54:19 -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 10B1B6B0083 for ; Fri, 7 Mar 2025 08:54:19 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id F2883A8DCF for ; Fri, 7 Mar 2025 13:54:19 +0000 (UTC) X-FDA: 83194899438.18.CF45364 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf04.hostedemail.com (Postfix) with ESMTP id D96A540012 for ; Fri, 7 Mar 2025 13:54:17 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=P+fhR0DJ; dmarc=none; spf=none (imf04.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741355658; a=rsa-sha256; cv=none; b=jiMvJQfA/ZgfikCalVduUkIqb6UCB6IfRIoZXwGCi6NcHCPufh0j6+f8f+ksfzg6Q7ixnt jiWVWms16I7WQQHbj063Tl1EcK0s3OT3SCxTK4CS4Ggh54zaTN1rHFytKXpm1nWeJ/rZx5 OrPvHIvPT1zWA/4Ui2wekmCACuIIR0g= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=P+fhR0DJ; dmarc=none; spf=none (imf04.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741355658; 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=BT6OjbtDCOFHHAijJpjMRbh4BDIQM0uytaFHqbNbas4=; b=a5SRvo3Qyo1Aq/Q5fbDGJfsBWC9gkFm5EhPI4bN7DMBhK8KTBX/3SZ4NtrIoNTwwhDkRte yWo5WDdYZZWaXzK3YNOjcLVdd53UuXIBaKRML7SFnkSBwPX9fQbQwbYHMSMkG6bhidDTqR F6bTFlGPKSqF0px1Qq25cNgskczUSis= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=BT6OjbtDCOFHHAijJpjMRbh4BDIQM0uytaFHqbNbas4=; b=P+fhR0DJRyfUD/uNdzZFl7spFN s9WEWvyhYKjqMt2ZkZIw8P2H8WA9PRUelUHbNbUHUAD74hf7doJwzbkO5RVpwh1XkHE/3eWl4EgAR LByuBb7d7QakRILNQYu2zosdstSG2OVQKc8zyUTjASsG/6/FG2aKG5MZ1QnmEiNzxNlLdogOTcFpU rgdT+FGNEqYgWAyLW+dRtDMkhZXF+9s+H8tMynfWyjchQ7zGjOtAB+i5XJHklJ9mPx1w8iYJ0xBRJ KXvnFMlFbIF1YTpxibbA24zR/zRAq8aVvFNXIby2MHWPnxKh1O0U9YKiSqA0bIUCw55fMQWF4gEki y7yrID1w==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tqY9Y-0000000CXG8-0H5t; Fri, 07 Mar 2025 13:54:16 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 04/11] f2fs: Remove f2fs_write_node_page() Date: Fri, 7 Mar 2025 13:54:04 +0000 Message-ID: <20250307135414.2987755-5-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307135414.2987755-1-willy@infradead.org> References: <20250307135414.2987755-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: D96A540012 X-Stat-Signature: 5iee5guaaruesjp7z4zgbmtiqkiwmdpq X-Rspam-User: X-HE-Tag: 1741355657-580548 X-HE-Meta: U2FsdGVkX19kmLtKDdLhH4y0XIYyQuhfUFv+AXCvdqRTSK+yOPF7A0dZDP7DfXNmWEBRBSrVoq56UkchiJwI0VXusyaHW2JmSx+Vv7l6TlBKdiZL2RfwlDInx98CiCBSrpkzwprd8CSz6q2ujF4jm/gPp+9BfvYGjuF1hio3akuWE9JuqXHezjpWJ/CJVTO44hqEsy4tIVX3v3zsipEHc5bWu0bFuXn6hGzFnggyT1tjrF/5S3ZYHAzzm0p7D9r/oaJtB6xdnpBw+7wLIdZmcs7E14lY6rs7Jw6BAjcdKuVYEHFH9poWqGmup8iubabXiLeNPRbaCjhrYokOtjZAGwWjTO/eT535UYcbhRnvox89dHrpUH0Ba35IcjEXPDEz2LKjvhucLK8J1na0zcY1NAotnnjfFMLs/gTmrd8674uvZLK+mqDIzXrlmdpzcH7pB/K7A4imZcRv0xLKxMxpqioISPlXANcpk/8G4dZYCBfU2RYljuPWYspLqPinsmjeF0Ci6jw5zOwWOZvn/l8bY2V46qB5AqfIGCym0Eu9jt+Wa27aRRV5p1Mm6kV2If4rOGGw2tZkbudEpNZsYBQ7TOTXrY0jWD3sTwo5bHDCwzamDPqZsNakWfYNlOOei679d7rTigjhLCP76ks1w34nzBEsGbynNn9unEj6M3rcOtmdbhykQBF28b08MGAtrFwWSc6dk5eEz8c2lxgtjL54zMU3t+sgSyU3C6cwStIc4qViCpt2Ocy6pa2M+/mXxy88Ttv4XuKjLiirRwYF/Iot3/sRS14v/PBXrEPuOJlLjuZr8KD1ETx5m5z1K4JpL8NrnaIdftmefHTdDUaZ0B2GJKaNuETQ4cNTHThCcD0t/pBm3FI3+XZPFBz55ebexRwLRDy2K8d1wMEKHaYqL3nojgZd5eMXSyCnn8zel3KCt4BVji0d/bLHrNP9X9YaPpVX0R8IJSwuCeU2V8eBcPr 5yBHNToE +zyDnrRqtTdWoBKvi3YAnGll9KI+ALOF7RUe2e89iRQI3mZM4YEkCTz9cReSJdWKrDK/7sbNLCMYHmltaKVZWHzovPtr1zmHwkdQ2f4sngbX3GA1GeTASEFNH2HEWibOyJC246rPgzyHeWg1A2iElVlH9PND4RqLY9Q9CEnCP5HEDMxCWUC/IqyOOzCikhlDASE32mtetYHGtMQ7W5cjAg4dHVNVIp8fNvmbDR7lhMncA5iAaZvwD4mvfO5YCYLBF9ljMworkdDpdnqX2aVrGwXmW1xuNTbHbzXTi 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: Mappings which implement writepages should not implement writepage as it can only harm writeback patterns. Signed-off-by: Matthew Wilcox (Oracle) --- fs/f2fs/node.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 36614a1c2590..b78c1f95bc04 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1784,13 +1784,6 @@ int f2fs_move_node_page(struct page *node_page, int gc_type) return err; } -static int f2fs_write_node_page(struct page *page, - struct writeback_control *wbc) -{ - return __write_node_page(page, false, NULL, wbc, false, - FS_NODE_IO, NULL); -} - int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode, struct writeback_control *wbc, bool atomic, unsigned int *seq_id) @@ -2217,7 +2210,6 @@ static bool f2fs_dirty_node_folio(struct address_space *mapping, * Structure of the f2fs node operations */ const struct address_space_operations f2fs_node_aops = { - .writepage = f2fs_write_node_page, .writepages = f2fs_write_node_pages, .dirty_folio = f2fs_dirty_node_folio, .invalidate_folio = f2fs_invalidate_folio, From patchwork Fri Mar 7 13:54:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14006517 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 0A2D9C19F32 for ; Fri, 7 Mar 2025 13:54:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 738FD6B0092; Fri, 7 Mar 2025 08:54:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A2206B0096; Fri, 7 Mar 2025 08:54:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F8936B0098; Fri, 7 Mar 2025 08:54:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id AE7336B0092 for ; Fri, 7 Mar 2025 08:54:19 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id AC06380B9D for ; Fri, 7 Mar 2025 13:54:20 +0000 (UTC) X-FDA: 83194899480.05.CB87C69 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf01.hostedemail.com (Postfix) with ESMTP id 18A7640005 for ; Fri, 7 Mar 2025 13:54:18 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=AiRyjb9p; spf=none (imf01.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741355659; 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=MofhovjlADQCQPqeYMIVdQLieQlnl0tttbSu0oh4ZYs=; b=urVJQHieoqukaZjjzHqIbfbB4ObbMR/whtsD7FuZU8mkYp/7M+I9nSWHTBGD8ubdfNJuJE h4YKl/O0HI+H1gFj5d/IH0MQw32vDlQVec8dbnlZKVwHMXu/q6MruOH+sUN54cKFn9crkw eInS++IirqsZIKLFW27rBhlIpf7ilBA= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=AiRyjb9p; spf=none (imf01.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741355659; a=rsa-sha256; cv=none; b=K4yhlWfENhFntXTeV6v92TqysMNrzdEDd8nOCw4LfHmIBWSSb37J+FuiKX1AdwFcgtiNcr 1GAOgdsIFILNrPbol9Y6Ni1VHlSsOGt1onE66/UHDsmy8mx7+WrHhYXF2D73ADfrYORv0k 44c0x0I/rHSAH1SXn2jDBC12Gn7BzYk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=MofhovjlADQCQPqeYMIVdQLieQlnl0tttbSu0oh4ZYs=; b=AiRyjb9pnJivKUulf3/TkIqiUa 7bhUXqQ56kgH5be5/6hPtgs3OfvkXoqoxzjwP6dDK1dCxb8eB+fgx4Si+OXoXbWx/4QXbPkcf2f8H Tx5q9E1QnRnNoJzPSNY/L6g0oQta0BR7vhffZTsRhpB93XUAkEOKHR0z5mH+o6gXbRpVJdaWM4Uo9 5UUVoisF5QVZ5H8bexl780zg4hPo3PCV+RPFrP9zQf2Hk34Mi7a9GHfCGByUnfGbeU/WpgTVjsbcW MvndBuaq0WiuOxnS0t0xcPqBydhg6nU8rOrVyZMSsSxwtvudPIMEXontGuVzP4owwFrlrBVWrTH/l x4M1cLcA==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tqY9Y-0000000CXGF-0qyX; Fri, 07 Mar 2025 13:54:16 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 05/11] vboxsf: Convert to writepages Date: Fri, 7 Mar 2025 13:54:05 +0000 Message-ID: <20250307135414.2987755-6-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307135414.2987755-1-willy@infradead.org> References: <20250307135414.2987755-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 18A7640005 X-Stat-Signature: 9q3fneyqnpoh3ee9p6oi5m95orrt7si9 X-HE-Tag: 1741355658-769726 X-HE-Meta: U2FsdGVkX195M/WOJdjxdN3i6XNSn3jet33CtYcyEXKO/5yU2YRR8nvg7HrQdoEVhcgQsMhBuGVIqay7/pxKVExvVTq7KMGeNGkKAFpt5p7WiXLd8dDM61iRKR8xn7MUYdUKjKToieZmMXoHC0HYdYF2QvrHY2VzAvBmn82sSDN9JXAYqSQBoUvqN5QhrWTpwwUT2jJICQ1RUqrtxEMEtu5Fmyg8KbiQFFzwhWiCk3AuZUQUOKe4QhWRuGBpvZ/r009pYlSiMqqj2B6LMv6SctFSZFRwyj8O3ElHHFdE6iIgNiB4tJi+kWp2V9De62enH468Ka9lP/5wCnaRMYDDTNF18OVOIoo7pmnVlrqU92NLOV21JB/JHWWkySkzUQnaqn/1+TH2TNOwrMJZWXRhCGG943c0ueoMVHWrdmi9SBxkwRboCxSyL6uSLT69YG1HIfUl+5KlGXtoSou3UszA/7MPCkQLwtqAAjtz4QF4lz4NTpJLZO9N6wERkvcHXMoCZ3yLjExZPb7C+7oMh7m3exTKk5wykEdrK4/ValFPsFxZOJs5UG4IlFmbWKGGT0JQ2zRcXYmY5PsNMx8GPOttHhmK7AjrJY5XuVLyYinSUj9NqaQzCI9NjkD4zKQzEFUIMaF7BeRQMnVkCGU2rXx61Y00z/0Uh11bFinbvTjB78vL94ynUBXLrl3POQv2ZfJOOWMhjiErwe6JZsOehGbSEBdPL783fAsX31GMXdwpTAeTj3HRv3aZJn1nLZqWml3PxShEP14MyKE+tJjl2WFwf3DcPTXTCpT35BMtxrk8mXzbNLlmOofC3TI76WJ6P0IZtQr1zQKeCSTXqoE+6jvFaAEwOWS5DUEvD2OBi5ZFYtaokJx6iLbBwRppJ1r7V16FvsF7Prgxcy3UgnRI+ZzuFnd2cY0dkO6XSrnC/9MaZw1BmkF5qJK/C+WecZtM0X8tMqCiJhN0y48vYVJezRp GnNgDVYc yotRmIgug+fe1eItW0X7retHEKA/muKEwqhPzDHXIhqa7YylWjUsHu6RcdbukSKSkLb73wu/4hxgGsF9DbzW7n0AldDUl/sJ5yDzUzVlE3QA73iv57iHmYsTxSEP/bUtJydZNakITJfaqzE1XL6ORSzyMYPxd3DAD9yGMZAs+8R1jMQr/19an1/uOB4KRO8asA8gMXn6/dALFvVdpWq0KDDwOjMSiy/A6nYam7qSDmUBSbYU= 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: If we add a migrate_folio operation, we can convert the writepage operation to writepages. Further, this lets us optimise by using the same write handle for multiple folios. The large folio support here is illusory; we would need to kmap each page in turn for proper support. But we do remove a few hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/vboxsf/file.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/fs/vboxsf/file.c b/fs/vboxsf/file.c index b780deb81b02..b492794f8e9a 100644 --- a/fs/vboxsf/file.c +++ b/fs/vboxsf/file.c @@ -262,40 +262,42 @@ static struct vboxsf_handle *vboxsf_get_write_handle(struct vboxsf_inode *sf_i) return sf_handle; } -static int vboxsf_writepage(struct page *page, struct writeback_control *wbc) +static int vboxsf_writepages(struct address_space *mapping, + struct writeback_control *wbc) { - struct inode *inode = page->mapping->host; + struct inode *inode = mapping->host; + struct folio *folio = NULL; struct vboxsf_inode *sf_i = VBOXSF_I(inode); struct vboxsf_handle *sf_handle; - loff_t off = page_offset(page); loff_t size = i_size_read(inode); - u32 nwrite = PAGE_SIZE; - u8 *buf; - int err; - - if (off + PAGE_SIZE > size) - nwrite = size & ~PAGE_MASK; + int error; sf_handle = vboxsf_get_write_handle(sf_i); if (!sf_handle) return -EBADF; - buf = kmap(page); - err = vboxsf_write(sf_handle->root, sf_handle->handle, - off, &nwrite, buf); - kunmap(page); + while ((folio = writeback_iter(mapping, wbc, folio, &error))) { + loff_t off = folio_pos(folio); + u32 nwrite = folio_size(folio); + u8 *buf; - kref_put(&sf_handle->refcount, vboxsf_handle_release); + if (nwrite > size - off) + nwrite = size - off; - if (err == 0) { - /* mtime changed */ - sf_i->force_restat = 1; - } else { - ClearPageUptodate(page); + buf = kmap_local_folio(folio, 0); + error = vboxsf_write(sf_handle->root, sf_handle->handle, + off, &nwrite, buf); + kunmap_local(buf); + + folio_unlock(folio); } - unlock_page(page); - return err; + kref_put(&sf_handle->refcount, vboxsf_handle_release); + + /* mtime changed */ + if (error == 0) + sf_i->force_restat = 1; + return error; } static int vboxsf_write_end(struct file *file, struct address_space *mapping, @@ -347,10 +349,11 @@ static int vboxsf_write_end(struct file *file, struct address_space *mapping, */ const struct address_space_operations vboxsf_reg_aops = { .read_folio = vboxsf_read_folio, - .writepage = vboxsf_writepage, + .writepages = vboxsf_writepages, .dirty_folio = filemap_dirty_folio, .write_begin = simple_write_begin, .write_end = vboxsf_write_end, + .migrate_folio = filemap_migrate_folio, }; static const char *vboxsf_get_link(struct dentry *dentry, struct inode *inode, From patchwork Fri Mar 7 13:54:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14006514 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 EAEA0C28B27 for ; Fri, 7 Mar 2025 13:54:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA1C06B0089; Fri, 7 Mar 2025 08:54:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C8ACA280001; Fri, 7 Mar 2025 08:54:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A2DD6B0083; Fri, 7 Mar 2025 08:54:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2BC7B6B008A for ; Fri, 7 Mar 2025 08:54:19 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1C4D1B5553 for ; Fri, 7 Mar 2025 13:54:20 +0000 (UTC) X-FDA: 83194899480.06.4F5AA5F Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id D61FE4000B for ; Fri, 7 Mar 2025 13:54:17 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="NXceUjf/"; spf=none (imf27.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741355658; 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=mvaOn1iNfnHJjc4gSgVD8D2wLxi5A95q8CNsEb5mKOk=; b=24g0mFPhKh8rEhv5rk5enKGIi6elcTB1XiVJGnyHR6WfE6qOMhqXV2UUU3ep/mBRBM/OfN EPLbkIjXfr3sVfaFnzl2OaVLsdUgFtyWdrzXZRbCSup7wNLA3zp69zQ2t5Gw5GM+zhnhJX Au1bdJ9uFJbZu7cJ0t3mhPPi8xyLuSg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="NXceUjf/"; spf=none (imf27.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741355658; a=rsa-sha256; cv=none; b=uBs+Q7qw60jNBzH0fhzz42mjsTOo2wZKZVcl0VdJ4pAbi4zKk2ZlDAuEVnJLzGlJwIoOp0 k0+qxCtxywbrDfAo9SGcnUqaGEvOVQDc1DEuMF+C7j+p62RUckCF9WkpLpkh+9r9gquhOQ PTD4z8yail9aAs7VnPrwDbNAyQnsdqQ= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=mvaOn1iNfnHJjc4gSgVD8D2wLxi5A95q8CNsEb5mKOk=; b=NXceUjf/rN/nE14KGNhSPpVAVh KHf0pdp8XBGLyZVSxh21bmLjKks7mhrikiMkVY1Slftde2kxARF1sJEHTLzOrFGSlukw5i9KQ704K HpJO7LPaZK2IlUHtYN/tQhAJgrAyzc+WxQUajwcgShyq/1aIaCEAJfTAuV7yD4h+h7z+78IzYmkts iIs9QJxhHbfpeAiB7XWLbzfH09Dci81NPYhBAXhqSO0epSfc6DyK+OEyVmuTyMkQAG9MIm2+gXgfC tVBM5KM5M5hTdxnpnhCqQe7XILBlgcx5L1oqVTA5k1Lytpp0twq+bYWonIYYS3fA09Dv730/UJId5 QK1+O/Ig==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tqY9Y-0000000CXGM-1NhP; Fri, 07 Mar 2025 13:54:16 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 06/11] migrate: Remove call to ->writepage Date: Fri, 7 Mar 2025 13:54:06 +0000 Message-ID: <20250307135414.2987755-7-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307135414.2987755-1-willy@infradead.org> References: <20250307135414.2987755-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: D61FE4000B X-Rspamd-Server: rspam09 X-Stat-Signature: nsr5wy9e1bbotj5ztgtq7i9dyr44wcgi X-HE-Tag: 1741355657-961410 X-HE-Meta: U2FsdGVkX18BZofr5Hbxz5gM8vIDEpOCi9n673VSfmLOalMQ5pvJA+fUQP7OI+SCaTRHaNgVFGFHI1xM/nk1CHgE9EZU5MlO8LSwB1IBMQ0Li2kA4YPlTm3wfO4XPmgwCle6sFC97Wl5ShKfdoeP8Ay5kltjuh1wq7Dgr3b930ahGhK9q5dgrrtHAT4HcdUSKj4t2o4D/q0/3Lsqw0dR5kjy5k79PiQCUTHNx0gkxlkY2seraGtgIFNjy65ZCUr+y6cTmX2U8tavUvJn6kI/6kqzqJn7oH0K8rykXCLhifI72fGSlxqWR0EdngCpF0v+9VfIYuN2qt/lHk00jPLgGk3Mzh2Q6/GFEGl1OOXq5KphhPqQqTc8/Ea8WcoCL17I24BUC1APgD3ZMkVi+CG1QiZCeMPkSvwbJwCGeSEPBBDYogoQhTmWDDRwV8WqSZl2FBVZUUv/8RpF70NFmOANWAY5q7C766LKKeGxW9/AtCBqjOgV6vkcK90oxF8vi0KPyqSvUCSmZWodDI76rRuocl2L6HVyDRAfyg/6vTyb9mhFE4V7EEqSqOWr4BzPCajE96ow3FGBTq0DaAPhW1WSGRpCmkL46ptpaJl14V+xM1DzGIprQfL6owcVC9w3STUx9Aw9t6XAQF5URNm4vPoWfcVYBESQWugVEobzjRuekUv9dG50f55faS6KalE7oMN33TcsEsP4RTYBoRnVkIKZQP5WF/UkRIk6rSUJTenDvF2Gd9Qq9Jtr9No89qZT81heG/F9aSvBEpeUGzKSLMpZ3G9NpkAeRAzXYG4AHHVMpj0ZeYLxhT6WKyiaLb7o/XhSvJ/xq9nx0bnH1kZ1myEFTu//x+yCmnY2/9rvuWXel8V9xRX0bvoBT2JrZ0SeRZUltL73gMjRH7J9dtO24g4IIiC3Klr7YXy2O1S12qk08rZWAzQRj0MVA9/+2glmJS1FuR3TqJAy1kxGWWmCFYl sn5FL0fT MD3gSfoOPmfUPKlJ4co/YLxSsjZG6Ncq3GfQAgZs26OpiP7Wt3fOrmVCPYF0ikxpGtlRDPygPPkd5Odl3eVOjrL1kJlDcdAyUgy6sWcnRmU/cz6jnjifD8AfSfNivUyPdsb1aSqFY2VJZYdH0I1AEgH7vhr9O9dUgIUV5tFm8liGlU0odalPgb0DvhnzDYBwdBpmoUDdyoYwt2ZB+49hV8CvfRk4j5dbWls5rhNch0SOLbvo= 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: The writepage callback is going away; filesystems must implement migrate_folio or else dirty folios will not be migratable. Signed-off-by: Matthew Wilcox (Oracle) --- mm/migrate.c | 57 ++++------------------------------------------------ 1 file changed, 4 insertions(+), 53 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index c0adea67cd62..3d1d9d49fb8e 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -944,67 +944,18 @@ int filemap_migrate_folio(struct address_space *mapping, } EXPORT_SYMBOL_GPL(filemap_migrate_folio); -/* - * Writeback a folio to clean the dirty state - */ -static int writeout(struct address_space *mapping, struct folio *folio) -{ - struct writeback_control wbc = { - .sync_mode = WB_SYNC_NONE, - .nr_to_write = 1, - .range_start = 0, - .range_end = LLONG_MAX, - .for_reclaim = 1 - }; - int rc; - - if (!mapping->a_ops->writepage) - /* No write method for the address space */ - return -EINVAL; - - if (!folio_clear_dirty_for_io(folio)) - /* Someone else already triggered a write */ - return -EAGAIN; - - /* - * A dirty folio may imply that the underlying filesystem has - * the folio on some queue. So the folio must be clean for - * migration. Writeout may mean we lose the lock and the - * folio state is no longer what we checked for earlier. - * At this point we know that the migration attempt cannot - * be successful. - */ - remove_migration_ptes(folio, folio, 0); - - rc = mapping->a_ops->writepage(&folio->page, &wbc); - - if (rc != AOP_WRITEPAGE_ACTIVATE) - /* unlocked. Relock */ - folio_lock(folio); - - return (rc < 0) ? -EIO : -EAGAIN; -} - /* * Default handling if a filesystem does not provide a migration function. */ static int fallback_migrate_folio(struct address_space *mapping, struct folio *dst, struct folio *src, enum migrate_mode mode) { - if (folio_test_dirty(src)) { - /* Only writeback folios in full synchronous migration */ - switch (mode) { - case MIGRATE_SYNC: - break; - default: - return -EBUSY; - } - return writeout(mapping, src); - } + if (folio_test_dirty(src)) + return -EBUSY; /* - * Buffers may be managed in a filesystem specific way. - * We must have no buffers or drop them. + * Filesystem may have private data at folio->private that we + * can't migrate automatically. */ if (!filemap_release_folio(src, GFP_KERNEL)) return mode == MIGRATE_SYNC ? -EAGAIN : -EBUSY; From patchwork Fri Mar 7 13:54:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14006519 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 C80E9C19F32 for ; Fri, 7 Mar 2025 13:54:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C151A6B0083; Fri, 7 Mar 2025 08:54:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 944866B0099; Fri, 7 Mar 2025 08:54:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A89B280001; Fri, 7 Mar 2025 08:54:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D27C26B0083 for ; Fri, 7 Mar 2025 08:54:19 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C701155D51 for ; Fri, 7 Mar 2025 13:54:20 +0000 (UTC) X-FDA: 83194899480.22.23A8A08 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf11.hostedemail.com (Postfix) with ESMTP id 38C3D40012 for ; Fri, 7 Mar 2025 13:54:18 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="XZn6/qRR"; dmarc=none; spf=none (imf11.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741355659; 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=/z5i0Mk9Cv2/sY4L3FZ7BIchCOXs9aYcNdg4XHBiico=; b=G/AuxUnKzJXjoveT383b9Lop5mMBkIdVBea8y8EoAgSW9UsLKmUF50UQ9qk6vsCpvJyeUf CFGcLDz2FioHrPkci8BUG/E+th1Xsk9qcgfJUSvXj8cw/Qew9e/w3kB1ijAgaTabyljkdo Qzt8xvEZ+lDHoqQGa7gUPuWayUurh2k= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="XZn6/qRR"; dmarc=none; spf=none (imf11.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741355659; a=rsa-sha256; cv=none; b=og5X8fOvkByoxPfqWLKLlpZk/eUKhz7Iy2+8iTXB4ZT2BNt80BaemtSxuBmlgPMnfnpGoC btf77dkz8lCojwYntp8Y09h8MOpl79+q2S1IH7cJJmzWD+td8CpgWQ7edpJQN7kelLB1YM fvvPvGpotOK4aEcQv6w6jvDKjtilrV0= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=/z5i0Mk9Cv2/sY4L3FZ7BIchCOXs9aYcNdg4XHBiico=; b=XZn6/qRRlZuA8W/65iLtP+DmJA 0a6R3g2imvgF9NFcjTV1wjItQb+Gm+iOmA3lKwb4uzXzpnGk1s+xHDW1io4ZlfX02BHlNf6G97ThN u2X2fj2Fs/PyNipIEfklLIt1qS6Yvysi39dBIgGZs19uBqdkje0otPp8X6WgmP4CQcUcfk3S/55aI T69BjppGgpcnsa2I1E5z1bACCLuqc1dYu/JT0Ao97YkukJGpxyiE6WN8iCl0IVdAD/ikqUSAgUX6q JHN4JQhhgTuWrUFBmcQinFwhgbp7J+0zmTpBe8abLU2VrxruKpPU3fThzjwCY8FxIcJckOvoQy44X nq+E4ZlA==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tqY9Y-0000000CXGT-1pj8; Fri, 07 Mar 2025 13:54:16 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 07/11] writeback: Remove writeback_use_writepage() Date: Fri, 7 Mar 2025 13:54:07 +0000 Message-ID: <20250307135414.2987755-8-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307135414.2987755-1-willy@infradead.org> References: <20250307135414.2987755-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 38C3D40012 X-Rspam-User: X-Stat-Signature: yn4hqe5yrxd6fhp8xra5wgnwu86dms3r X-HE-Tag: 1741355658-805223 X-HE-Meta: U2FsdGVkX18mTtPsgA1xurxREvOHBXKZZ+H0hK5t6cu+bwzYbBzc2eVHRr9blCPJNejOYcZdZafeLGdzMjyDp7qyy6FxWRlhYiR6tPCIKEj1jVsdT3J+RmZQWDi9t7gzTrWtna8lW+7IwEsKFqRk6N7g/la7ViJX76qPhi+s5x3lvmu5+xdXfinNpmER1LnDoxzA+t5CeXoHcAqCYBSVBefncemJ+Iyy5pOhbyHcbvwtoh7QhXI8c6rEabZGqdqdiM3aiwRAcAHc8oFcf0vI3tIS1C6wcR9rG5OLxN77dhfh8oVAJ5+PRdS7jvAZp0yJwyMgKOkv3Yr1S/qCy0zL5tCPNmc72SViG19Ll3MoCaLXonrhCRVZxYWUd1urYZyKt/bGT3Q9GXk4+gtwHqrRp1k+lEsLCWHuY/ES3g+J9MmoA8nJOWu+E5kr5QBJpe8cAb28yb1FmMCJFzwtcvC/VTjef1wj6UyB6HNwhZ0Do/ZxJIK07dUq12e9JDipknjzuMCOJADd4SzEtkK9Y8ftrhQj2mhapnp+THg6w3GdA7p29tnOfW2DcXhYonSHRahjeWPkNNrbbu/Aq6uH1C+dy+RjT0pBtWzsWKxj1B78bzvK7VEMYhsZyz2PEFGQb4sGa24DLKY4PhMxyICzRvkIFsUinrn/ccdIPA25R6i4JLTEhbCAZaIPqkgUcJQy/IYgVnkYyQ5gF4kw8fzNS11BGMpvPP+1d+23rhJg7dqPQKo1ML5ycPtkbz3lLA9TuoIRxyr59JyPvIlbDK9zKmBJK3rkBPERvVPaby+BRl4aN44HaGEbnWcG4xXek0vM1KYFJjHidL/50qMZoYdGh0NV6ql+F9JIyUMKJB2HeEJYX6Y7rjTexrRM6N5ik3LX5Oh8PEwLhp7Mq/oswBI9p4JTPSIdtRPvEcdb1x4EJKqLGk2XPIuYTdmllgmLsbUz8EZxtYADG8rfN/g8td++72h i4wApBYf aI06WBSW5xkx4N81dFDiQwUROX3Fnr0lv3tzOh0e0B4Iz6rxdwk9ZXWTkM+ciYWdFZKZXjM9vIviX0JAFnBOBhSodjnMkP6kgHoeRhZslEa9Qq4ROxrxvYHGSHv+i5CaZhqRSZJAsE4qghABwJwLlObTNB1E4NmTDELrK65R1CoCmw8FzWpkKgvl4glCk0U2SS5D0w6WSpJ6bLrq+HlBGAbgIWriywmzLQhlgXJEOQLxt/Ukr9e7h3i7YABy5+EfRJDgzlUHjBha64/UeI1MlyTtHl+IUYQlFInxL 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: The ->writepage operation is going away. Remove this alternative to calling ->writepages. Signed-off-by: Matthew Wilcox (Oracle) --- mm/page-writeback.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 18456ddd463b..3cf7ae45be58 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2621,27 +2621,6 @@ int write_cache_pages(struct address_space *mapping, } EXPORT_SYMBOL(write_cache_pages); -static int writeback_use_writepage(struct address_space *mapping, - struct writeback_control *wbc) -{ - struct folio *folio = NULL; - struct blk_plug plug; - int err; - - blk_start_plug(&plug); - while ((folio = writeback_iter(mapping, wbc, folio, &err))) { - err = mapping->a_ops->writepage(&folio->page, wbc); - if (err == AOP_WRITEPAGE_ACTIVATE) { - folio_unlock(folio); - err = 0; - } - mapping_set_error(mapping, err); - } - blk_finish_plug(&plug); - - return err; -} - int do_writepages(struct address_space *mapping, struct writeback_control *wbc) { int ret; @@ -2652,14 +2631,11 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc) wb = inode_to_wb_wbc(mapping->host, wbc); wb_bandwidth_estimate_start(wb); while (1) { - if (mapping->a_ops->writepages) { + if (mapping->a_ops->writepages) ret = mapping->a_ops->writepages(mapping, wbc); - } else if (mapping->a_ops->writepage) { - ret = writeback_use_writepage(mapping, wbc); - } else { + else /* deal with chardevs and other special files */ ret = 0; - } if (ret != -ENOMEM || wbc->sync_mode != WB_SYNC_ALL) break; From patchwork Fri Mar 7 13:54:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14006513 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 8DD13C28B23 for ; Fri, 7 Mar 2025 13:54:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A96476B008A; Fri, 7 Mar 2025 08:54:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 986D66B0095; Fri, 7 Mar 2025 08:54:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6074D280002; Fri, 7 Mar 2025 08:54:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 25E086B0088 for ; Fri, 7 Mar 2025 08:54:19 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 18AE580B9D for ; Fri, 7 Mar 2025 13:54:20 +0000 (UTC) X-FDA: 83194899480.12.F523EA9 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf06.hostedemail.com (Postfix) with ESMTP id D988718000B for ; Fri, 7 Mar 2025 13:54:17 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=X62+uKJW; dmarc=none; spf=none (imf06.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741355658; 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=TkS8MMSXr1V47Aygjy0xD3fBh6jvlfrlC7n0css79m8=; b=XIispXeY64/3kPp5if6gQCFlEoB5nmk/x1Mvq6kAFws1MYTww92belLzqQdVvBvRo9ns+T xmO0UG2sbL9xs/IwG8pe8U45X1eGD3X5kcYa4ou0zBhCE1Aj1w04SayD29d1wq10E7RNoE sb0x1qBpdL/cSDRfP1vALqyXpF5FCbU= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=X62+uKJW; dmarc=none; spf=none (imf06.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741355658; a=rsa-sha256; cv=none; b=Ts8PPZGW9pZpIYvdzQ7MvVNs/oVyA408tu25oLBwGUPUB2Oox4wUsgWqWHSqlDClOU1Biw pi3XFl8eOWAgiXWQqYSH+jw5kk8PcsWwpiaoOtCkw7fHXjdznQQFX2wI9RHb8NuOT+csOK mauCSoA/6e/PhoyI5zzx/FIgH8Mjw50= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=TkS8MMSXr1V47Aygjy0xD3fBh6jvlfrlC7n0css79m8=; b=X62+uKJW5uRc3AljrZOB8IJcR5 FcWRKLLJWmGSKzfnl4nxJjjgjv9O1gFQr2Szy9TLcBuGwadTSn34XR9hOcZkcZB41Pi+9vltTSGsj I5/5wHK5D1RaK79iQCgyfbAFpEJuEk5yD2wnvMggodf32rYwV4qgFknQP1XxeJieUk5Dffkwer1v0 P1PMhVwX0aSgYrj9gT+Fdm8zYV1k4WH7jzshbgcNhuIWt3B2Qu/RHhF1rKuIRU4FoMfpkyTN43Cmm kXhVONT5gXXOwk7DWD7OpEqI5fKlE2Ht6lIInk/kTeTe6+SDyXkE3Lxa5g5W15n2omOLZ1ep3SK1d bhjLPAUw==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tqY9Y-0000000CXGa-2Mrx; Fri, 07 Mar 2025 13:54:16 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 08/11] shmem: Add shmem_writeout() Date: Fri, 7 Mar 2025 13:54:08 +0000 Message-ID: <20250307135414.2987755-9-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307135414.2987755-1-willy@infradead.org> References: <20250307135414.2987755-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D988718000B X-Rspam-User: X-Stat-Signature: o5qf3odrw73c5ddwnjdbainhx4n4zfcp X-HE-Tag: 1741355657-533869 X-HE-Meta: U2FsdGVkX19VCr9ZVHh2mQ2egBxwElTKCwiT3fEcvj1pgZpt7yqLzGJ44nMXHzg8kPlhyARi97yqtgy9O23CtQGqcqneAintN19hTjsQfZGQRmUro/zgrCO+OKTXldaHDfShO6dkaLCbLieWALSOfComVHVn+tRioEWQgvm3M37ZtsxV4xaNUWu/klzLGAictCeb+k3sA2fkyfMyABSU/1V2MG/Q8TE80VGJw/8MBKb4n9U8KeJ0+/7o6RCqga8OvEw/7FNLDQoBNn3kwb3AuSTxU6FS6RBi6j6dkE3ShpQ+0FVXJf7jZPiDfJqtTmFLUtzskHYTHjm6hwDXyQyzAbAh1yg5J/6hoZDgUaRcu9sHCnyrZHjXJpMgjZEueZMU95ajXiPfxHO5/OC4k/PWlRdWz23X46rE8WwzT4E9XHHg7bHJwasuYcWISrinZZRfJUUVYHH+wup2LFsIcISvamNTbCtc58pKThCcBPg4H6vsYuD1wzw6R88HXVn8NZgQP5N4pGgL6azw9tQ81COvONPe0fLDiZ0gA8KDlwJKL4kDu/PCUzwSBrh64L8/gcvwa8Y0Muz1H35HHt3ClNQm3vVePu2K14pJyV/K0jHJT7/lVGCatjFXQNuGeoOTir2zYr3c1IQ9HP64WFPDfmP/uPasxB5Rqzqzhlnh0k5UjniKBpHahVZqRa9vRfSmaQC5ru+OwT3NZ45bkjXP2KvJBcPrlbA2lX4MHYu5CmVBkUANXwjBPn1rmZ/SjSAT6FVDhDdBh/v6ROBmYAZFqmSq1Yu/LUip+WqB/kKoF45esfxkQqxp7p7i+LL3cwSLE+/iyDZP2fJb4tsyDmBl6m+iqZpJhFNIFMnmLhMrW+l8jtH66JSQA1aUbGJpVU3Vn9ExtSrmhV/X4ykIjY3C8XD6gm5DtvN1KToumslsMGmbYAprdZEX9RE9SObrnKcDUMgLxgC0Z1SnXsS0YUMIQwD ae0m57Ko 7OaOupQz4IH+Wubr9Tx0HSu96hTyPwxvw4O50R+WTpGTnx+ug0SG8Lhbngpvfg+kS7cELpk1gMgIil+aQ+7IWe4g2DQciSXW74LdcULI1UoCJPfJVjH9Eqn8WXbLGttpf27vxi/1r87lJTatoXI7X7yN6EygendDdEnlq8ROoZo9K/mCzUHU4SAQhfzMQcoC2YqTGgI6z3ys9IoXO/ejSlr/4M2tHysth5YpkJW3TgN4/IdDjWp2BwgGJO8V5uIhB5+AdIOX/142OF3UCqJQr6XooV+Rg3tfxUYVG 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: This will be the replacement for shmem_writepage(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Baolin Wang --- include/linux/shmem_fs.h | 7 ++++--- mm/shmem.c | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 0b273a7b9f01..5f03a39a26f7 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -104,10 +104,11 @@ static inline bool shmem_mapping(struct address_space *mapping) return false; } #endif /* CONFIG_SHMEM */ -extern void shmem_unlock_mapping(struct address_space *mapping); -extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, +void shmem_unlock_mapping(struct address_space *mapping); +struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, pgoff_t index, gfp_t gfp_mask); -extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end); +int shmem_writeout(struct folio *folio, struct writeback_control *wbc); +void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end); int shmem_unuse(unsigned int type); #ifdef CONFIG_TRANSPARENT_HUGEPAGE diff --git a/mm/shmem.c b/mm/shmem.c index ba162e991285..427b7f70fffb 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1536,12 +1536,20 @@ int shmem_unuse(unsigned int type) return error; } -/* - * Move the page from the page cache to the swap cache. - */ static int shmem_writepage(struct page *page, struct writeback_control *wbc) { - struct folio *folio = page_folio(page); + return shmem_writeout(page_folio(page), wbc); +} + +/** + * shmem_writeout - Write the folio to swap + * @folio: The folio to write + * @wbc: How writeback is to be done + * + * Move the folio from the page cache to the swap cache. + */ +int shmem_writeout(struct folio *folio, struct writeback_control *wbc) +{ struct address_space *mapping = folio->mapping; struct inode *inode = mapping->host; struct shmem_inode_info *info = SHMEM_I(inode); @@ -1586,9 +1594,8 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc) try_split: /* Ensure the subpages are still dirty */ folio_test_set_dirty(folio); - if (split_huge_page_to_list_to_order(page, wbc->list, 0)) + if (split_folio_to_list(folio, wbc->list)) goto redirty; - folio = page_folio(page); folio_clear_dirty(folio); } @@ -1660,6 +1667,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc) folio_unlock(folio); return 0; } +EXPORT_SYMBOL_GPL(shmem_writeout); #if defined(CONFIG_NUMA) && defined(CONFIG_TMPFS) static void shmem_show_mpol(struct seq_file *seq, struct mempolicy *mpol) From patchwork Fri Mar 7 13:54:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14006521 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 85B09C19F32 for ; Fri, 7 Mar 2025 13:54:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1BAE86B0096; Fri, 7 Mar 2025 08:54:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E16FD6B009C; Fri, 7 Mar 2025 08:54:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A64C6B0088; Fri, 7 Mar 2025 08:54:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5041E280002 for ; Fri, 7 Mar 2025 08:54:20 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4FA6E80B9D for ; Fri, 7 Mar 2025 13:54:21 +0000 (UTC) X-FDA: 83194899522.26.00FC409 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf28.hostedemail.com (Postfix) with ESMTP id 8B4FEC000B for ; Fri, 7 Mar 2025 13:54:19 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bCVkhALH; spf=none (imf28.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741355659; 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=HxorfBgE1Uv1byaGENr7pDp1WuWnctNAqk3G3c3CU84=; b=ZZ+RMrt/rErPxLA7KMQtbObD7MIE8Gw8wwZbo1tY/gHTwpkiP+LTnnqIqedXRrTAi6gu3m +u7su0lFF34BpRbDioGUlE6UinPw3ld7MnHLc8eyETAyu807bjNqlKtI51F6P3NasBR56a iOQJcrz74gr0vjfiFlHqPVlhhUU9lz8= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bCVkhALH; spf=none (imf28.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741355659; a=rsa-sha256; cv=none; b=V16w0g7KCz+NQXKxnLCYDFEvaQ4LS5+wiMzOiwpEh9JBBfWkRE8d92OiZxjcnfABKJVqC0 mmxp42QZCgwVm10LgGTB2aqXOzzBg8o2TCrqONnXIz2eBFZV0RYiIGsMzmFrO8H9aXOEjf YqvdglawGRcoGJ89ix9KZ5JuqYp6Fjg= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=HxorfBgE1Uv1byaGENr7pDp1WuWnctNAqk3G3c3CU84=; b=bCVkhALHyYVYY1ZRHBnGCe1QqL 8t9wy2R3quPKYY4KBJyKMDggEYqBMvyCoNB8ICvghWixxhaz2jHMV6kVsIBsS+bOqoviiM8jrxF93 KK7250g/MVmbkejykejPIZUR7m1LWlifvA2DGHN9yI6tQfjMfPBUXmF/5ACR0oDEtKoUqUhDtY5EP qLR1PHgla+HM0OaedXb5zEhjTMpfsPsUkAk/EYR0zSWDnyo9UaJNpVmVJeHbpksEvmq8VwlSllVEm FPc66REQWUxZNFcxxaKY7WUBtHPkb9W77w4/IYg+4Xb6ET1gl7Tnsyb1P0/KRqSHbLzl4c8QG/TFQ dVrqbC0A==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tqY9Y-0000000CXGh-2pLo; Fri, 07 Mar 2025 13:54:16 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 09/11] i915: Use writeback_iter() Date: Fri, 7 Mar 2025 13:54:09 +0000 Message-ID: <20250307135414.2987755-10-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307135414.2987755-1-willy@infradead.org> References: <20250307135414.2987755-1-willy@infradead.org> MIME-Version: 1.0 X-Stat-Signature: ehbqtcpjwep3o7jfxfzcr4uwmoomia63 X-Rspamd-Queue-Id: 8B4FEC000B X-Rspamd-Server: rspam06 X-Rspam-User: X-HE-Tag: 1741355659-237564 X-HE-Meta: U2FsdGVkX195yexYD6U1rytb1QT2zGenkbL7PnkyNf6kjQqxD/sRhj2diEebjHcauUMvoS6i5XIlb+Xypvd/IjvBAvcqdSmv1E3MQGiqeYNt8GBA37ZFjL6Rkvxnuc21zB5RBeZ8dK6YBGhnFR0L+6fWCoU7Zoh7H4DvNpc2IRR7b5ebzG9xKVH+bVxXVbyJ3S3CcG8f8AmJ0cup7dEcFQLXjJIkV3iB6LOXblwnupAlXJt1q4iWBrKPxqh42APOxvVs355wPfmHxOU/v22wxkzeG7ZiAiWbC8sD54HPEu4siBZBymXG0L2zJP3f5F1Eb0gPh3oYyfIkVa94P1dMTFNxDs1JkMDBZ6x4luOX1u9dEuUuV5/CLXpSni5RxS7H6JJJSSyLC4FDDxSE3ApfvU10E+GQUTKLRzEZelLi0LuTldWw07Eg1sz0gE7KEqrInRcLLPDNrWIap4kpriLa+2jk9BCvjTssJkKeJOzBOIBPHiwnzdnlFf/JQsOIro8VJQOjvX90GyKRiwjRCpWZUB+r3zW2s7RWwAqoei3pXT9C/HaA8+nTutLVQ9nkJaSCpVUBzkH5oHlIqZxDdXZGcdz+d3LSV6yTjafuTkl6I8F9bFgia7sUOqwXh6DCqYDGe6UWLASfxdtYogHVasI/eSnjbW3uxaAa5wltG3815WFr+YPRzNQfU+qlGVca23/nKkiVMC7Zu6a6MzeZ+cc0GyvyJWRcMZn8x+2YxBWh97WqRHenl4F+Yp5HYm4jXprhrzQStgAvE9bXjaH2mbWl0V2sIiNv5YybGZpaUGm1Hv595dTZWpytzpdtEMJna4vRuMXbutSf5eZ6lrf55uNMEfa96U4tfYJbHO3Uc8rr819KTDBH+B7UkcZOJk1kjcGgCSmcqFIglX97P/HS9zYVP2P383SHiK/0A5Q6iv+gpEmtWWSK9T9DQFHdtOH/CGcMc8oRQdGgnzIHyxg8tkD S0DJBwhZ TQaN/T/rPD7Tx1vzYuifdfHYGmLThN/AB2obBpzrrnmjjp6Ss1PVypqD31UK/DA5uHWnMH2/MLOmxNyHtjcvPsUKH9wqPUUjE/Ivl+cXTSe8iJCAtyBy0O5HqajswwV6r63lhs7ovuiTOvKqscA8JxmB4QzwV9qtGxYj6Y0Upq6PH3nx8owqHDs0lWOUz8MK4hzTJXNZDwn7rQS7zGwLsTn6BOuKFFaMgWn9fgHtfwaNl/GPmsAJc58ErhBcMvZKu5d2H9kjs2t/z8wwLDwAWi+FYpJbo16FAYM6w 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: Convert from an inefficient loop to the standard writeback iterator. Signed-off-by: Matthew Wilcox (Oracle) --- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 32 ++++++----------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c index ae3343c81a64..5e784db9f315 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c @@ -305,36 +305,20 @@ void __shmem_writeback(size_t size, struct address_space *mapping) .range_end = LLONG_MAX, .for_reclaim = 1, }; - unsigned long i; + struct folio *folio = NULL; + int error = 0; /* * Leave mmapings intact (GTT will have been revoked on unbinding, - * leaving only CPU mmapings around) and add those pages to the LRU + * leaving only CPU mmapings around) and add those folios to the LRU * instead of invoking writeback so they are aged and paged out * as normal. */ - - /* Begin writeback on each dirty page */ - for (i = 0; i < size >> PAGE_SHIFT; i++) { - struct page *page; - - page = find_lock_page(mapping, i); - if (!page) - continue; - - if (!page_mapped(page) && clear_page_dirty_for_io(page)) { - int ret; - - SetPageReclaim(page); - ret = mapping->a_ops->writepage(page, &wbc); - if (!PageWriteback(page)) - ClearPageReclaim(page); - if (!ret) - goto put; - } - unlock_page(page); -put: - put_page(page); + while ((folio = writeback_iter(mapping, &wbc, folio, &error))) { + if (folio_mapped(folio)) + folio_redirty_for_writepage(&wbc, folio); + else + error = shmem_writeout(folio, &wbc); } } From patchwork Fri Mar 7 13:54:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14006516 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 B9C7CC282DE for ; Fri, 7 Mar 2025 13:54:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5241C280003; Fri, 7 Mar 2025 08:54:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 194BC6B0092; Fri, 7 Mar 2025 08:54:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3C8D280002; Fri, 7 Mar 2025 08:54:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 85B856B0088 for ; Fri, 7 Mar 2025 08:54:19 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 26351A8D29 for ; Fri, 7 Mar 2025 13:54:20 +0000 (UTC) X-FDA: 83194899480.02.9DC6DC4 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf09.hostedemail.com (Postfix) with ESMTP id 6F0C814000D for ; Fri, 7 Mar 2025 13:54:18 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bKfpkTCm; dmarc=none; spf=none (imf09.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741355658; 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=MCnjYQ2acBJQekNMxLqjVlaD6rzjLtTKGq0ILj29RFk=; b=uI6xJTrPulkJZGgWB8t7N8pema/cOoA/oo885zFqVClbJMxgkRT9TNl55HVkBQC5/b7N/T Nuu8q8vcQJ4UxaAQDtWXRLqBCPR0ali1t/Nx7tijnY6lrr7BzRqdyP8G5YxvkZgUbC+lkH wyPCnhurFLOXjVi6Gv2LTOz//+ToU8s= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bKfpkTCm; dmarc=none; spf=none (imf09.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741355658; a=rsa-sha256; cv=none; b=T2nPiEolgWjb080bxwR0NqldZIZSUTdexObQh4TfnMZzchagXGcTxcmtAsZ6Zi+8EW/MU5 WGzugpylQbJvSRm+yRv//kVI4F+SmEwW7yRmgpOTj5R5RDN7ZsIGQvgy00YiZCvnhlPNKr 5kDokPQADAsYBcPgNNPsV+TPYGFekZA= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=MCnjYQ2acBJQekNMxLqjVlaD6rzjLtTKGq0ILj29RFk=; b=bKfpkTCmPxeSbXcJ7VM2ipo40+ XhaUhwgXUh45osKdAPlOYImlO/cUXTUKj1rso0Nxr5kg3xJMtFI7iBuHFUbWDu297CZZ4WUdie9nI xUBagCMx7AExicE0jt1iSaDzkrB5ZwfMad0uC0IwsOgjsoSnrLHpB5Zr4eAjyUA5hd1Uiib+p1cjV 0WoALUdFcA3onPZONfN9vs80yhz9/HM6oEUdmf5S5M8tGA9UTzC+TqXEVdeh3hen/BGWub0VD8M0l y9vURrdeEI/VW7zSD9Y9JamRMCTciMSodw1MXCCTm6yaz1xnNv4UzbkTk8yYaVIC5QoEEo65MUWcL dtFzcuRw==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tqY9Y-0000000CXGo-3MSz; Fri, 07 Mar 2025 13:54:16 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 10/11] mm: Remove swap_writepage() and shmem_writepage() Date: Fri, 7 Mar 2025 13:54:10 +0000 Message-ID: <20250307135414.2987755-11-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307135414.2987755-1-willy@infradead.org> References: <20250307135414.2987755-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 6F0C814000D X-Rspam-User: X-Stat-Signature: sjwpziycd6knfdzf1rdqkjoj6ebboizg X-HE-Tag: 1741355658-514117 X-HE-Meta: U2FsdGVkX1//Ns2zBmhjZk/SS/iFtmFTkxyC3+gr9f5SXhZSdsxHK/8Uj0visK1NdQ5C+ndrFMBKWRIJXjcB2cFv36m/WwX+I3jw/vkhSIzUso4mrvmjXEPJQLxbh0X18HUaQJ5cDRI5+SnfI/OC+DjRo9RY2lW9aTuoRHevm8NTfvXwBf8LKutWhpA0TNJxMZhjW1lLaoUhvjRsKpowB+74ZereiL09GOUH5TvnOYgpgvNl9BWp5qDYkQeD0TvuttZvbabefbj/VAx677T5ssBEC97hwS578FGxulpFOS8YHi3/lIrd/dbBBvJYj27MV8HvPfa8O7iIgA/F7rD6O2ITbJIqyDeTCch+zvBAYzTnsb31vW/YGWEF+dNnqOpPh7POfVIdsZSEPU9aMvYBbFIKUQ5ikQoXIqRpPDk3HtIJ6zFuej9XBS43H9OlYG2AflAFtv43Gxb88a//JvlFm9S4Ri3/LkxSl/ggKjzhyPjv/t7UuEsn8Qe0Vt6mpUxzdAYyU2lbQTgKn0wsSByuuLl4OZK5iWguF68MdE9n2FJEQBQbPinsfN9+xN1T3swP0Ik2ElE+4OuLT1vw9ZdDbNIIHulDVlxL5tnHWoj1BzF+ijbU4T/3m++IKEUrlIDNiXi3ix/jqYJcLMxMslA95W/F57RlsGz+LDkUn/oGTlYhFMIKTekD+X2q1JtLZGzhTEntDun2N0F5X1U9R2YYx+j+yzAV4WOGJXg65ZpVng7aWPembJF84T3nZ3z8t1BxWM4l+SpprElnnCx1cPZOyq3D9mq7FBGqneo/rI+Fjf4vSTpXN1lh0eBtl4SzRJ+5tbbk+OC18G3qHboQB/EiUwyolhvD7nRi6NMJLEN0jksJmY5z14ADvIZwFuF0Zw/twiJw/7Q/0tqgDN13jt3sSlN/mBAVPQ9sJ2NSVh/5dD7YQNs/sgci+s86tRTp5I+GXZt0FFAjlfV6I7n1GUs 6EU7+hvc Xqxankb64rOJ+vF1YNQjUilVZIDgxpWl9TddNfTfcKHUFrQ0xAKy4Ky8MVsLZ3b4j1d7ENmj1r7fCzfJhNb9tdCZck+j9VB6nZI+CjFJzmZN/PGG8+YjgxrEQi/uhkyjHZ0qH07Z9V69235SSUMWjVBR4CcBZ7yJ3FqGmReax4nzbqO2dmg0BWhWH6+pmXrd0Xx8GA7GDOlTAQn8WR7feLUuv/hU/6ey7bngVi9xeDrYu5A0A5px3ruGSvxUlqwhZggqq7j8aHbVTND4XW8B5ClMpCtaQkc/FTNOE 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: Call swap_writeout() and shmem_writeout() from pageout() instead. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Baolin Wang Tested-by: Baolin Wang --- block/blk-wbt.c | 2 +- mm/page_io.c | 3 +-- mm/shmem.c | 23 +++++------------------ mm/swap.h | 4 ++-- mm/swap_state.c | 1 - mm/swapfile.c | 2 +- mm/vmscan.c | 28 ++++++++++++++++------------ 7 files changed, 26 insertions(+), 37 deletions(-) diff --git a/block/blk-wbt.c b/block/blk-wbt.c index f1754d07f7e0..60885731e8ab 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -37,7 +37,7 @@ enum wbt_flags { WBT_TRACKED = 1, /* write, tracked for throttling */ WBT_READ = 2, /* read */ - WBT_SWAP = 4, /* write, from swap_writepage() */ + WBT_SWAP = 4, /* write, from swap_writeout() */ WBT_DISCARD = 8, /* discard */ WBT_NR_BITS = 4, /* number of bits */ diff --git a/mm/page_io.c b/mm/page_io.c index 9b983de351f9..e9151952c514 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -237,9 +237,8 @@ static void swap_zeromap_folio_clear(struct folio *folio) * We may have stale swap cache pages in memory: notice * them here and get rid of the unnecessary final write. */ -int swap_writepage(struct page *page, struct writeback_control *wbc) +int swap_writeout(struct folio *folio, struct writeback_control *wbc) { - struct folio *folio = page_folio(page); int ret; if (folio_free_swap(folio)) { diff --git a/mm/shmem.c b/mm/shmem.c index 427b7f70fffb..a786b94a468a 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -98,7 +98,7 @@ static struct vfsmount *shm_mnt __ro_after_init; #define SHORT_SYMLINK_LEN 128 /* - * shmem_fallocate communicates with shmem_fault or shmem_writepage via + * shmem_fallocate communicates with shmem_fault or shmem_writeout via * inode->i_private (with i_rwsem making sure that it has only one user at * a time): we would prefer not to enlarge the shmem inode just for that. */ @@ -107,7 +107,7 @@ struct shmem_falloc { pgoff_t start; /* start of range currently being fallocated */ pgoff_t next; /* the next page offset to be fallocated */ pgoff_t nr_falloced; /* how many new pages have been fallocated */ - pgoff_t nr_unswapped; /* how often writepage refused to swap out */ + pgoff_t nr_unswapped; /* how often writeout refused to swap out */ }; struct shmem_options { @@ -446,7 +446,7 @@ static void shmem_recalc_inode(struct inode *inode, long alloced, long swapped) /* * Special case: whereas normally shmem_recalc_inode() is called * after i_mapping->nrpages has already been adjusted (up or down), - * shmem_writepage() has to raise swapped before nrpages is lowered - + * shmem_writeout() has to raise swapped before nrpages is lowered - * to stop a racing shmem_recalc_inode() from thinking that a page has * been freed. Compensate here, to avoid the need for a followup call. */ @@ -1536,11 +1536,6 @@ int shmem_unuse(unsigned int type) return error; } -static int shmem_writepage(struct page *page, struct writeback_control *wbc) -{ - return shmem_writeout(page_folio(page), wbc); -} - /** * shmem_writeout - Write the folio to swap * @folio: The folio to write @@ -1558,13 +1553,6 @@ int shmem_writeout(struct folio *folio, struct writeback_control *wbc) int nr_pages; bool split = false; - /* - * Our capabilities prevent regular writeback or sync from ever calling - * shmem_writepage; but a stacking filesystem might use ->writepage of - * its underlying filesystem, in which case tmpfs should write out to - * swap only in response to memory pressure, and not for the writeback - * threads or sync. - */ if (WARN_ON_ONCE(!wbc->for_reclaim)) goto redirty; @@ -1653,7 +1641,7 @@ int shmem_writeout(struct folio *folio, struct writeback_control *wbc) mutex_unlock(&shmem_swaplist_mutex); BUG_ON(folio_mapped(folio)); - return swap_writepage(&folio->page, wbc); + return swap_writeout(folio, wbc); } list_del_init(&info->swaplist); @@ -3780,7 +3768,7 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset, index--; /* - * Inform shmem_writepage() how far we have reached. + * Inform shmem_writeout() how far we have reached. * No need for lock or barrier: we have the page lock. */ if (!folio_test_uptodate(folio)) @@ -5203,7 +5191,6 @@ static int shmem_error_remove_folio(struct address_space *mapping, } static const struct address_space_operations shmem_aops = { - .writepage = shmem_writepage, .dirty_folio = noop_dirty_folio, #ifdef CONFIG_TMPFS .write_begin = shmem_write_begin, diff --git a/mm/swap.h b/mm/swap.h index 6f4a3f927edb..aa62463976d5 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -20,7 +20,7 @@ static inline void swap_read_unplug(struct swap_iocb *plug) __swap_read_unplug(plug); } void swap_write_unplug(struct swap_iocb *sio); -int swap_writepage(struct page *page, struct writeback_control *wbc); +int swap_writeout(struct folio *folio, struct writeback_control *wbc); void __swap_writepage(struct folio *folio, struct writeback_control *wbc); /* linux/mm/swap_state.c */ @@ -141,7 +141,7 @@ static inline struct folio *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask, return NULL; } -static inline int swap_writepage(struct page *p, struct writeback_control *wbc) +static inline int swap_writeout(struct folio *f, struct writeback_control *wbc) { return 0; } diff --git a/mm/swap_state.c b/mm/swap_state.c index 68fd981b514f..ec2b1c9c9926 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -30,7 +30,6 @@ * vmscan's shrink_folio_list. */ static const struct address_space_operations swap_aops = { - .writepage = swap_writepage, .dirty_folio = noop_dirty_folio, #ifdef CONFIG_MIGRATION .migrate_folio = migrate_folio, diff --git a/mm/swapfile.c b/mm/swapfile.c index 628f67974a7c..60c994f84842 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2360,7 +2360,7 @@ static int try_to_unuse(unsigned int type) * Limit the number of retries? No: when mmget_not_zero() * above fails, that mm is likely to be freeing swap from * exit_mmap(), which proceeds at its own independent pace; - * and even shmem_writepage() could have been preempted after + * and even shmem_writeout() could have been preempted after * folio_alloc_swap(), temporarily hiding that swap. It's easy * and robust (though cpu-intensive) just to keep retrying. */ diff --git a/mm/vmscan.c b/mm/vmscan.c index 34410d24dc15..e9f84fa31b9a 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -648,16 +648,16 @@ typedef enum { static pageout_t pageout(struct folio *folio, struct address_space *mapping, struct swap_iocb **plug, struct list_head *folio_list) { + int (*writeout)(struct folio *, struct writeback_control *); + /* - * If the folio is dirty, only perform writeback if that write - * will be non-blocking. To prevent this allocation from being - * stalled by pagecache activity. But note that there may be - * stalls if we need to run get_block(). We could test - * PagePrivate for that. - * - * If this process is currently in __generic_file_write_iter() against - * this folio's queue, we can perform writeback even if that - * will block. + * We no longer attempt to writeback filesystem folios here, other + * than tmpfs/shmem. That's taken care of in page-writeback. + * If we find a dirty filesystem folio at the end of the LRU list, + * typically that means the filesystem is saturating the storage + * with contiguous writes and telling it to write a folio here + * would only make the situation worse by injecting an element + * of random access. * * If the folio is swapcache, write it back even if that would * block, for some throttling. This happens by accident, because @@ -680,7 +680,11 @@ static pageout_t pageout(struct folio *folio, struct address_space *mapping, } return PAGE_KEEP; } - if (mapping->a_ops->writepage == NULL) + if (shmem_mapping(mapping)) + writeout = shmem_writeout; + else if (folio_test_anon(folio)) + writeout = swap_writeout; + else return PAGE_ACTIVATE; if (folio_clear_dirty_for_io(folio)) { @@ -703,7 +707,7 @@ static pageout_t pageout(struct folio *folio, struct address_space *mapping, wbc.list = folio_list; folio_set_reclaim(folio); - res = mapping->a_ops->writepage(&folio->page, &wbc); + res = writeout(folio, &wbc); if (res < 0) handle_write_error(mapping, folio, res); if (res == AOP_WRITEPAGE_ACTIVATE) { @@ -712,7 +716,7 @@ static pageout_t pageout(struct folio *folio, struct address_space *mapping, } if (!folio_test_writeback(folio)) { - /* synchronous write or broken a_ops? */ + /* synchronous write? */ folio_clear_reclaim(folio); } trace_mm_vmscan_write_folio(folio); From patchwork Fri Mar 7 13:54:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14006512 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 7D44BC19F32 for ; Fri, 7 Mar 2025 13:54:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 70FD86B0085; Fri, 7 Mar 2025 08:54:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B94C6B0092; Fri, 7 Mar 2025 08:54:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45AB56B0083; Fri, 7 Mar 2025 08:54:19 -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 1A5926B0085 for ; Fri, 7 Mar 2025 08:54:19 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 21A6055CCC for ; Fri, 7 Mar 2025 13:54:20 +0000 (UTC) X-FDA: 83194899480.03.986E335 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id 43047A0016 for ; Fri, 7 Mar 2025 13:54:18 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="A+/9m6Uf"; spf=none (imf15.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741355658; 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=pdDoc31AYz0Km57d074XqJjBHjWG/S2bDrTdZj34V7Q=; b=Dt7NndgWw+yIiScLOrrfoQnY9mWECHK+Fq/ejGZGOkSjPMwWiUakVppkAI7Kbgk7mMwljo mq90QY7cd8CVnBDMwLS06HsedSlxjg1XT9BjoX/K/y7lzMdIyGD9FLL5dyGIXqY7sES/oq tFonz4Jn2k//DUATpVW53wvInwolK3Y= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741355658; a=rsa-sha256; cv=none; b=rMQsU2ANG8NhOFpaPGtHIA9a2C3oo6+7chHvmIsC5B7LbOgUlCreONQOYGf5aa2Fyfhul8 PmExy0Me03UqR2W7MGU/+bLiuXWc3UryyrZ4yEE2GhqPGfo+1Elkq2tnolYuZqtb6MBIUx SuGt4YszW7yIfHteW4OpffTRZPoidI4= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="A+/9m6Uf"; spf=none (imf15.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=pdDoc31AYz0Km57d074XqJjBHjWG/S2bDrTdZj34V7Q=; b=A+/9m6Uf/a+/tD6ztG/rZziHTP 1IhO34O6I+2P9dHhsoJUSaiFTqJvVQErwuOhcDXs7smfJSUIAOygBiQnmSES621ruuCzYVJxtGcNt otnKlNBCo7ctzuILAzwBysZMP3EdKPP6NURSiBiRnUhttHxO+wFmtI/oc5J3DDOQKsAZVkcniQsT9 4YqNtJciRDA+t9qcI7yJIqppkvig2G5Lfi40TYXscb/abn1sQbuVUQua+NpFFVIAlg1bC5eZ2kRhs BF1z/shsY8506ppED+xZwWSwNZS9iVcjAch9aDECHL00YohPBTYLFduomT3iilEYAQtT04Gck63oq V6kKqb1A==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tqY9Y-0000000CXGv-3vgY; Fri, 07 Mar 2025 13:54:16 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 11/11] fs: Remove aops->writepage Date: Fri, 7 Mar 2025 13:54:11 +0000 Message-ID: <20250307135414.2987755-12-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307135414.2987755-1-willy@infradead.org> References: <20250307135414.2987755-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Stat-Signature: qcyjsjjas1yxtd7c7rikfqkuj1iok5qe X-Rspamd-Queue-Id: 43047A0016 X-Rspam-User: X-HE-Tag: 1741355658-510372 X-HE-Meta: U2FsdGVkX19pO7b/sCJXVChxFCWg0lVi2XXOHXh7D6zX2lXLpQKuFf5SCYJ84MloCZyUl351aB6YN+EYDCIS5ej2DZYx/UPROG3ZivhvJ5SpAWw8i5kQVlqTz9FT7WSYsc3oYOuxDcE4ahjb4jlhQuq/4LHpceEIhbRdlMzfkgqmpf5WKKvOgIGXZf6MyXq8RT0pvdVN4HDMgIx+mn2xRs7aEsqoGsOddpgzg3BcGG6G+q9TKhWxuXiDGY5eSYfw1An7jzVHOfEdYlhSZwwwZRnzk4otWWY3utoFenoc/1N4lyLrwzUVLTPfF1CuvSAB5DShgzibL75jUQaYyOIrphssMIiYcb2PBsoDnJPWr7qsy9OoXWeZ0yObohydEGiRRnCvsPnhKOnjrRjqlUvHxD7vY2qyLgFL5Z37Yp/IlNGffX582xuigl7mLinDPfzvzHlJCKqBCbPMzuZ3cHY4tHIwwNyZlQBR1FXJVmJN68eXSgL9wERgV4MnPiDnxBiUqcmDo+0qFjSQCNWyz8+DDEBI6pnvOc9mXdPH2ueM5WC7gT3VKlkSfdRpxxlV4heJ+FTYzZnHUZNb33vuA+y4o9w3NdybtuPBMud/mhQip1lLeGyXDMkL4T1M+6FbxZ3gk+rUkMQlCuE+p6GkVY5w/PxD7M54p/bS+oZkaHc5hn8BDxQyRci4U4DSHeVkR1Hzc1L69+V3bCsDw7Sag/+9Jh/SdKeIiyTWtShNp5MsFTiVHcEAPUU/aQrSmoaZ42cLQ7Yj9nzBCbPHim8OixLPeCkAKCzdU4fDWLoQPzQF1WR5uANpgur+QeO2bHrlzzOsUDPf+5rJz4VgoWQGG6qm5QK3+osgrsDjfZ4OOyIl4Hiu4+cxGX7/iX9XHQNUrSxdW7dx62sz1Z201N0DLbFxHmayC6RXnQmpr+mx1ROATaRYstnmCnpnPqV4se+lsgGa1Xyyg9IjevovbA3rCek lctSbew4 4z2MbLPaclRpBqMPVSicmRXyfeK3b/D97KFONyvyh0uW9yPuFSGGH8qiyCgpMLBdjmlFE81HMzD2z6QXRFAT9mPbXZSxYMpeDSHOf5bsEQO5qM3z7KdBV7WXkZ+9kiBfd75dxjZsWLTAzgOywHfL2/OaLnooaf6tFMAS2Sb580NfgzhDca03rgTTygD6yhpk2Iqq1BrbwvOvNQHjU8Vw5nHZY7g987a97i6tr7DAVz3A4Ujw= 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: All callers and implementations are now removed, so remove the operation and update the documentation to match. Signed-off-by: Matthew Wilcox (Oracle) --- Documentation/admin-guide/cgroup-v2.rst | 2 +- Documentation/filesystems/fscrypt.rst | 2 +- Documentation/filesystems/locking.rst | 54 +------------------------ Documentation/filesystems/vfs.rst | 39 +++++------------- fs/buffer.c | 4 +- include/linux/fs.h | 1 - mm/vmscan.c | 1 - 7 files changed, 15 insertions(+), 88 deletions(-) diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst index 77d80a7e975b..4e10b4084381 100644 --- a/Documentation/admin-guide/cgroup-v2.rst +++ b/Documentation/admin-guide/cgroup-v2.rst @@ -3028,7 +3028,7 @@ Filesystem Support for Writeback -------------------------------- A filesystem can support cgroup writeback by updating -address_space_operations->writepage[s]() to annotate bio's using the +address_space_operations->writepages() to annotate bio's using the following two functions. wbc_init_bio(@wbc, @bio) diff --git a/Documentation/filesystems/fscrypt.rst b/Documentation/filesystems/fscrypt.rst index e80329908549..3d22e2db732d 100644 --- a/Documentation/filesystems/fscrypt.rst +++ b/Documentation/filesystems/fscrypt.rst @@ -1409,7 +1409,7 @@ read the ciphertext into the page cache and decrypt it in-place. The folio lock must be held until decryption has finished, to prevent the folio from becoming visible to userspace prematurely. -For the write path (->writepage()) of regular files, filesystems +For the write path (->writepages()) of regular files, filesystems cannot encrypt data in-place in the page cache, since the cached plaintext must be preserved. Instead, filesystems must encrypt into a temporary buffer or "bounce page", then write out the temporary diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst index 0ec0bb6eb0fb..2e567e341c3b 100644 --- a/Documentation/filesystems/locking.rst +++ b/Documentation/filesystems/locking.rst @@ -249,7 +249,6 @@ address_space_operations ======================== prototypes:: - int (*writepage)(struct page *page, struct writeback_control *wbc); int (*read_folio)(struct file *, struct folio *); int (*writepages)(struct address_space *, struct writeback_control *); bool (*dirty_folio)(struct address_space *, struct folio *folio); @@ -280,7 +279,6 @@ locking rules: ====================== ======================== ========= =============== ops folio locked i_rwsem invalidate_lock ====================== ======================== ========= =============== -writepage: yes, unlocks (see below) read_folio: yes, unlocks shared writepages: dirty_folio: maybe @@ -309,54 +307,6 @@ completion. ->readahead() unlocks the folios that I/O is attempted on like ->read_folio(). -->writepage() is used for two purposes: for "memory cleansing" and for -"sync". These are quite different operations and the behaviour may differ -depending upon the mode. - -If writepage is called for sync (wbc->sync_mode != WBC_SYNC_NONE) then -it *must* start I/O against the page, even if that would involve -blocking on in-progress I/O. - -If writepage is called for memory cleansing (sync_mode == -WBC_SYNC_NONE) then its role is to get as much writeout underway as -possible. So writepage should try to avoid blocking against -currently-in-progress I/O. - -If the filesystem is not called for "sync" and it determines that it -would need to block against in-progress I/O to be able to start new I/O -against the page the filesystem should redirty the page with -redirty_page_for_writepage(), then unlock the page and return zero. -This may also be done to avoid internal deadlocks, but rarely. - -If the filesystem is called for sync then it must wait on any -in-progress I/O and then start new I/O. - -The filesystem should unlock the page synchronously, before returning to the -caller, unless ->writepage() returns special WRITEPAGE_ACTIVATE -value. WRITEPAGE_ACTIVATE means that page cannot really be written out -currently, and VM should stop calling ->writepage() on this page for some -time. VM does this by moving page to the head of the active list, hence the -name. - -Unless the filesystem is going to redirty_page_for_writepage(), unlock the page -and return zero, writepage *must* run set_page_writeback() against the page, -followed by unlocking it. Once set_page_writeback() has been run against the -page, write I/O can be submitted and the write I/O completion handler must run -end_page_writeback() once the I/O is complete. If no I/O is submitted, the -filesystem must run end_page_writeback() against the page before returning from -writepage. - -That is: after 2.5.12, pages which are under writeout are *not* locked. Note, -if the filesystem needs the page to be locked during writeout, that is ok, too, -the page is allowed to be unlocked at any point in time between the calls to -set_page_writeback() and end_page_writeback(). - -Note, failure to run either redirty_page_for_writepage() or the combination of -set_page_writeback()/end_page_writeback() on a page submitted to writepage -will leave the page itself marked clean but it will be tagged as dirty in the -radix tree. This incoherency can lead to all sorts of hard-to-debug problems -in the filesystem like having dirty inodes at umount and losing written data. - ->writepages() is used for periodic writeback and for syscall-initiated sync operations. The address_space should start I/O against at least ``*nr_to_write`` pages. ``*nr_to_write`` must be decremented for each page @@ -364,8 +314,8 @@ which is written. The address_space implementation may write more (or less) pages than ``*nr_to_write`` asks for, but it should try to be reasonably close. If nr_to_write is NULL, all dirty pages must be written. -writepages should _only_ write pages which are present on -mapping->io_pages. +writepages should _only_ write pages which are present in +mapping->i_pages. ->dirty_folio() is called from various places in the kernel when the target folio is marked as needing writeback. The folio cannot be diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst index ae79c30b6c0c..f66a4e706b17 100644 --- a/Documentation/filesystems/vfs.rst +++ b/Documentation/filesystems/vfs.rst @@ -716,9 +716,8 @@ page lookup by address, and keeping track of pages tagged as Dirty or Writeback. The first can be used independently to the others. The VM can try to -either write dirty pages in order to clean them, or release clean pages -in order to reuse them. To do this it can call the ->writepage method -on dirty pages, and ->release_folio on clean folios with the private +release clean pages in order to reuse them. To do this it can call +->release_folio on clean folios with the private flag set. Clean pages without PagePrivate and with no external references will be released without notice being given to the address_space. @@ -731,8 +730,8 @@ maintains information about the PG_Dirty and PG_Writeback status of each page, so that pages with either of these flags can be found quickly. The Dirty tag is primarily used by mpage_writepages - the default -->writepages method. It uses the tag to find dirty pages to call -->writepage on. If mpage_writepages is not used (i.e. the address +->writepages method. It uses the tag to find dirty pages to +write back. If mpage_writepages is not used (i.e. the address provides its own ->writepages) , the PAGECACHE_TAG_DIRTY tag is almost unused. write_inode_now and sync_inode do use it (through __sync_single_inode) to check if ->writepages has been successful in @@ -756,23 +755,23 @@ pages, however the address_space has finer control of write sizes. The read process essentially only requires 'read_folio'. The write process is more complicated and uses write_begin/write_end or -dirty_folio to write data into the address_space, and writepage and +dirty_folio to write data into the address_space, and writepages to writeback data to storage. Adding and removing pages to/from an address_space is protected by the inode's i_mutex. When data is written to a page, the PG_Dirty flag should be set. It -typically remains set until writepage asks for it to be written. This +typically remains set until writepages asks for it to be written. This should clear PG_Dirty and set PG_Writeback. It can be actually written at any point after PG_Dirty is clear. Once it is known to be safe, PG_Writeback is cleared. Writeback makes use of a writeback_control structure to direct the -operations. This gives the writepage and writepages operations some +operations. This gives the writepages operation some information about the nature of and reason for the writeback request, and the constraints under which it is being done. It is also used to -return information back to the caller about the result of a writepage or +return information back to the caller about the result of a writepages request. @@ -819,7 +818,6 @@ cache in your filesystem. The following members are defined: .. code-block:: c struct address_space_operations { - int (*writepage)(struct page *page, struct writeback_control *wbc); int (*read_folio)(struct file *, struct folio *); int (*writepages)(struct address_space *, struct writeback_control *); bool (*dirty_folio)(struct address_space *, struct folio *); @@ -848,25 +846,6 @@ cache in your filesystem. The following members are defined: int (*swap_rw)(struct kiocb *iocb, struct iov_iter *iter); }; -``writepage`` - called by the VM to write a dirty page to backing store. This - may happen for data integrity reasons (i.e. 'sync'), or to free - up memory (flush). The difference can be seen in - wbc->sync_mode. The PG_Dirty flag has been cleared and - PageLocked is true. writepage should start writeout, should set - PG_Writeback, and should make sure the page is unlocked, either - synchronously or asynchronously when the write operation - completes. - - If wbc->sync_mode is WB_SYNC_NONE, ->writepage doesn't have to - try too hard if there are problems, and may choose to write out - other pages from the mapping if that is easier (e.g. due to - internal dependencies). If it chooses not to start writeout, it - should return AOP_WRITEPAGE_ACTIVATE so that the VM will not - keep calling ->writepage on that page. - - See the file "Locking" for more details. - ``read_folio`` Called by the page cache to read a folio from the backing store. The 'file' argument supplies authentication information to network @@ -909,7 +888,7 @@ cache in your filesystem. The following members are defined: given and that many pages should be written if possible. If no ->writepages is given, then mpage_writepages is used instead. This will choose pages from the address space that are tagged as - DIRTY and will pass them to ->writepage. + DIRTY and will write them back. ``dirty_folio`` called by the VM to mark a folio as dirty. This is particularly diff --git a/fs/buffer.c b/fs/buffer.c index c7abb4a029dc..b99dc69dba37 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2695,7 +2695,7 @@ int block_truncate_page(struct address_space *mapping, EXPORT_SYMBOL(block_truncate_page); /* - * The generic ->writepage function for buffer-backed address_spaces + * The generic write folio function for buffer-backed address_spaces */ int block_write_full_folio(struct folio *folio, struct writeback_control *wbc, void *get_block) @@ -2715,7 +2715,7 @@ int block_write_full_folio(struct folio *folio, struct writeback_control *wbc, /* * The folio straddles i_size. It must be zeroed out on each and every - * writepage invocation because it may be mmapped. "A file is mapped + * writeback invocation because it may be mmapped. "A file is mapped * in multiples of the page size. For a file that is not a multiple of * the page size, the remaining memory is zeroed when mapped, and * writes to that region are not written out to the file." diff --git a/include/linux/fs.h b/include/linux/fs.h index 110d95d04299..26ce65c4a003 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -433,7 +433,6 @@ static inline bool is_sync_kiocb(struct kiocb *kiocb) } struct address_space_operations { - int (*writepage)(struct page *page, struct writeback_control *wbc); int (*read_folio)(struct file *, struct folio *); /* Write back some dirty pages from this mapping. */ diff --git a/mm/vmscan.c b/mm/vmscan.c index e9f84fa31b9a..7e79ca975c9d 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -643,7 +643,6 @@ typedef enum { /* * pageout is called by shrink_folio_list() for each dirty folio. - * Calls ->writepage(). */ static pageout_t pageout(struct folio *folio, struct address_space *mapping, struct swap_iocb **plug, struct list_head *folio_list)