From patchwork Sun May 8 20:29:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842802 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 444FBC433FE for ; Sun, 8 May 2022 20:30:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232305AbiEHUeG (ORCPT ); Sun, 8 May 2022 16:34:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232148AbiEHUdu (ORCPT ); Sun, 8 May 2022 16:33:50 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEFB7DFEA for ; Sun, 8 May 2022 13:29:59 -0700 (PDT) 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=+FJqpBnjKvkYcFghyH0RiRG/N81yoH33P8bIUw3ARaI=; b=MBMEySWFYlK3OXr6oCp1Aj8Og5 ExMzcKnZBquyLMrGjZmxPlbbz3JSyt5DeliReRwS+bUhHj6LIFx9kNcqlQ2UwkBiZsSJCJnxO43fc NGp8lWmy7j3bcuBeLm900dSfJmyyg8/aQlEWOISjyoPoitqJpGEp1OTwqqwaSbrXBz/8SDe7czGvA +COM9xRElXilf644nr3bSxVZn1glm4HLiD+qug48hFzXF+OvGkqseONGed+u/YFpUK6rG5EscMv/t Ea6eU7MQNw8nPAYcinRl+eQpg4LJEel/ZBZiyGkZ9hc6ZROioLki2cdEHEvgz1Mm1gWzpzfGvYi4j ouAcLzIg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXR-002nXt-Sm; Sun, 08 May 2022 20:29:57 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 01/25] ext4: Use page_symlink() instead of __page_symlink() Date: Sun, 8 May 2022 21:29:17 +0100 Message-Id: <20220508202941.667024-2-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org By using the memalloc_nofs_save() functionality, we can call page_symlink(), safe in the knowledge that it won't recurse into the filesystem. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/ext4/namei.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 767b4bfe39c3..1e7c5deed5e3 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -3308,6 +3309,8 @@ static int ext4_symlink(struct user_namespace *mnt_userns, struct inode *dir, } if ((disk_link.len > EXT4_N_BLOCKS * 4)) { + unsigned int flags; + if (!IS_ENCRYPTED(inode)) inode->i_op = &ext4_symlink_inode_operations; inode_nohighmem(inode); @@ -3329,7 +3332,9 @@ static int ext4_symlink(struct user_namespace *mnt_userns, struct inode *dir, handle = NULL; if (err) goto err_drop_inode; - err = __page_symlink(inode, disk_link.name, disk_link.len, 1); + flags = memalloc_nofs_save(); + err = page_symlink(inode, disk_link.name, disk_link.len); + memalloc_nofs_restore(flags); if (err) goto err_drop_inode; /* From patchwork Sun May 8 20:29:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842821 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF3A0C433EF for ; Sun, 8 May 2022 20:30:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232456AbiEHUeg (ORCPT ); Sun, 8 May 2022 16:34:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232322AbiEHUd7 (ORCPT ); Sun, 8 May 2022 16:33:59 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7FDABE3B for ; Sun, 8 May 2022 13:30:08 -0700 (PDT) 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=ukNbbRbZxH56Po3ysYnQL8YLpC4stX4G0l+kdkGV3Og=; b=PlW4yQAKfcAwHnL8/K8YTpCF1Z Afmh/ZCI7bpXkXR3eaP1GM0sMexvYuB6QcKT3zqjYSlp5w2Jrfk9HjDIyHopbWaTcRzQALJIRz7UK U2qjKUX/x/pJUDp3i9Ndi6mQs4n4qlqzE4LcWL2xJ7incXCt65DamNLJ9lsMzXUbsCZKKyCCs+pv2 0gI9oHMA27ts1CY3MM4Zb2xJEgKGV3kNJtdQ7Ij05qHyzRwOhPT8dTwX1gP0gC/M9B6pRLlz71tw+ nNdalG0elk6L+LeXVPtNTe5VdAIwJpjgreSjnhIMljHyl3DnEGX9hKsLg9aN5nG0ACdE+XRFeqRNL pHZuNgJw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXR-002nXv-VZ; Sun, 08 May 2022 20:29:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig , Christian Brauner Subject: [PATCH 02/25] namei: Merge page_symlink() and __page_symlink() Date: Sun, 8 May 2022 21:29:18 +0100 Message-Id: <20220508202941.667024-3-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org There are no callers of __page_symlink() left, so we can remove that entry point. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Reviewed-by: Christian Brauner --- Documentation/filesystems/porting.rst | 2 +- fs/namei.c | 13 ++----------- include/linux/fs.h | 2 -- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/Documentation/filesystems/porting.rst b/Documentation/filesystems/porting.rst index 7c1583dbeb59..2e0e4f0e0c6f 100644 --- a/Documentation/filesystems/porting.rst +++ b/Documentation/filesystems/porting.rst @@ -624,7 +624,7 @@ any symlink that might use page_follow_link_light/page_put_link() must have inode_nohighmem(inode) called before anything might start playing with its pagecache. No highmem pages should end up in the pagecache of such symlinks. That includes any preseeding that might be done during symlink -creation. __page_symlink() will honour the mapping gfp flags, so once +creation. page_symlink() will honour the mapping gfp flags, so once you've done inode_nohighmem() it's safe to use, but if you allocate and insert the page manually, make sure to use the right gfp flags. diff --git a/fs/namei.c b/fs/namei.c index 509657fdf4f5..6153581073b1 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -5001,12 +5001,10 @@ int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) } EXPORT_SYMBOL(page_readlink); -/* - * The nofs argument instructs pagecache_write_begin to pass AOP_FLAG_NOFS - */ -int __page_symlink(struct inode *inode, const char *symname, int len, int nofs) +int page_symlink(struct inode *inode, const char *symname, int len) { struct address_space *mapping = inode->i_mapping; + bool nofs = !mapping_gfp_constraint(mapping, __GFP_FS); struct page *page; void *fsdata; int err; @@ -5034,13 +5032,6 @@ int __page_symlink(struct inode *inode, const char *symname, int len, int nofs) fail: return err; } -EXPORT_SYMBOL(__page_symlink); - -int page_symlink(struct inode *inode, const char *symname, int len) -{ - return __page_symlink(inode, symname, len, - !mapping_gfp_constraint(inode->i_mapping, __GFP_FS)); -} EXPORT_SYMBOL(page_symlink); const struct inode_operations page_symlink_inode_operations = { diff --git a/include/linux/fs.h b/include/linux/fs.h index bbde95387a23..e108aff23a28 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3109,8 +3109,6 @@ extern int page_readlink(struct dentry *, char __user *, int); extern const char *page_get_link(struct dentry *, struct inode *, struct delayed_call *); extern void page_put_link(void *); -extern int __page_symlink(struct inode *inode, const char *symname, int len, - int nofs); extern int page_symlink(struct inode *inode, const char *symname, int len); extern const struct inode_operations page_symlink_inode_operations; extern void kfree_link(void *); From patchwork Sun May 8 20:29:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842814 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2506C433FE for ; Sun, 8 May 2022 20:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232351AbiEHUeX (ORCPT ); Sun, 8 May 2022 16:34:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232310AbiEHUd7 (ORCPT ); Sun, 8 May 2022 16:33:59 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1A6A101DA for ; Sun, 8 May 2022 13:30:05 -0700 (PDT) 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=oOCFSTQjXi3I8TjZeXPYoY2HCI8zdIL+BInag5eurSU=; b=Vr6JlJj2cCX7SBNYjFbQTwat9h o98IGrUaq+/QGIMr6H+Mq/XTcArH4lYBZj44FauHAPhoJo1tPzuZ5z/482lgp5GHKqtca/9GWGoVb 2uPvliXCLsvg6Szl8RPDNJDntMD7iYwLq7F0eHtq7AV0nc8T5mMHWk5T7GL0c2hWulf4WeujMeDm0 LLeMw4T2WMCNt5XEkMdbXYGzyDxLQR6CX4092OAqlNDCzHp+pvw0CgdoTrqHg7YePbpI36JGB2h0K LBfXx08og15t/A8tEtS6vgBYZojcYqsZxZZmA0xPAPQVAV2fs2z3oZa8qF+qkWhwiuQ1YXNF84jKE Avn0bvqw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXS-002nXz-2H; Sun, 08 May 2022 20:29:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 03/25] namei: Convert page_symlink() to use memalloc_nofs_save() Date: Sun, 8 May 2022 21:29:19 +0100 Message-Id: <20220508202941.667024-4-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Stop using AOP_FLAG_NOFS in favour of the scoped memory API. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/namei.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 6153581073b1..0c84b4326dc9 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -5008,13 +5009,15 @@ int page_symlink(struct inode *inode, const char *symname, int len) struct page *page; void *fsdata; int err; - unsigned int flags = 0; - if (nofs) - flags |= AOP_FLAG_NOFS; + unsigned int flags; retry: + if (nofs) + flags = memalloc_nofs_save(); err = pagecache_write_begin(NULL, mapping, 0, len-1, - flags, &page, &fsdata); + 0, &page, &fsdata); + if (nofs) + memalloc_nofs_restore(flags); if (err) goto fail; From patchwork Sun May 8 20:29:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842815 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14452C433EF for ; Sun, 8 May 2022 20:30:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232357AbiEHUeX (ORCPT ); Sun, 8 May 2022 16:34:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232267AbiEHUdz (ORCPT ); Sun, 8 May 2022 16:33:55 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A7C2FD14 for ; Sun, 8 May 2022 13:30:03 -0700 (PDT) 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=KXbqSvumSVrPe8vjC4VZrIVjZd7wuuA9EJ+sQnxubXQ=; b=iweou21U6QlCnmDrLdZE3EA3xN CiqNZ+rBRi12PvfegyIs3/id9PhaPjdxGvhd4qH1tydwL3P7UZ5CprC7M54HN6pH4lcG4pmtPRyRU RuDi16qqhUCiZJ3TVeYGVIARAmrKGC3Pw6d2Z80z6IHy1Q2YC3HCnq34H9LxJ2kLGQnoL8x5vGDDc GpwQ/3a+78DePpGrgsHTRypTC6Bd0Akg8tWnOPs/LBK0TfPO5ENd45ng/lPqw5a5eXSrxjmS4A++z OFh3gMl0+tKWt2QDryUnYVZ9p+U+Q4k2GtJNESMI0og4UzCB+Qiw77F1HVdQQP3JTQ9m/4p4y8ets zLO0sDgg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXS-002nY2-4B; Sun, 08 May 2022 20:29:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 04/25] f2fs: Convert f2fs_grab_cache_page() to use scoped memory APIs Date: Sun, 8 May 2022 21:29:20 +0100 Message-Id: <20220508202941.667024-5-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Prevent GFP_FS allocations by using memalloc_nofs_save() instead of AOP_FLAG_NOFS. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/f2fs/f2fs.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 8c570de21ed5..74929ade4b5e 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -2654,6 +2655,7 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping, pgoff_t index, bool for_write) { struct page *page; + unsigned int flags; if (IS_ENABLED(CONFIG_F2FS_FAULT_INJECTION)) { if (!for_write) @@ -2673,7 +2675,12 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping, if (!for_write) return grab_cache_page(mapping, index); - return grab_cache_page_write_begin(mapping, index, AOP_FLAG_NOFS); + + flags = memalloc_nofs_save(); + page = grab_cache_page_write_begin(mapping, index, 0); + memalloc_nofs_restore(flags); + + return page; } static inline struct page *f2fs_pagecache_get_page( From patchwork Sun May 8 20:29:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842888 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56E9EC433EF for ; Sun, 8 May 2022 20:32:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232889AbiEHUgj (ORCPT ); Sun, 8 May 2022 16:36:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232318AbiEHUd7 (ORCPT ); Sun, 8 May 2022 16:33:59 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74067101E6 for ; Sun, 8 May 2022 13:30:06 -0700 (PDT) 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=ATnuT7N0epb/e80siA2Nrn8r9Wwz8RTRUGV2l5yaIvs=; b=DW5TTMIP7qv0biJnw4pK6nWddW fJ9UCSfpjFYUw9BEVHgwLdmc/+ZuvTdneiHMVGE4xBIzf8/xrVnEicQ/9arAyateGHTTPS5EO6Ey8 mvV72sO8ocakc0DeUXYqEBZqwYHoIdKlx9oDELfOANHvFOUrYCml8PembGE1EYCQfbBpjqLZMPdmw kIc3yUvfrWxZ0be05oXAsqTMIrsfT/EG3KFT4+9yL4PiLzycKZQp3QM24zq3hMlG8vqEM32b8+3HQ 0DII8nKa7cGzOODDKwil3B09yopaBGVMStz+EsT6R6TLOXCdVeTGDrPdOei1O6kmDnzIl96rk9pu0 ROAKoU1A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXS-002nY4-6d; Sun, 08 May 2022 20:29:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Theodore Ts'o Subject: [PATCH 05/25] ext4: Allow GFP_FS allocations in ext4_da_convert_inline_data_to_extent() Date: Sun, 8 May 2022 21:29:21 +0100 Message-Id: <20220508202941.667024-6-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Since commit 8bc1379b82b8, the transaction is stopped before calling ext4_da_convert_inline_data_to_extent(), which means we can do GFP_FS allocations and recurse into the filesystem. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Theodore Ts'o --- fs/ext4/inline.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 9c076262770d..93694ceb5a34 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -848,13 +848,12 @@ ext4_journalled_write_inline_data(struct inode *inode, */ static int ext4_da_convert_inline_data_to_extent(struct address_space *mapping, struct inode *inode, - unsigned flags, void **fsdata) { int ret = 0, inline_size; struct page *page; - page = grab_cache_page_write_begin(mapping, 0, flags); + page = grab_cache_page_write_begin(mapping, 0, 0); if (!page) return -ENOMEM; @@ -942,7 +941,6 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, ext4_journal_stop(handle); ret = ext4_da_convert_inline_data_to_extent(mapping, inode, - flags, fsdata); if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) From patchwork Sun May 8 20:29:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842820 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2BC0C433F5 for ; Sun, 8 May 2022 20:30:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232478AbiEHUef (ORCPT ); Sun, 8 May 2022 16:34:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232328AbiEHUeA (ORCPT ); Sun, 8 May 2022 16:34:00 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59FE2DFEA for ; Sun, 8 May 2022 13:30:09 -0700 (PDT) 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=fs3yjOFU7Is8zXjtGhR6ALd+llANqAadapxJ56oler4=; b=R5gF7mhvclarDN6yQfsbFOwibX FvC1lrNybSJ97m1CCRSpNPBe4A8wT/shoNbyw3TrsLaOxcsKl0xaLswsw4ekbFg873e7MUpS91XLG YiSwe6TkOBMV/Mr2PyWlRpypwuUcEnJ3749i9JKrJ1qjziO5wp3jxiIyxa091K5jxQQeRbVmLNQ96 bcZ01KGrHAgpGvfWeIjikHtGrr6vBj/AXY4w7m+aW9EZ4nQUfKFs2MJMDLOEXnVKSHPDBoiI/pnO5 zv+FAQqrcbfw9sj4zmZs20FQH43O13zDTkkmt1F7zokyd/LxPvKF6TgHbw+Wap3RftyFInx353o1e rZkW4JOw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXS-002nYB-A9; Sun, 08 May 2022 20:29:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Theodore Ts'o Subject: [PATCH 06/25] ext4: Use scoped memory API in mext_page_double_lock() Date: Sun, 8 May 2022 21:29:22 +0100 Message-Id: <20220508202941.667024-7-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Replace use of AOP_FLAG_NOFS with calls to memalloc_nofs_save() and memalloc_nofs_restore(). Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Theodore Ts'o --- fs/ext4/move_extent.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 95aa212f0863..56f21272fb00 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "ext4_jbd2.h" #include "ext4.h" #include "ext4_extents.h" @@ -127,7 +128,7 @@ mext_page_double_lock(struct inode *inode1, struct inode *inode2, pgoff_t index1, pgoff_t index2, struct page *page[2]) { struct address_space *mapping[2]; - unsigned fl = AOP_FLAG_NOFS; + unsigned int flags; BUG_ON(!inode1 || !inode2); if (inode1 < inode2) { @@ -139,11 +140,15 @@ mext_page_double_lock(struct inode *inode1, struct inode *inode2, mapping[1] = inode1->i_mapping; } - page[0] = grab_cache_page_write_begin(mapping[0], index1, fl); - if (!page[0]) + flags = memalloc_nofs_save(); + page[0] = grab_cache_page_write_begin(mapping[0], index1, 0); + if (!page[0]) { + memalloc_nofs_restore(flags); return -ENOMEM; + } - page[1] = grab_cache_page_write_begin(mapping[1], index2, fl); + page[1] = grab_cache_page_write_begin(mapping[1], index2, 0); + memalloc_nofs_restore(flags); if (!page[1]) { unlock_page(page[0]); put_page(page[0]); From patchwork Sun May 8 20:29:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842822 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA4C0C433F5 for ; Sun, 8 May 2022 20:30:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232378AbiEHUei (ORCPT ); Sun, 8 May 2022 16:34:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232301AbiEHUd6 (ORCPT ); Sun, 8 May 2022 16:33:58 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3F78FD3D for ; Sun, 8 May 2022 13:30:03 -0700 (PDT) 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=trDP4gjjFpmqZvJ+JNrSlXV+L8vVqC1TdJmWMDKM3+I=; b=uIvPSpxlEyXkN5DKDhMYmCM4Sh A88W6M++BQSCaaUWkSGSUtR8WiPjJ3U5hcXi6PrWTzyXrhECjUujgl4sa6eKO1KLamVJX9mfm5uod aMkVUmACRM2fYw+4+Gp+SPqKpxRJS2XdmwaTy/atZK08YNqj9hhvjSYw9s/1PdIylxO6BhTuI/MML Lqyi557xY0MjcZFuF4TKVRolPAvcmfvm9xRmrDcpy9HJoF6bhbEQt+decU7SZ7XqNyBLQZV38fjSF nFHCRxxhvNwKGGxmtaC5SGWf1Qp/2fJMsoZb9NWcEhYJsTylnIuYPzgqNJRuwA6ZtfwuwRnFjvgxc bOkA26bw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXS-002nYG-Cv; Sun, 08 May 2022 20:29:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Theodore Ts'o Subject: [PATCH 07/25] ext4: Use scoped memory APIs in ext4_da_write_begin() Date: Sun, 8 May 2022 21:29:23 +0100 Message-Id: <20220508202941.667024-8-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Instead of setting AOP_FLAG_NOFS, use memalloc_nofs_save() and memalloc_nofs_restore() to prevent GFP_FS allocations recursing into the filesystem with a journal already started. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Theodore Ts'o --- fs/ext4/ext4.h | 1 - fs/ext4/inline.c | 16 ++++++++-------- fs/ext4/inode.c | 3 +-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index a743b1e3b89e..90677e30e52d 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -3604,7 +3604,6 @@ ext4_journalled_write_inline_data(struct inode *inode, extern int ext4_da_write_inline_data_begin(struct address_space *mapping, struct inode *inode, loff_t pos, unsigned len, - unsigned flags, struct page **pagep, void **fsdata); extern int ext4_try_add_inline_entry(handle_t *handle, diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 93694ceb5a34..d965ba08f68f 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -906,7 +906,6 @@ static int ext4_da_convert_inline_data_to_extent(struct address_space *mapping, int ext4_da_write_inline_data_begin(struct address_space *mapping, struct inode *inode, loff_t pos, unsigned len, - unsigned flags, struct page **pagep, void **fsdata) { @@ -915,6 +914,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, struct page *page; struct ext4_iloc iloc; int retries = 0; + unsigned int flags; ret = ext4_get_inode_loc(inode, &iloc); if (ret) @@ -931,12 +931,6 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, if (ret && ret != -ENOSPC) goto out_journal; - /* - * We cannot recurse into the filesystem as the transaction - * is already started. - */ - flags |= AOP_FLAG_NOFS; - if (ret == -ENOSPC) { ext4_journal_stop(handle); ret = ext4_da_convert_inline_data_to_extent(mapping, @@ -948,7 +942,13 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, goto out; } - page = grab_cache_page_write_begin(mapping, 0, flags); + /* + * We cannot recurse into the filesystem as the transaction + * is already started. + */ + flags = memalloc_nofs_save(); + page = grab_cache_page_write_begin(mapping, 0, 0); + memalloc_nofs_restore(flags); if (!page) { ret = -ENOMEM; goto out_journal; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 646ece9b3455..21ebcb3c59ba 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2954,8 +2954,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping, trace_ext4_da_write_begin(inode, pos, len, flags); if (ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) { - ret = ext4_da_write_inline_data_begin(mapping, inode, - pos, len, flags, + ret = ext4_da_write_inline_data_begin(mapping, inode, pos, len, pagep, fsdata); if (ret < 0) return ret; From patchwork Sun May 8 20:29:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842803 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A071C433EF for ; Sun, 8 May 2022 20:30:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232336AbiEHUeH (ORCPT ); Sun, 8 May 2022 16:34:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232200AbiEHUdv (ORCPT ); Sun, 8 May 2022 16:33:51 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7035AE007 for ; Sun, 8 May 2022 13:30:00 -0700 (PDT) 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=dYZKrf5pdSYug9lsibPHpic0LKqrclyIK/b7UwBqBrU=; b=YeFIXUhIBYoc5Ki2SXcr4/i/gV tE0cufZaxqGnqlwHxC3piePatBl7DR3Vz4Tt0ucHWCq5z1qBmc6mea84L9Le9l1yQ99qNuiG5OcbE H7fzEcav6Ad2xCl78C5G+i2JpVXFXgrEh3Tg7uAFXn4ngO/XJecsq/mfyUQqgEN4lpzFCbQos2f0D ZKAk2Pyj+HlAcu0tacJSWRXMfFzDuqk3i6lAxT8Yy2e9mS8DZNplj5oDM+BEOmrEpwN+8PcMdlwTw XnKXMm877HjFnyhxFlUpNFISSB/qbsHCwRFXWgEtUvt4hQtsnDkf1qmQCYDgoXrmXGskaMbbeTx7G EL5yN+Pg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXS-002nYI-FZ; Sun, 08 May 2022 20:29:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Theodore Ts'o Subject: [PATCH 08/25] ext4: Use scoped memory APIs in ext4_write_begin() Date: Sun, 8 May 2022 21:29:24 +0100 Message-Id: <20220508202941.667024-9-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Instead of setting AOP_FLAG_NOFS, use memalloc_nofs_save() and memalloc_nofs_restore() to prevent GFP_FS allocations recursing into the filesystem with a journal already started. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Theodore Ts'o --- fs/ext4/ext4.h | 1 - fs/ext4/inline.c | 21 ++++++++++----------- fs/ext4/inode.c | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 90677e30e52d..0c3308bac6c1 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -3591,7 +3591,6 @@ extern int ext4_readpage_inline(struct inode *inode, struct page *page); extern int ext4_try_to_write_inline_data(struct address_space *mapping, struct inode *inode, loff_t pos, unsigned len, - unsigned flags, struct page **pagep); extern int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index d965ba08f68f..b2ef5ba568bc 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -527,13 +527,13 @@ int ext4_readpage_inline(struct inode *inode, struct page *page) } static int ext4_convert_inline_data_to_extent(struct address_space *mapping, - struct inode *inode, - unsigned flags) + struct inode *inode) { int ret, needed_blocks, no_expand; handle_t *handle = NULL; int retries = 0, sem_held = 0; struct page *page = NULL; + unsigned int flags; unsigned from, to; struct ext4_iloc iloc; @@ -562,9 +562,9 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping, /* We cannot recurse into the filesystem as the transaction is already * started */ - flags |= AOP_FLAG_NOFS; - - page = grab_cache_page_write_begin(mapping, 0, flags); + flags = memalloc_nofs_save(); + page = grab_cache_page_write_begin(mapping, 0, 0); + memalloc_nofs_restore(flags); if (!page) { ret = -ENOMEM; goto out; @@ -649,11 +649,11 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping, int ext4_try_to_write_inline_data(struct address_space *mapping, struct inode *inode, loff_t pos, unsigned len, - unsigned flags, struct page **pagep) { int ret; handle_t *handle; + unsigned int flags; struct page *page; struct ext4_iloc iloc; @@ -691,9 +691,9 @@ int ext4_try_to_write_inline_data(struct address_space *mapping, if (ret) goto out; - flags |= AOP_FLAG_NOFS; - - page = grab_cache_page_write_begin(mapping, 0, flags); + flags = memalloc_nofs_save(); + page = grab_cache_page_write_begin(mapping, 0, 0); + memalloc_nofs_restore(flags); if (!page) { ret = -ENOMEM; goto out; @@ -727,8 +727,7 @@ int ext4_try_to_write_inline_data(struct address_space *mapping, brelse(iloc.bh); return ret; convert: - return ext4_convert_inline_data_to_extent(mapping, - inode, flags); + return ext4_convert_inline_data_to_extent(mapping, inode); } int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 21ebcb3c59ba..01a55647c959 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1156,7 +1156,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping, if (ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) { ret = ext4_try_to_write_inline_data(mapping, inode, pos, len, - flags, pagep); + pagep); if (ret < 0) return ret; if (ret == 1) From patchwork Sun May 8 20:29:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842801 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDF4AC433F5 for ; Sun, 8 May 2022 20:30:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232263AbiEHUeE (ORCPT ); Sun, 8 May 2022 16:34:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232155AbiEHUdv (ORCPT ); Sun, 8 May 2022 16:33:51 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 340FEDFFD for ; Sun, 8 May 2022 13:30:00 -0700 (PDT) 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=ha8ebKgRGxtayEYqUXJ+XYzoZ7W6fZr5XiakkCOM3DA=; b=rgZsGj3HLxHX//6HnBmQnyAW+k aPjKaBMNlDvEndL+NR1BXhxO58BrQiTyzn4y/VYeGIsAjU2f/YdrtmsHtqFz29+XlPbCklSRiDxm9 HIm0w3zUxxMLCRNXaPBFaX4pYg7ljwq/HiJRXQmoFT54C3o523P7VICLUOa+yFjkSVuatKPrcxz5T d0INecJe5ZWW2An7EfoRsRa94RTf6Kox/bJlQDsJSSw9qQGEOYoqfQYBDHTBmI/+pGGeYwLvWN1h5 sfElQk/DF604OGUP9YR0sRTLeVtJ4qmo4f8Fo37gSW+VUiH6okwESf9H7s4bGMb7QmIdOJcLAUyS8 EsNbObLg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXS-002nYK-I1; Sun, 08 May 2022 20:29:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 09/25] fs: Remove AOP_FLAG_NOFS Date: Sun, 8 May 2022 21:29:25 +0100 Message-Id: <20220508202941.667024-10-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org With all users of this flag gone, we can stop testing whether it's set. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/netfs/buffered_read.c | 6 +----- include/linux/fs.h | 4 ---- mm/folio-compat.c | 2 -- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c index 281a88a5b8dc..65c17c5a5567 100644 --- a/fs/netfs/buffered_read.c +++ b/fs/netfs/buffered_read.c @@ -302,7 +302,6 @@ static bool netfs_skip_folio_read(struct folio *folio, loff_t pos, size_t len, * @mapping: The mapping to read from * @pos: File position at which the write will begin * @len: The length of the write (may extend beyond the end of the folio chosen) - * @aop_flags: AOP_* flags * @_folio: Where to put the resultant folio * @_fsdata: Place for the netfs to store a cookie * @@ -335,16 +334,13 @@ int netfs_write_begin(struct file *file, struct address_space *mapping, struct netfs_io_request *rreq; struct netfs_i_context *ctx = netfs_i_context(file_inode(file )); struct folio *folio; - unsigned int fgp_flags; + unsigned int fgp_flags = FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE; pgoff_t index = pos >> PAGE_SHIFT; int ret; DEFINE_READAHEAD(ractl, file, NULL, mapping, index); retry: - fgp_flags = FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE; - if (aop_flags & AOP_FLAG_NOFS) - fgp_flags |= FGP_NOFS; folio = __filemap_get_folio(mapping, index, fgp_flags, mapping_gfp_mask(mapping)); if (!folio) diff --git a/include/linux/fs.h b/include/linux/fs.h index e108aff23a28..f81bc5cbcbb6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -275,10 +275,6 @@ enum positive_aop_returns { AOP_TRUNCATED_PAGE = 0x80001, }; -#define AOP_FLAG_NOFS 0x0002 /* used by filesystem to direct - * helper code (eg buffer layer) - * to clear GFP_FS from alloc */ - /* * oh the beauties of C type declarations. */ diff --git a/mm/folio-compat.c b/mm/folio-compat.c index 46fa179e32fb..3e42ddb81918 100644 --- a/mm/folio-compat.c +++ b/mm/folio-compat.c @@ -135,8 +135,6 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping, { unsigned fgp_flags = FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE; - if (flags & AOP_FLAG_NOFS) - fgp_flags |= FGP_NOFS; return pagecache_get_page(mapping, index, fgp_flags, mapping_gfp_mask(mapping)); } From patchwork Sun May 8 20:29:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842804 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40730C433F5 for ; Sun, 8 May 2022 20:30:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232341AbiEHUeI (ORCPT ); Sun, 8 May 2022 16:34:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232176AbiEHUdv (ORCPT ); Sun, 8 May 2022 16:33:51 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65579E006 for ; Sun, 8 May 2022 13:30:00 -0700 (PDT) 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=XGk4D40/83Mk2b0xnEMti2TPyZ0SXFmKONNwBKO+QXQ=; b=A00SirJtJgZ0jj239+Q4w/FbcR N0/dPQCkBJDhe+UMCBpcFMDsFLgZTJ4YebFgfjqfak3g7LD13Vs0NyTSrwhUwheSOlSCb2+VkWZ9E YgnetXUHUgCU5BRvnwH66a8L9wP381toIOsvGD73tLNOqWJSX92yEnHlPKXDw3UFeBbLpvPQ6LxB4 HOcNve69z0DmvDwA9Zlv2JyRxeNmbqGnpjakhDC+gY/w7gHSVQ/nOyQmYw7NFqEn23ODEaHcU7/hF cxFxWfyQJdVey3+iZuT4c3kLXhyAQKf5+Dc/Qc7Ko5JsulDCJzydIGZspZBH0nYN/vuie2mApkr+9 RsK/Xeng==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXS-002nYM-KS; Sun, 08 May 2022 20:29:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 10/25] fs: Remove aop_flags parameter from netfs_write_begin() Date: Sun, 8 May 2022 21:29:26 +0100 Message-Id: <20220508202941.667024-11-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org There are no more aop flags left, so remove the parameter. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- Documentation/filesystems/netfs_library.rst | 1 - fs/9p/vfs_addr.c | 2 +- fs/afs/write.c | 2 +- fs/ceph/addr.c | 2 +- fs/netfs/buffered_read.c | 4 ++-- include/linux/netfs.h | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Documentation/filesystems/netfs_library.rst b/Documentation/filesystems/netfs_library.rst index 69f00179fdfe..d51c2a5ccf57 100644 --- a/Documentation/filesystems/netfs_library.rst +++ b/Documentation/filesystems/netfs_library.rst @@ -142,7 +142,6 @@ Three read helpers are provided:: struct address_space *mapping, loff_t pos, unsigned int len, - unsigned int flags, struct folio **_folio, void **_fsdata); diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index 501128188343..d311e68e21fd 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -275,7 +275,7 @@ static int v9fs_write_begin(struct file *filp, struct address_space *mapping, * file. We need to do this before we get a lock on the page in case * there's more than one writer competing for the same cache block. */ - retval = netfs_write_begin(filp, mapping, pos, len, flags, &folio, fsdata); + retval = netfs_write_begin(filp, mapping, pos, len, &folio, fsdata); if (retval < 0) return retval; diff --git a/fs/afs/write.c b/fs/afs/write.c index 4763132ca57e..af496c98d394 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -60,7 +60,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping, * file. We need to do this before we get a lock on the page in case * there's more than one writer competing for the same cache block. */ - ret = netfs_write_begin(file, mapping, pos, len, flags, &folio, fsdata); + ret = netfs_write_begin(file, mapping, pos, len, &folio, fsdata); if (ret < 0) return ret; diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index aa25bffd4823..415f0886bc25 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1318,7 +1318,7 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping, struct folio *folio = NULL; int r; - r = netfs_write_begin(file, inode->i_mapping, pos, len, 0, &folio, NULL); + r = netfs_write_begin(file, inode->i_mapping, pos, len, &folio, NULL); if (r == 0) folio_wait_fscache(folio); if (r < 0) { diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c index 65c17c5a5567..1d44509455a5 100644 --- a/fs/netfs/buffered_read.c +++ b/fs/netfs/buffered_read.c @@ -328,8 +328,8 @@ static bool netfs_skip_folio_read(struct folio *folio, loff_t pos, size_t len, * This is usable whether or not caching is enabled. */ int netfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned int len, unsigned int aop_flags, - struct folio **_folio, void **_fsdata) + loff_t pos, unsigned int len, struct folio **_folio, + void **_fsdata) { struct netfs_io_request *rreq; struct netfs_i_context *ctx = netfs_i_context(file_inode(file )); diff --git a/include/linux/netfs.h b/include/linux/netfs.h index c7bf1eaf51d5..1c29f317d907 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -276,7 +276,7 @@ struct readahead_control; extern void netfs_readahead(struct readahead_control *); extern int netfs_readpage(struct file *, struct page *); extern int netfs_write_begin(struct file *, struct address_space *, - loff_t, unsigned int, unsigned int, struct folio **, + loff_t, unsigned int, struct folio **, void **); extern void netfs_subreq_terminated(struct netfs_io_subrequest *, ssize_t, bool); From patchwork Sun May 8 20:29:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842808 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B276C433EF for ; Sun, 8 May 2022 20:30:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232349AbiEHUeM (ORCPT ); Sun, 8 May 2022 16:34:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232209AbiEHUdw (ORCPT ); Sun, 8 May 2022 16:33:52 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA545E009 for ; Sun, 8 May 2022 13:30:00 -0700 (PDT) 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=LOIGMDSQvqjbbLhfwrNoP8DhHNVzMWWPwJ1QHy+c/8o=; b=n6MES7Lz89TEoYVEjeTUkfRIwp ngYp2GaPKtLoEEW/Mu6RQp6tI7XFRWmliXuWXHxk2aA1ItLbiXsT+xXZKEG6Y6fkbgxXd2DCh3neK DUVOTuG2IksZNRJruEkF2KWQ6NFRIYT2DnU4qmRldVpdySI4JNy9taO9pNPyhxYR71LRVKfN3qGaY SjAvjdzqr7aJWtStObodG8sduMcAvmcdX2Gr23phTqSrV33ahzTUKswC/6e2fmpOevg1bh9IXM734 PwlBewWeqv6CtWN34UNEe/xf34g2/0O2mUdvZ8LCr8KipW8McuuJwZytyz7HjwdyaHqJwyfnDyH8J iCW4nxkA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXS-002nYS-PP; Sun, 08 May 2022 20:29:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 11/25] fs: Remove aop flags parameter from block_write_begin() Date: Sun, 8 May 2022 21:29:27 +0100 Message-Id: <20220508202941.667024-12-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org There are no more aop flags left, so remove the parameter. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- block/fops.c | 3 +-- fs/bfs/file.c | 3 +-- fs/buffer.c | 6 +++--- fs/ext2/inode.c | 3 +-- fs/minix/inode.c | 3 +-- fs/nilfs2/inode.c | 3 +-- fs/nilfs2/recovery.c | 2 +- fs/ntfs3/inode.c | 4 ++-- fs/omfs/file.c | 3 +-- fs/sysv/itree.c | 2 +- fs/udf/inode.c | 2 +- fs/ufs/inode.c | 3 +-- include/linux/buffer_head.h | 2 +- 13 files changed, 16 insertions(+), 23 deletions(-) diff --git a/block/fops.c b/block/fops.c index 9f2ecec406b0..b432756570c6 100644 --- a/block/fops.c +++ b/block/fops.c @@ -401,8 +401,7 @@ static int blkdev_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata) { - return block_write_begin(mapping, pos, len, flags, pagep, - blkdev_get_block); + return block_write_begin(mapping, pos, len, pagep, blkdev_get_block); } static int blkdev_write_end(struct file *file, struct address_space *mapping, diff --git a/fs/bfs/file.c b/fs/bfs/file.c index 03139344568f..9408f45225cb 100644 --- a/fs/bfs/file.c +++ b/fs/bfs/file.c @@ -174,8 +174,7 @@ static int bfs_write_begin(struct file *file, struct address_space *mapping, { int ret; - ret = block_write_begin(mapping, pos, len, flags, pagep, - bfs_get_block); + ret = block_write_begin(mapping, pos, len, pagep, bfs_get_block); if (unlikely(ret)) bfs_write_failed(mapping, pos + len); diff --git a/fs/buffer.c b/fs/buffer.c index 2b5561ae5d0b..4ec6eb03c0eb 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2104,13 +2104,13 @@ static int __block_commit_write(struct inode *inode, struct page *page, * The filesystem needs to handle block truncation upon failure. */ int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len, - unsigned flags, struct page **pagep, get_block_t *get_block) + struct page **pagep, get_block_t *get_block) { pgoff_t index = pos >> PAGE_SHIFT; struct page *page; int status; - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index, 0); if (!page) return -ENOMEM; @@ -2460,7 +2460,7 @@ int cont_write_begin(struct file *file, struct address_space *mapping, (*bytes)++; } - return block_write_begin(mapping, pos, len, flags, pagep, get_block); + return block_write_begin(mapping, pos, len, pagep, get_block); } EXPORT_SYMBOL(cont_write_begin); diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 52377a0ee735..97192932ea56 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -892,8 +892,7 @@ ext2_write_begin(struct file *file, struct address_space *mapping, { int ret; - ret = block_write_begin(mapping, pos, len, flags, pagep, - ext2_get_block); + ret = block_write_begin(mapping, pos, len, pagep, ext2_get_block); if (ret < 0) ext2_write_failed(mapping, pos + len); return ret; diff --git a/fs/minix/inode.c b/fs/minix/inode.c index f1a6610e4ee6..5e8d7ba661cf 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -428,8 +428,7 @@ static int minix_write_begin(struct file *file, struct address_space *mapping, { int ret; - ret = block_write_begin(mapping, pos, len, flags, pagep, - minix_get_block); + ret = block_write_begin(mapping, pos, len, pagep, minix_get_block); if (unlikely(ret)) minix_write_failed(mapping, pos + len); diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 6045cea21f52..be09a0d10f04 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -258,8 +258,7 @@ static int nilfs_write_begin(struct file *file, struct address_space *mapping, if (unlikely(err)) return err; - err = block_write_begin(mapping, pos, len, flags, pagep, - nilfs_get_block); + err = block_write_begin(mapping, pos, len, pagep, nilfs_get_block); if (unlikely(err)) { nilfs_write_failed(mapping, pos + len); nilfs_transaction_abort(inode->i_sb); diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c index 9e2ed76c0f25..0955b657938f 100644 --- a/fs/nilfs2/recovery.c +++ b/fs/nilfs2/recovery.c @@ -511,7 +511,7 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs, pos = rb->blkoff << inode->i_blkbits; err = block_write_begin(inode->i_mapping, pos, blocksize, - 0, &page, nilfs_get_block); + &page, nilfs_get_block); if (unlikely(err)) { loff_t isize = inode->i_size; diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 9eab11e3b034..3914138fd8ba 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -894,7 +894,7 @@ static int ntfs_write_begin(struct file *file, struct address_space *mapping, goto out; } - err = block_write_begin(mapping, pos, len, flags, pagep, + err = block_write_begin(mapping, pos, len, pagep, ntfs_get_block_write_begin); out: @@ -975,7 +975,7 @@ int reset_log_file(struct inode *inode) len = pos + PAGE_SIZE > log_size ? (log_size - pos) : PAGE_SIZE; - err = block_write_begin(mapping, pos, len, 0, &page, + err = block_write_begin(mapping, pos, len, &page, ntfs_get_block_write_begin); if (err) goto out; diff --git a/fs/omfs/file.c b/fs/omfs/file.c index 3f297b541713..349b96d89c44 100644 --- a/fs/omfs/file.c +++ b/fs/omfs/file.c @@ -321,8 +321,7 @@ static int omfs_write_begin(struct file *file, struct address_space *mapping, { int ret; - ret = block_write_begin(mapping, pos, len, flags, pagep, - omfs_get_block); + ret = block_write_begin(mapping, pos, len, pagep, omfs_get_block); if (unlikely(ret)) omfs_write_failed(mapping, pos + len); diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c index 409ab5e17803..96b7fd4facf3 100644 --- a/fs/sysv/itree.c +++ b/fs/sysv/itree.c @@ -482,7 +482,7 @@ static int sysv_write_begin(struct file *file, struct address_space *mapping, { int ret; - ret = block_write_begin(mapping, pos, len, flags, pagep, get_block); + ret = block_write_begin(mapping, pos, len, pagep, get_block); if (unlikely(ret)) sysv_write_failed(mapping, pos + len); diff --git a/fs/udf/inode.c b/fs/udf/inode.c index ca4fa710e562..88a95886ce8a 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -209,7 +209,7 @@ static int udf_write_begin(struct file *file, struct address_space *mapping, { int ret; - ret = block_write_begin(mapping, pos, len, flags, pagep, udf_get_block); + ret = block_write_begin(mapping, pos, len, pagep, udf_get_block); if (unlikely(ret)) udf_write_failed(mapping, pos + len); return ret; diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index d0dda01620f0..bd0e0c66f93d 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c @@ -500,8 +500,7 @@ static int ufs_write_begin(struct file *file, struct address_space *mapping, { int ret; - ret = block_write_begin(mapping, pos, len, flags, pagep, - ufs_getfrag_block); + ret = block_write_begin(mapping, pos, len, pagep, ufs_getfrag_block); if (unlikely(ret)) ufs_write_failed(mapping, pos + len); diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index bcb4fe9b8575..63e49dfa7738 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -226,7 +226,7 @@ int __block_write_full_page(struct inode *inode, struct page *page, int block_read_full_page(struct page*, get_block_t*); bool block_is_partially_uptodate(struct folio *, size_t from, size_t count); int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len, - unsigned flags, struct page **pagep, get_block_t *get_block); + struct page **pagep, get_block_t *get_block); int __block_write_begin(struct page *page, loff_t pos, unsigned len, get_block_t *get_block); int block_write_end(struct file *, struct address_space *, From patchwork Sun May 8 20:29:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842806 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64B72C433F5 for ; Sun, 8 May 2022 20:30:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232345AbiEHUeK (ORCPT ); Sun, 8 May 2022 16:34:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232203AbiEHUdw (ORCPT ); Sun, 8 May 2022 16:33:52 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABFB9E018 for ; Sun, 8 May 2022 13:30:00 -0700 (PDT) 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=H5CtA24JAJu+NBwusxxz2cXtqAyK3BgCY38iwuz6yt8=; b=IiN2cEHBSpsAz5TZ4NbbmYXuva dY5xC4MjUcP6uUh83ArMlOHM9hkETDP3MsaKtFc4Lz2aiKW/IOlTt2HYH0EIFYmoDX3VzdUH2Etkt PQF933S+G5QgY84WYPYAZb203DKmadlGnft+jkQkA6MkvkltI4epBD5YqsiM/dskTfntj+0W2H59C 4XKuTG/d5S/C69CgGNc++NKQl4qsnF+2aK3Z1uX4cwAYhMidF1+8QiZ8aiPAZTEYRC4/SYB56YcYu 9mveRrgrKkNhRAgGXHEWNmh7lcOSWWKadIZOgtOdT8lRFmDZXhilX07U0HsYE2ncQLNffDR6+ZyxV lJ5xcxPw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXS-002nYf-WA; Sun, 08 May 2022 20:29:59 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 12/25] fs: Remove aop flags parameter from cont_write_begin() Date: Sun, 8 May 2022 21:29:28 +0100 Message-Id: <20220508202941.667024-13-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org There are no more aop flags left, so remove the parameter. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/adfs/inode.c | 2 +- fs/affs/file.c | 2 +- fs/buffer.c | 2 +- fs/exfat/inode.c | 2 +- fs/fat/inode.c | 2 +- fs/hfs/inode.c | 2 +- fs/hfsplus/inode.c | 2 +- fs/hpfs/file.c | 2 +- include/linux/buffer_head.h | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c index 561bc748c04a..b6912496bb19 100644 --- a/fs/adfs/inode.c +++ b/fs/adfs/inode.c @@ -58,7 +58,7 @@ static int adfs_write_begin(struct file *file, struct address_space *mapping, int ret; *pagep = NULL; - ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, + ret = cont_write_begin(file, mapping, pos, len, pagep, fsdata, adfs_get_block, &ADFS_I(mapping->host)->mmu_private); if (unlikely(ret)) diff --git a/fs/affs/file.c b/fs/affs/file.c index b3f81d84ff4c..704911d6aeba 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c @@ -420,7 +420,7 @@ static int affs_write_begin(struct file *file, struct address_space *mapping, int ret; *pagep = NULL; - ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, + ret = cont_write_begin(file, mapping, pos, len, pagep, fsdata, affs_get_block, &AFFS_I(mapping->host)->mmu_private); if (unlikely(ret)) diff --git a/fs/buffer.c b/fs/buffer.c index 4ec6eb03c0eb..fb97646d1977 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2441,7 +2441,7 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping, * We may have to extend the file. */ int cont_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata, get_block_t *get_block, loff_t *bytes) { diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index fc0ea1684880..8ed3c4b700cd 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -395,7 +395,7 @@ static int exfat_write_begin(struct file *file, struct address_space *mapping, int ret; *pagep = NULL; - ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, + ret = cont_write_begin(file, mapping, pos, len, pagep, fsdata, exfat_get_block, &EXFAT_I(mapping->host)->i_size_ondisk); diff --git a/fs/fat/inode.c b/fs/fat/inode.c index bf6051bdf1d1..9b34ccef2501 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -232,7 +232,7 @@ static int fat_write_begin(struct file *file, struct address_space *mapping, int err; *pagep = NULL; - err = cont_write_begin(file, mapping, pos, len, flags, + err = cont_write_begin(file, mapping, pos, len, pagep, fsdata, fat_get_block, &MSDOS_I(mapping->host)->mmu_private); if (err < 0) diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 55f45e9b4930..396735dd3407 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -56,7 +56,7 @@ static int hfs_write_begin(struct file *file, struct address_space *mapping, int ret; *pagep = NULL; - ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, + ret = cont_write_begin(file, mapping, pos, len, pagep, fsdata, hfs_get_block, &HFS_I(mapping->host)->phys_size); if (unlikely(ret)) diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 446a816aa8e1..435b6202532a 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -50,7 +50,7 @@ static int hfsplus_write_begin(struct file *file, struct address_space *mapping, int ret; *pagep = NULL; - ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, + ret = cont_write_begin(file, mapping, pos, len, pagep, fsdata, hfsplus_get_block, &HFSPLUS_I(mapping->host)->phys_size); if (unlikely(ret)) diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index 99493a23c5d0..8740b4ea0b52 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c @@ -200,7 +200,7 @@ static int hpfs_write_begin(struct file *file, struct address_space *mapping, int ret; *pagep = NULL; - ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, + ret = cont_write_begin(file, mapping, pos, len, pagep, fsdata, hpfs_get_block, &hpfs_i(mapping->host)->mmu_private); if (unlikely(ret)) diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 63e49dfa7738..127b60fad77e 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -238,7 +238,7 @@ int generic_write_end(struct file *, struct address_space *, void page_zero_new_buffers(struct page *page, unsigned from, unsigned to); void clean_page_buffers(struct page *page); int cont_write_begin(struct file *, struct address_space *, loff_t, - unsigned, unsigned, struct page **, void **, + unsigned, struct page **, void **, get_block_t *, loff_t *); int generic_cont_expand_simple(struct inode *inode, loff_t size); int block_commit_write(struct page *page, unsigned from, unsigned to); From patchwork Sun May 8 20:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842810 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD42DC433FE for ; Sun, 8 May 2022 20:30:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232373AbiEHUeQ (ORCPT ); Sun, 8 May 2022 16:34:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232226AbiEHUdx (ORCPT ); Sun, 8 May 2022 16:33:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4230E02D for ; Sun, 8 May 2022 13:30:00 -0700 (PDT) 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=O6jon2wZcOuRWNjQMdKziInEpsy1o/Bcpi2Jw+DC7f0=; b=wBIdl6O7hDmhFDU8KZYs2Mr8OW pvfnEqigB2Lpl/ap0VirsbflzgQA4Y5g8dvnucRT2ze6D68I8mZwDGi/o5mu8efGxyk43YQio1KlR 3/nMd9qgSKtdy4O/El+sGVpsqKWwPYYOPD+b2D1ZO1W+827WSIZqz4MGK4L2XOg3XhuNVHightBTj d9K+FgcJ25YpDFdyawsDEuKTAjEbGVwCD8HMHga+s4yxPXnWE1EonKOFjVst7sFvGqFyXAQBMFMZ5 ve8HPfyvKy/CokVU8aHEjSRAyw1oUDfUuUwT3/yg+uHqiwG2Porn8eVgLb4PaTM5IDxKW+rFV9heW pNaNZLHA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXT-002nYn-3H; Sun, 08 May 2022 20:29:59 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 13/25] fs: Remove aop flags parameter from grab_cache_page_write_begin() Date: Sun, 8 May 2022 21:29:29 +0100 Message-Id: <20220508202941.667024-14-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org There are no more aop flags left, so remove the parameter. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/affs/file.c | 2 +- fs/buffer.c | 4 ++-- fs/cifs/file.c | 2 +- fs/ecryptfs/mmap.c | 2 +- fs/ext4/inline.c | 8 ++++---- fs/ext4/inode.c | 4 ++-- fs/ext4/move_extent.c | 4 ++-- fs/f2fs/f2fs.h | 2 +- fs/fuse/file.c | 4 ++-- fs/hostfs/hostfs_kern.c | 2 +- fs/jffs2/file.c | 2 +- fs/libfs.c | 2 +- fs/nfs/file.c | 2 +- fs/ntfs3/inode.c | 2 +- fs/orangefs/inode.c | 2 +- fs/reiserfs/inode.c | 2 +- fs/ubifs/file.c | 4 ++-- fs/udf/file.c | 2 +- include/linux/pagemap.h | 2 +- mm/folio-compat.c | 2 +- 20 files changed, 28 insertions(+), 28 deletions(-) diff --git a/fs/affs/file.c b/fs/affs/file.c index 704911d6aeba..06645d05c717 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c @@ -670,7 +670,7 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping } index = pos >> PAGE_SHIFT; - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM; *pagep = page; diff --git a/fs/buffer.c b/fs/buffer.c index fb97646d1977..01630218c75f 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2110,7 +2110,7 @@ int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len, struct page *page; int status; - page = grab_cache_page_write_begin(mapping, index, 0); + page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM; @@ -2591,7 +2591,7 @@ int nobh_write_begin(struct address_space *mapping, from = pos & (PAGE_SIZE - 1); to = from + len; - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM; *pagep = page; diff --git a/fs/cifs/file.c b/fs/cifs/file.c index d511a78383c3..91aeae7fced8 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -4695,7 +4695,7 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping, cifs_dbg(FYI, "write_begin from %lld len %d\n", (long long)pos, len); start: - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (!page) { rc = -ENOMEM; goto out; diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index 9ad61b582f07..84e399a921ad 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c @@ -272,7 +272,7 @@ static int ecryptfs_write_begin(struct file *file, loff_t prev_page_end_size; int rc = 0; - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM; *pagep = page; diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index b2ef5ba568bc..6d253edebf9f 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -563,7 +563,7 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping, /* We cannot recurse into the filesystem as the transaction is already * started */ flags = memalloc_nofs_save(); - page = grab_cache_page_write_begin(mapping, 0, 0); + page = grab_cache_page_write_begin(mapping, 0); memalloc_nofs_restore(flags); if (!page) { ret = -ENOMEM; @@ -692,7 +692,7 @@ int ext4_try_to_write_inline_data(struct address_space *mapping, goto out; flags = memalloc_nofs_save(); - page = grab_cache_page_write_begin(mapping, 0, 0); + page = grab_cache_page_write_begin(mapping, 0); memalloc_nofs_restore(flags); if (!page) { ret = -ENOMEM; @@ -852,7 +852,7 @@ static int ext4_da_convert_inline_data_to_extent(struct address_space *mapping, int ret = 0, inline_size; struct page *page; - page = grab_cache_page_write_begin(mapping, 0, 0); + page = grab_cache_page_write_begin(mapping, 0); if (!page) return -ENOMEM; @@ -946,7 +946,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, * is already started. */ flags = memalloc_nofs_save(); - page = grab_cache_page_write_begin(mapping, 0, 0); + page = grab_cache_page_write_begin(mapping, 0); memalloc_nofs_restore(flags); if (!page) { ret = -ENOMEM; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 01a55647c959..512d8143c765 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1171,7 +1171,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping, * the page (if needed) without using GFP_NOFS. */ retry_grab: - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM; unlock_page(page); @@ -2963,7 +2963,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping, } retry: - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM; diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 56f21272fb00..4172a7d22471 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -141,13 +141,13 @@ mext_page_double_lock(struct inode *inode1, struct inode *inode2, } flags = memalloc_nofs_save(); - page[0] = grab_cache_page_write_begin(mapping[0], index1, 0); + page[0] = grab_cache_page_write_begin(mapping[0], index1); if (!page[0]) { memalloc_nofs_restore(flags); return -ENOMEM; } - page[1] = grab_cache_page_write_begin(mapping[1], index2, 0); + page[1] = grab_cache_page_write_begin(mapping[1], index2); memalloc_nofs_restore(flags); if (!page[1]) { unlock_page(page[0]); diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 74929ade4b5e..18df53ef3d7e 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -2677,7 +2677,7 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping, return grab_cache_page(mapping, index); flags = memalloc_nofs_save(); - page = grab_cache_page_write_begin(mapping, index, 0); + page = grab_cache_page_write_begin(mapping, index); memalloc_nofs_restore(flags); return page; diff --git a/fs/fuse/file.c b/fs/fuse/file.c index f18d14d5fea1..e35e394264ad 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1174,7 +1174,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia, break; err = -ENOMEM; - page = grab_cache_page_write_begin(mapping, index, 0); + page = grab_cache_page_write_begin(mapping, index); if (!page) break; @@ -2284,7 +2284,7 @@ static int fuse_write_begin(struct file *file, struct address_space *mapping, WARN_ON(!fc->writeback_cache); - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (!page) goto error; diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 14f9ac973a2e..2bfd316e1bf1 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -468,7 +468,7 @@ static int hostfs_write_begin(struct file *file, struct address_space *mapping, { pgoff_t index = pos >> PAGE_SHIFT; - *pagep = grab_cache_page_write_begin(mapping, index, flags); + *pagep = grab_cache_page_write_begin(mapping, index); if (!*pagep) return -ENOMEM; return 0; diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index bd7d58d27bfc..142d3ba9f0a8 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c @@ -213,7 +213,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, * page in read_cache_page(), which causes a deadlock. */ mutex_lock(&c->alloc_sem); - pg = grab_cache_page_write_begin(mapping, index, flags); + pg = grab_cache_page_write_begin(mapping, index); if (!pg) { ret = -ENOMEM; goto release_sem; diff --git a/fs/libfs.c b/fs/libfs.c index e64bdedef168..d4395e1c6696 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -557,7 +557,7 @@ int simple_write_begin(struct file *file, struct address_space *mapping, index = pos >> PAGE_SHIFT; - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM; diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 150b7fa8f0a7..d66088dd33e7 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -325,7 +325,7 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping, file, mapping->host->i_ino, len, (long long) pos); start: - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM; *pagep = page; diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 3914138fd8ba..16466c8648f3 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -872,7 +872,7 @@ static int ntfs_write_begin(struct file *file, struct address_space *mapping, *pagep = NULL; if (is_resident(ni)) { struct page *page = grab_cache_page_write_begin( - mapping, pos >> PAGE_SHIFT, flags); + mapping, pos >> PAGE_SHIFT); if (!page) { err = -ENOMEM; diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 79c1025d18ea..809690db8be2 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -338,7 +338,7 @@ static int orangefs_write_begin(struct file *file, index = pos >> PAGE_SHIFT; - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM; diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 36c59b25486c..aa31cf1dbba6 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c @@ -2764,7 +2764,7 @@ static int reiserfs_write_begin(struct file *file, inode = mapping->host; index = pos >> PAGE_SHIFT; - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM; *pagep = page; diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 0383fbdc95ff..0911fc311434 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -244,7 +244,7 @@ static int write_begin_slow(struct address_space *mapping, if (unlikely(err)) return err; - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (unlikely(!page)) { ubifs_release_budget(c, &req); return -ENOMEM; @@ -437,7 +437,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping, return -EROFS; /* Try out the fast-path part first */ - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (unlikely(!page)) return -ENOMEM; diff --git a/fs/udf/file.c b/fs/udf/file.c index 0f6bf2504437..724bb3141fda 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c @@ -94,7 +94,7 @@ static int udf_adinicb_write_begin(struct file *file, if (WARN_ON_ONCE(pos >= PAGE_SIZE)) return -EIO; - page = grab_cache_page_write_begin(mapping, 0, flags); + page = grab_cache_page_write_begin(mapping, 0); if (!page) return -ENOMEM; *pagep = page; diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 993994cd943a..65ae8f96554b 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -735,7 +735,7 @@ static inline unsigned find_get_pages_tag(struct address_space *mapping, } struct page *grab_cache_page_write_begin(struct address_space *mapping, - pgoff_t index, unsigned flags); + pgoff_t index); /* * Returns locked page at given index in given cache, creating it if needed. diff --git a/mm/folio-compat.c b/mm/folio-compat.c index 3e42ddb81918..20bc15b57d93 100644 --- a/mm/folio-compat.c +++ b/mm/folio-compat.c @@ -131,7 +131,7 @@ struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index, EXPORT_SYMBOL(pagecache_get_page); struct page *grab_cache_page_write_begin(struct address_space *mapping, - pgoff_t index, unsigned flags) + pgoff_t index) { unsigned fgp_flags = FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE; From patchwork Sun May 8 20:29:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842807 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4D4FC433EF for ; Sun, 8 May 2022 20:30:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232348AbiEHUeM (ORCPT ); Sun, 8 May 2022 16:34:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232213AbiEHUdw (ORCPT ); Sun, 8 May 2022 16:33:52 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 018EADFEA for ; Sun, 8 May 2022 13:30:00 -0700 (PDT) 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=j+3bGVW2lhzCFFuW8GzV5oNJ7nLQ6ySvvt58EVwwUTQ=; b=qWHbXGKfdXXyfRsNIK6gTPSpVu KFhPUrWBbpi38W4kZQ/2e1LS4jQZ+x1pFYhoZEAgR6HdG3+28mUCESV778EK8le8I3JQkmM10hz5G smsT6HsEVfnsg7hWKOtyt7woUwjuh24HszIKpNsEBAvTaQr6oMwv7F+NCqhFDkD5G3cGLODkjE3/I RXClbsMW7HcQ87XBy0KK5OD1EpZoSNg2dnSEwTuORvrnWd4JWBe7Lxb2A+LIk3RmJtxWo5Tlb59y+ YEL61CdyGOtOuXoz76Z2cxNJa5TmWtx5MK2MHZze2eJpZuMG97dqzOYhA5M/fMwuuMu1S3nOprwQx u4wb9S2A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXT-002nYt-6f; Sun, 08 May 2022 20:29:59 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 14/25] fs: Remove aop flags parameter from nobh_write_begin() Date: Sun, 8 May 2022 21:29:30 +0100 Message-Id: <20220508202941.667024-15-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org There are no more aop flags left, so remove the parameter. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/buffer.c | 3 +-- fs/ext2/inode.c | 2 +- fs/jfs/inode.c | 3 +-- include/linux/buffer_head.h | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 01630218c75f..02b50e3e4fbb 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2568,8 +2568,7 @@ static void attach_nobh_buffers(struct page *page, struct buffer_head *head) * On exit the page is fully uptodate in the areas outside (from,to) * The filesystem needs to handle block truncation upon failure. */ -int nobh_write_begin(struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, +int nobh_write_begin(struct address_space *mapping, loff_t pos, unsigned len, struct page **pagep, void **fsdata, get_block_t *get_block) { diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 97192932ea56..bfa69c52ce2c 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -917,7 +917,7 @@ ext2_nobh_write_begin(struct file *file, struct address_space *mapping, { int ret; - ret = nobh_write_begin(mapping, pos, len, flags, pagep, fsdata, + ret = nobh_write_begin(mapping, pos, len, pagep, fsdata, ext2_get_block); if (ret < 0) ext2_write_failed(mapping, pos + len); diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index d1943a7b4b04..e16f77b4e84c 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c @@ -319,8 +319,7 @@ static int jfs_write_begin(struct file *file, struct address_space *mapping, { int ret; - ret = nobh_write_begin(mapping, pos, len, flags, pagep, fsdata, - jfs_get_block); + ret = nobh_write_begin(mapping, pos, len, pagep, fsdata, jfs_get_block); if (unlikely(ret)) jfs_write_failed(mapping, pos + len); diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 127b60fad77e..6e5a64005fef 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -258,7 +258,7 @@ static inline vm_fault_t block_page_mkwrite_return(int err) } sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); int block_truncate_page(struct address_space *, loff_t, get_block_t *); -int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned, +int nobh_write_begin(struct address_space *, loff_t, unsigned len, struct page **, void **, get_block_t*); int nobh_write_end(struct file *, struct address_space *, loff_t, unsigned, unsigned, From patchwork Sun May 8 20:29:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842816 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80650C433F5 for ; Sun, 8 May 2022 20:30:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232412AbiEHUeZ (ORCPT ); Sun, 8 May 2022 16:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232258AbiEHUdz (ORCPT ); Sun, 8 May 2022 16:33:55 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1323BDFFD for ; Sun, 8 May 2022 13:30:01 -0700 (PDT) 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=PMMFqnfx33ltUl2cmgc1sH2zu3gIcFs97QY4wzRnWG4=; b=aFvI8YJ/b7slIe7ZJtK/T1KLBn FkZ0DDtSv+vD3Kzv1cGPoFZpn3mU0KM7akHIe95CWTCC0e01OZ84ZRROG1p4mLE5Ry0naFxqYN6Nx NqZ6uB91T3/lBib6THkqRYZ0EYngJgzn9aonADE5rsmfRqWTbOsQHgtdqB97oZ5U1bglshhqPAmPn 1fkPik15ejD110Vj/mTViydEamrvfvy11pc7aL3HAeq2VEl8yGiolIxM5pw4Qh8GKWH3KBF+A9x7V nqwT4WJe4hkfUKIW0dcxgry8IkxGcrqHpqtCPSzIg+9/7EAIc+zx3Ovpy3Nwgdvbkin9VofEdkE+i TbKxhWig==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXT-002nZ9-BI; Sun, 08 May 2022 20:29:59 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 15/25] fs: Remove flags parameter from aops->write_begin Date: Sun, 8 May 2022 21:29:31 +0100 Message-Id: <20220508202941.667024-16-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org There are no more aop flags left, so remove the parameter. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- Documentation/filesystems/locking.rst | 2 +- Documentation/filesystems/vfs.rst | 5 +---- block/fops.c | 3 +-- fs/9p/vfs_addr.c | 2 +- fs/adfs/inode.c | 2 +- fs/affs/file.c | 6 +++--- fs/afs/internal.h | 2 +- fs/afs/write.c | 2 +- fs/bfs/file.c | 2 +- fs/ceph/addr.c | 2 +- fs/cifs/file.c | 2 +- fs/ecryptfs/mmap.c | 2 +- fs/exfat/inode.c | 2 +- fs/ext2/inode.c | 6 ++---- fs/ext4/inode.c | 10 +++++----- fs/f2fs/data.c | 5 ++--- fs/f2fs/super.c | 2 +- fs/fat/inode.c | 2 +- fs/fuse/file.c | 3 +-- fs/hfs/inode.c | 2 +- fs/hfsplus/inode.c | 2 +- fs/hostfs/hostfs_kern.c | 2 +- fs/hpfs/file.c | 2 +- fs/hugetlbfs/inode.c | 2 +- fs/jffs2/file.c | 4 ++-- fs/jfs/inode.c | 2 +- fs/libfs.c | 2 +- fs/minix/inode.c | 2 +- fs/nfs/file.c | 2 +- fs/nilfs2/inode.c | 2 +- fs/ntfs3/inode.c | 2 +- fs/ocfs2/aops.c | 2 +- fs/omfs/file.c | 2 +- fs/orangefs/inode.c | 5 ++--- fs/reiserfs/inode.c | 2 +- fs/sysv/itree.c | 2 +- fs/ubifs/file.c | 7 +++---- fs/udf/file.c | 2 +- fs/udf/inode.c | 2 +- fs/ufs/inode.c | 2 +- include/linux/fs.h | 4 ++-- include/trace/events/ext4.h | 21 ++++++++------------- include/trace/events/f2fs.h | 12 ++++-------- mm/filemap.c | 6 ++---- mm/shmem.c | 2 +- 45 files changed, 69 insertions(+), 90 deletions(-) diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst index c26d854275a0..fd9d9caf09ab 100644 --- a/Documentation/filesystems/locking.rst +++ b/Documentation/filesystems/locking.rst @@ -242,7 +242,7 @@ prototypes:: bool (*dirty_folio)(struct address_space *, struct folio *folio); void (*readahead)(struct readahead_control *); int (*write_begin)(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata); int (*write_end)(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst index 794bd1a66bfb..30f303180a7d 100644 --- a/Documentation/filesystems/vfs.rst +++ b/Documentation/filesystems/vfs.rst @@ -727,7 +727,7 @@ cache in your filesystem. The following members are defined: bool (*dirty_folio)(struct address_space *, struct folio *); void (*readahead)(struct readahead_control *); int (*write_begin)(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata); int (*write_end)(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, @@ -832,9 +832,6 @@ cache in your filesystem. The following members are defined: passed to write_begin is greater than the number of bytes copied into the page). - flags is a field for AOP_FLAG_xxx flags, described in - include/linux/fs.h. - A void * may be returned in fsdata, which then gets passed into write_end. diff --git a/block/fops.c b/block/fops.c index b432756570c6..712affe56e29 100644 --- a/block/fops.c +++ b/block/fops.c @@ -398,8 +398,7 @@ static void blkdev_readahead(struct readahead_control *rac) } static int blkdev_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, struct page **pagep, - void **fsdata) + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { return block_write_begin(mapping, pos, len, pagep, blkdev_get_block); } diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index d311e68e21fd..a2d57112f53e 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -260,7 +260,7 @@ v9fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) } static int v9fs_write_begin(struct file *filp, struct address_space *mapping, - loff_t pos, unsigned int len, unsigned int flags, + loff_t pos, unsigned int len, struct page **subpagep, void **fsdata) { int retval; diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c index b6912496bb19..f7959b1a2d52 100644 --- a/fs/adfs/inode.c +++ b/fs/adfs/inode.c @@ -52,7 +52,7 @@ static void adfs_write_failed(struct address_space *mapping, loff_t to) } static int adfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/affs/file.c b/fs/affs/file.c index 06645d05c717..b952f65c3f06 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c @@ -414,7 +414,7 @@ affs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) } static int affs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; @@ -650,7 +650,7 @@ affs_readpage_ofs(struct file *file, struct page *page) } static int affs_write_begin_ofs(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { struct inode *inode = mapping->host; @@ -887,7 +887,7 @@ affs_truncate(struct inode *inode) loff_t isize = inode->i_size; int res; - res = mapping->a_ops->write_begin(NULL, mapping, isize, 0, 0, &page, &fsdata); + res = mapping->a_ops->write_begin(NULL, mapping, isize, 0, &page, &fsdata); if (!res) res = mapping->a_ops->write_end(NULL, mapping, isize, 0, 0, page, fsdata); else diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 7b7ef945dc78..7a72e9c60423 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -1535,7 +1535,7 @@ bool afs_dirty_folio(struct address_space *, struct folio *); #define afs_dirty_folio filemap_dirty_folio #endif extern int afs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata); extern int afs_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, diff --git a/fs/afs/write.c b/fs/afs/write.c index af496c98d394..5224e346fbad 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -42,7 +42,7 @@ static void afs_folio_start_fscache(bool caching, struct folio *folio) * prepare to perform part of a write to a page */ int afs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **_page, void **fsdata) { struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); diff --git a/fs/bfs/file.c b/fs/bfs/file.c index 9408f45225cb..dc97c9b8f23b 100644 --- a/fs/bfs/file.c +++ b/fs/bfs/file.c @@ -169,7 +169,7 @@ static void bfs_write_failed(struct address_space *mapping, loff_t to) } static int bfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 415f0886bc25..e65541a51b68 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1311,7 +1311,7 @@ static int ceph_netfs_check_write_begin(struct file *file, loff_t pos, unsigned * clean, or already dirty within the same snap context. */ static int ceph_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned aop_flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { struct inode *inode = file_inode(file); diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 91aeae7fced8..da362b5a0c96 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -4681,7 +4681,7 @@ bool is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) } static int cifs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int oncethru = 0; diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index 84e399a921ad..47904d40ef88 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c @@ -264,7 +264,7 @@ static int fill_zeros_to_end_of_page(struct page *page, unsigned int to) */ static int ecryptfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { pgoff_t index = pos >> PAGE_SHIFT; diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index 8ed3c4b700cd..b9f63113db2d 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -389,7 +389,7 @@ static void exfat_write_failed(struct address_space *mapping, loff_t to) } static int exfat_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned int len, unsigned int flags, + loff_t pos, unsigned int len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index bfa69c52ce2c..d8ca8050945a 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -887,8 +887,7 @@ static void ext2_readahead(struct readahead_control *rac) static int ext2_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, - struct page **pagep, void **fsdata) + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; @@ -912,8 +911,7 @@ static int ext2_write_end(struct file *file, struct address_space *mapping, static int ext2_nobh_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, - struct page **pagep, void **fsdata) + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 512d8143c765..d3a7e8581291 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1130,7 +1130,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len, #endif static int ext4_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { struct inode *inode = mapping->host; @@ -1144,7 +1144,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping, if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) return -EIO; - trace_ext4_write_begin(inode, pos, len, flags); + trace_ext4_write_begin(inode, pos, len); /* * Reserve one block more for addition to orphan list in case * we allocate blocks but write fails for some reason @@ -2931,7 +2931,7 @@ static int ext4_nonda_switch(struct super_block *sb) } static int ext4_da_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret, retries = 0; @@ -2948,10 +2948,10 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping, ext4_verity_in_progress(inode)) { *fsdata = (void *)FALL_BACK_TO_NONDELALLOC; return ext4_write_begin(file, mapping, pos, - len, flags, pagep, fsdata); + len, pagep, fsdata); } *fsdata = (void *)0; - trace_ext4_da_write_begin(inode, pos, len, flags); + trace_ext4_da_write_begin(inode, pos, len); if (ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) { ret = ext4_da_write_inline_data_begin(mapping, inode, pos, len, diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 9a1a526f2092..b3cf49136b9f 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3314,8 +3314,7 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi, } static int f2fs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, - struct page **pagep, void **fsdata) + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { struct inode *inode = mapping->host; struct f2fs_sb_info *sbi = F2FS_I_SB(inode); @@ -3325,7 +3324,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, block_t blkaddr = NULL_ADDR; int err = 0; - trace_f2fs_write_begin(inode, pos, len, flags); + trace_f2fs_write_begin(inode, pos, len); if (!f2fs_is_checkpoint_ready(sbi)) { err = -ENOSPC; diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 4368f90571bd..ed3e8b7a8260 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2483,7 +2483,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type, tocopy = min_t(unsigned long, sb->s_blocksize - offset, towrite); retry: - err = a_ops->write_begin(NULL, mapping, off, tocopy, 0, + err = a_ops->write_begin(NULL, mapping, off, tocopy, &page, &fsdata); if (unlikely(err)) { if (err == -ENOMEM) { diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 9b34ccef2501..1f15b0fd1bb0 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -226,7 +226,7 @@ static void fat_write_failed(struct address_space *mapping, loff_t to) } static int fat_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int err; diff --git a/fs/fuse/file.c b/fs/fuse/file.c index e35e394264ad..bca8c2135ec5 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2273,8 +2273,7 @@ static int fuse_writepages(struct address_space *mapping, * but how to implement it without killing performance need more thinking. */ static int fuse_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, - struct page **pagep, void **fsdata) + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { pgoff_t index = pos >> PAGE_SHIFT; struct fuse_conn *fc = get_fuse_conn(file_inode(file)); diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 396735dd3407..93d9aa832139 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -50,7 +50,7 @@ static void hfs_write_failed(struct address_space *mapping, loff_t to) } static int hfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 435b6202532a..73010aa4623f 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -44,7 +44,7 @@ static void hfsplus_write_failed(struct address_space *mapping, loff_t to) } static int hfsplus_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 2bfd316e1bf1..e658d8edde35 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -463,7 +463,7 @@ static int hostfs_readpage(struct file *file, struct page *page) } static int hostfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { pgoff_t index = pos >> PAGE_SHIFT; diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index 8740b4ea0b52..8b590b3826c3 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c @@ -194,7 +194,7 @@ static void hpfs_write_failed(struct address_space *mapping, loff_t to) } static int hpfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index dd3a088db11d..2de9ca5d260d 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -383,7 +383,7 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to) static int hugetlbfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { return -EINVAL; diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index 142d3ba9f0a8..2b35811772de 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c @@ -25,7 +25,7 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *pg, void *fsdata); static int jffs2_write_begin(struct file *filp, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata); static int jffs2_readpage (struct file *filp, struct page *pg); @@ -130,7 +130,7 @@ static int jffs2_readpage (struct file *filp, struct page *pg) } static int jffs2_write_begin(struct file *filp, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { struct page *pg; diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index e16f77b4e84c..aa9f112107b2 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c @@ -314,7 +314,7 @@ static void jfs_write_failed(struct address_space *mapping, loff_t to) } static int jfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/libfs.c b/fs/libfs.c index d4395e1c6696..a1c10d3163e0 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -549,7 +549,7 @@ static int simple_readpage(struct file *file, struct page *page) } int simple_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { struct page *page; diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 5e8d7ba661cf..3add78bccedc 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -423,7 +423,7 @@ static void minix_write_failed(struct address_space *mapping, loff_t to) } static int minix_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/nfs/file.c b/fs/nfs/file.c index d66088dd33e7..314d2d7ba84a 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -313,7 +313,7 @@ static bool nfs_want_read_modify_write(struct file *file, struct page *page, * increment the page use counts until he is done with the page. */ static int nfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index be09a0d10f04..02297ec8dc55 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -248,7 +248,7 @@ void nilfs_write_failed(struct address_space *mapping, loff_t to) } static int nilfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 16466c8648f3..1364174cc6c9 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -862,7 +862,7 @@ static int ntfs_get_block_write_begin(struct inode *inode, sector_t vbn, } static int ntfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, u32 len, u32 flags, struct page **pagep, + loff_t pos, u32 len, struct page **pagep, void **fsdata) { int err; diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 4b9af65cb61b..7cffe9dcad17 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c @@ -1881,7 +1881,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, } static int ocfs2_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/omfs/file.c b/fs/omfs/file.c index 349b96d89c44..980b0a72c172 100644 --- a/fs/omfs/file.c +++ b/fs/omfs/file.c @@ -316,7 +316,7 @@ static void omfs_write_failed(struct address_space *mapping, loff_t to) } static int omfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 809690db8be2..bc7ccd15d7a3 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -326,9 +326,8 @@ static int orangefs_readpage(struct file *file, struct page *page) } static int orangefs_write_begin(struct file *file, - struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, struct page **pagep, - void **fsdata) + struct address_space *mapping, loff_t pos, unsigned len, + struct page **pagep, void **fsdata) { struct orangefs_write_range *wr; struct folio *folio; diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index aa31cf1dbba6..46ba4892030a 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c @@ -2753,7 +2753,7 @@ static void reiserfs_truncate_failed_write(struct inode *inode) static int reiserfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { struct inode *inode; diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c index 96b7fd4facf3..96ad24fe0ffb 100644 --- a/fs/sysv/itree.c +++ b/fs/sysv/itree.c @@ -477,7 +477,7 @@ static void sysv_write_failed(struct address_space *mapping, loff_t to) } static int sysv_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 0911fc311434..81c085c4decf 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -215,8 +215,7 @@ static void release_existing_page_budget(struct ubifs_info *c) } static int write_begin_slow(struct address_space *mapping, - loff_t pos, unsigned len, struct page **pagep, - unsigned flags) + loff_t pos, unsigned len, struct page **pagep) { struct inode *inode = mapping->host; struct ubifs_info *c = inode->i_sb->s_fs_info; @@ -419,7 +418,7 @@ static int allocate_budget(struct ubifs_info *c, struct page *page, * without forcing write-back. The slow path does not make this assumption. */ static int ubifs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { struct inode *inode = mapping->host; @@ -493,7 +492,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping, unlock_page(page); put_page(page); - return write_begin_slow(mapping, pos, len, pagep, flags); + return write_begin_slow(mapping, pos, len, pagep); } /* diff --git a/fs/udf/file.c b/fs/udf/file.c index 724bb3141fda..3f4d5c44c784 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c @@ -87,7 +87,7 @@ static int udf_adinicb_writepage(struct page *page, static int udf_adinicb_write_begin(struct file *file, struct address_space *mapping, loff_t pos, - unsigned len, unsigned flags, struct page **pagep, + unsigned len, struct page **pagep, void **fsdata) { struct page *page; diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 88a95886ce8a..866f9a53248e 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -204,7 +204,7 @@ static void udf_readahead(struct readahead_control *rac) } static int udf_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index bd0e0c66f93d..6c973b71cab2 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c @@ -495,7 +495,7 @@ static void ufs_write_failed(struct address_space *mapping, loff_t to) } static int ufs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; diff --git a/include/linux/fs.h b/include/linux/fs.h index f81bc5cbcbb6..a0e73432526f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -346,7 +346,7 @@ struct address_space_operations { void (*readahead)(struct readahead_control *); int (*write_begin)(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata); int (*write_end)(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, @@ -3179,7 +3179,7 @@ extern int noop_fsync(struct file *, loff_t, loff_t, int); extern ssize_t noop_direct_IO(struct kiocb *iocb, struct iov_iter *iter); extern int simple_empty(struct dentry *); extern int simple_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata); extern const struct address_space_operations ram_aops; extern int always_delete_dentry(const struct dentry *); diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index d06ffffad434..229e8fae66a3 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h @@ -335,17 +335,15 @@ TRACE_EVENT(ext4_begin_ordered_truncate, DECLARE_EVENT_CLASS(ext4__write_begin, - TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, - unsigned int flags), + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), - TP_ARGS(inode, pos, len, flags), + TP_ARGS(inode, pos, len), TP_STRUCT__entry( __field( dev_t, dev ) __field( ino_t, ino ) __field( loff_t, pos ) __field( unsigned int, len ) - __field( unsigned int, flags ) ), TP_fast_assign( @@ -353,29 +351,26 @@ DECLARE_EVENT_CLASS(ext4__write_begin, __entry->ino = inode->i_ino; __entry->pos = pos; __entry->len = len; - __entry->flags = flags; ), - TP_printk("dev %d,%d ino %lu pos %lld len %u flags %u", + TP_printk("dev %d,%d ino %lu pos %lld len %u", MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long) __entry->ino, - __entry->pos, __entry->len, __entry->flags) + __entry->pos, __entry->len) ); DEFINE_EVENT(ext4__write_begin, ext4_write_begin, - TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, - unsigned int flags), + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), - TP_ARGS(inode, pos, len, flags) + TP_ARGS(inode, pos, len) ); DEFINE_EVENT(ext4__write_begin, ext4_da_write_begin, - TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, - unsigned int flags), + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), - TP_ARGS(inode, pos, len, flags) + TP_ARGS(inode, pos, len) ); DECLARE_EVENT_CLASS(ext4__write_end, diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 1779e133cea0..bea654a85e6b 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -1159,17 +1159,15 @@ DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_write_bio, TRACE_EVENT(f2fs_write_begin, - TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, - unsigned int flags), + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), - TP_ARGS(inode, pos, len, flags), + TP_ARGS(inode, pos, len), TP_STRUCT__entry( __field(dev_t, dev) __field(ino_t, ino) __field(loff_t, pos) __field(unsigned int, len) - __field(unsigned int, flags) ), TP_fast_assign( @@ -1177,14 +1175,12 @@ TRACE_EVENT(f2fs_write_begin, __entry->ino = inode->i_ino; __entry->pos = pos; __entry->len = len; - __entry->flags = flags; ), - TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u", + TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u", show_dev_ino(__entry), (unsigned long long)__entry->pos, - __entry->len, - __entry->flags) + __entry->len) ); TRACE_EVENT(f2fs_write_end, diff --git a/mm/filemap.c b/mm/filemap.c index 9a1eef6c5d35..0751843b052f 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3628,8 +3628,7 @@ int pagecache_write_begin(struct file *file, struct address_space *mapping, { const struct address_space_operations *aops = mapping->a_ops; - return aops->write_begin(file, mapping, pos, len, flags, - pagep, fsdata); + return aops->write_begin(file, mapping, pos, len, pagep, fsdata); } EXPORT_SYMBOL(pagecache_write_begin); @@ -3754,7 +3753,6 @@ ssize_t generic_perform_write(struct kiocb *iocb, struct iov_iter *i) const struct address_space_operations *a_ops = mapping->a_ops; long status = 0; ssize_t written = 0; - unsigned int flags = 0; do { struct page *page; @@ -3784,7 +3782,7 @@ ssize_t generic_perform_write(struct kiocb *iocb, struct iov_iter *i) break; } - status = a_ops->write_begin(file, mapping, pos, bytes, flags, + status = a_ops->write_begin(file, mapping, pos, bytes, &page, &fsdata); if (unlikely(status < 0)) break; diff --git a/mm/shmem.c b/mm/shmem.c index 4b2fea33158e..0f557a512171 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2426,7 +2426,7 @@ static int shmem_initxattrs(struct inode *, const struct xattr *, void *); static int shmem_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { struct inode *inode = mapping->host; From patchwork Sun May 8 20:29:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842811 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB45BC433EF for ; Sun, 8 May 2022 20:30:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232386AbiEHUeS (ORCPT ); Sun, 8 May 2022 16:34:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232231AbiEHUdx (ORCPT ); Sun, 8 May 2022 16:33:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48A56BE3B for ; Sun, 8 May 2022 13:30:01 -0700 (PDT) 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=oLd3wKHQsLmOSk0JSxNhjkm90+f/xkzJtkJwMBQHoq0=; b=vO0IfepHEylDiH7ko4NaR8nOI6 LEY+/2/HDc6mt5eCRlEQPqoaL6ndZzutNTTT+3IGr8ZhuCqjlhLmqIUM6WZCWUgILf6eaWN7Q+cKe 8TAa0AFPO8I5lOK2IIQ8abyZ+BaQj+DW7372Fc7NWOQh6QpNjqxcSUi1ZDmgkolo700pQzoobwu1I W4xisYUJAu41hLKA/RSAOgEOTOZw0ulOIQq6bhOVE3Oghp853wkiR1svFMwy1FMvHKdq2rRkw7LSF rAroHW+zjdpsz/jlDvDODUTPe7B75hpgOkTwAF2TQ7U179sxjAq4AvALGwFwf/xufEQIPtchWpufw svWxg+sg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXT-002nZF-FP; Sun, 08 May 2022 20:29:59 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 16/25] buffer: Call aops write_begin() and write_end() directly Date: Sun, 8 May 2022 21:29:32 +0100 Message-Id: <20220508202941.667024-17-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org pagecache_write_begin() and pagecache_write_end() are now trivial wrappers, so call the aops directly. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/buffer.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 02b50e3e4fbb..d538495a0553 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2344,6 +2344,7 @@ EXPORT_SYMBOL(block_read_full_page); int generic_cont_expand_simple(struct inode *inode, loff_t size) { struct address_space *mapping = inode->i_mapping; + const struct address_space_operations *aops = mapping->a_ops; struct page *page; void *fsdata; int err; @@ -2352,11 +2353,11 @@ int generic_cont_expand_simple(struct inode *inode, loff_t size) if (err) goto out; - err = pagecache_write_begin(NULL, mapping, size, 0, 0, &page, &fsdata); + err = aops->write_begin(NULL, mapping, size, 0, &page, &fsdata); if (err) goto out; - err = pagecache_write_end(NULL, mapping, size, 0, 0, page, fsdata); + err = aops->write_end(NULL, mapping, size, 0, 0, page, fsdata); BUG_ON(err > 0); out: @@ -2368,6 +2369,7 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping, loff_t pos, loff_t *bytes) { struct inode *inode = mapping->host; + const struct address_space_operations *aops = mapping->a_ops; unsigned int blocksize = i_blocksize(inode); struct page *page; void *fsdata; @@ -2387,12 +2389,12 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping, } len = PAGE_SIZE - zerofrom; - err = pagecache_write_begin(file, mapping, curpos, len, 0, + err = aops->write_begin(file, mapping, curpos, len, &page, &fsdata); if (err) goto out; zero_user(page, zerofrom, len); - err = pagecache_write_end(file, mapping, curpos, len, len, + err = aops->write_end(file, mapping, curpos, len, len, page, fsdata); if (err < 0) goto out; @@ -2420,12 +2422,12 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping, } len = offset - zerofrom; - err = pagecache_write_begin(file, mapping, curpos, len, 0, + err = aops->write_begin(file, mapping, curpos, len, &page, &fsdata); if (err) goto out; zero_user(page, zerofrom, len); - err = pagecache_write_end(file, mapping, curpos, len, len, + err = aops->write_end(file, mapping, curpos, len, len, page, fsdata); if (err < 0) goto out; From patchwork Sun May 8 20:29:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842805 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0119C4332F for ; Sun, 8 May 2022 20:30:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232343AbiEHUeJ (ORCPT ); Sun, 8 May 2022 16:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232216AbiEHUdw (ORCPT ); Sun, 8 May 2022 16:33:52 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66C9EE03D for ; Sun, 8 May 2022 13:30:01 -0700 (PDT) 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=+GqAlDlRWXj80Ax3vG0u9Q+JlowyMcWhOuk9+WoV2qY=; b=ExfUcLbWh516vqSIPlQ3X4wNsY WXU0GCayPAle9szhx0/Sd4ajf1k3oARdJCtoO4RvUI8HZfWat56ie6OhD+eUOJEkAfG6mDXfiLjNd N6WU27NWGTIWBUmdhPRmhM8Cjc08CjzcZnJDp5qO+k6kYyLVDTszM3QfhQD7eH56hqciLSHipSnfm UChUESrIL8g1Gnn4EUjOpFAxcxzHMKO+U/DE9EsDJj8Sk9jkWF98Vpw0LRcV0mkeAq2qzfQqtlTnP GcjvbbUCWA668BMgaWdWmxP7qEIAA+yYHgRYsuPkknwfCnEn+GoXJER1WyQY1L+tr7tafJFdc+XI/ IkwN01BQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXT-002nZL-Ji; Sun, 08 May 2022 20:29:59 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 17/25] namei: Call aops write_begin() and write_end() directly Date: Sun, 8 May 2022 21:29:33 +0100 Message-Id: <20220508202941.667024-18-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org pagecache_write_begin() and pagecache_write_end() are now trivial wrappers, so call the aops directly. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/namei.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 0c84b4326dc9..896ade8b7400 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -5005,6 +5005,7 @@ EXPORT_SYMBOL(page_readlink); int page_symlink(struct inode *inode, const char *symname, int len) { struct address_space *mapping = inode->i_mapping; + const struct address_space_operations *aops = mapping->a_ops; bool nofs = !mapping_gfp_constraint(mapping, __GFP_FS); struct page *page; void *fsdata; @@ -5014,8 +5015,7 @@ int page_symlink(struct inode *inode, const char *symname, int len) retry: if (nofs) flags = memalloc_nofs_save(); - err = pagecache_write_begin(NULL, mapping, 0, len-1, - 0, &page, &fsdata); + err = aops->write_begin(NULL, mapping, 0, len-1, &page, &fsdata); if (nofs) memalloc_nofs_restore(flags); if (err) @@ -5023,7 +5023,7 @@ int page_symlink(struct inode *inode, const char *symname, int len) memcpy(page_address(page), symname, len-1); - err = pagecache_write_end(NULL, mapping, 0, len-1, len-1, + err = aops->write_end(NULL, mapping, 0, len-1, len-1, page, fsdata); if (err < 0) goto fail; From patchwork Sun May 8 20:29:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842817 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1689C433FE for ; Sun, 8 May 2022 20:30:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232442AbiEHUe1 (ORCPT ); Sun, 8 May 2022 16:34:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232236AbiEHUdx (ORCPT ); Sun, 8 May 2022 16:33:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4F5EE007 for ; Sun, 8 May 2022 13:30:01 -0700 (PDT) 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=THKc45Y586bLhWnb2Go9RYoSeaB0scQK9+hkIgkqsJg=; b=UQLmfAjruVk1DOXJlpOPmuPV2d sKNQUV0TlF7OMOS45bgUOW+SUDnbdbsCx+ma6L/x2EbHN9EduVnp/C9ifFBp3WGarlAF4P4y8qyjF dtmAQusRTxZhm81PMewGaz55uB9w78dTKA2EG182IMXcZ8O2ByaX6gtnu8r5O1+UgcG6y+oAumAbv KvIvHcfPPRRRXwIiF4nJX2KRI0f32iZeFoeOmBP53jnGaymsObTk9cQyOIBT0U7hWxPfZx3rxKXd+ pLByH7+aFEvYyBtBogqTIz1Ej9AxltfklL8C4a8cjjyz3D99cI0uWfYj2nsbanDKRtx/a0XdG+bgk RGjkG7Fg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXT-002nZR-O4; Sun, 08 May 2022 20:29:59 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Namjae Jeon , Christoph Hellwig Subject: [PATCH 18/25] ntfs3: Call ntfs_write_begin() and ntfs_write_end() directly Date: Sun, 8 May 2022 21:29:34 +0100 Message-Id: <20220508202941.667024-19-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org There is only one kind of write_begin/write_end aops, so we don't need to look up which aop it is, just make ntfs_write_begin() and ntfs_write_end() available to this file and call them directly. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Namjae Jeon Reviewed-by: Christoph Hellwig --- fs/ntfs3/file.c | 5 ++--- fs/ntfs3/inode.c | 12 +++++------- fs/ntfs3/ntfs_fs.h | 5 +++++ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index 787b53b984ee..c2e7e561958a 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -157,15 +157,14 @@ static int ntfs_extend_initialized_size(struct file *file, if (pos + len > new_valid) len = new_valid - pos; - err = pagecache_write_begin(file, mapping, pos, len, 0, &page, - &fsdata); + err = ntfs_write_begin(file, mapping, pos, len, &page, &fsdata); if (err) goto out; zero_user_segment(page, zerofrom, PAGE_SIZE); /* This function in any case puts page. */ - err = pagecache_write_end(file, mapping, pos, len, len, page, + err = ntfs_write_end(file, mapping, pos, len, len, page, fsdata); if (err < 0) goto out; diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 1364174cc6c9..bfd71f384e21 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -861,9 +861,8 @@ static int ntfs_get_block_write_begin(struct inode *inode, sector_t vbn, bh_result, create, GET_BLOCK_WRITE_BEGIN); } -static int ntfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, u32 len, struct page **pagep, - void **fsdata) +int ntfs_write_begin(struct file *file, struct address_space *mapping, + loff_t pos, u32 len, struct page **pagep, void **fsdata) { int err; struct inode *inode = mapping->host; @@ -904,10 +903,9 @@ static int ntfs_write_begin(struct file *file, struct address_space *mapping, /* * ntfs_write_end - Address_space_operations::write_end. */ -static int ntfs_write_end(struct file *file, struct address_space *mapping, - loff_t pos, u32 len, u32 copied, struct page *page, - void *fsdata) - +int ntfs_write_end(struct file *file, struct address_space *mapping, + loff_t pos, u32 len, u32 copied, struct page *page, + void *fsdata) { struct inode *inode = mapping->host; struct ntfs_inode *ni = ntfs_i(inode); diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index fb825059d488..8de129a6419b 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -689,6 +689,11 @@ int ntfs_set_size(struct inode *inode, u64 new_size); int reset_log_file(struct inode *inode); int ntfs_get_block(struct inode *inode, sector_t vbn, struct buffer_head *bh_result, int create); +int ntfs_write_begin(struct file *file, struct address_space *mapping, + loff_t pos, u32 len, struct page **pagep, void **fsdata); +int ntfs_write_end(struct file *file, struct address_space *mapping, + loff_t pos, u32 len, u32 copied, struct page *page, + void *fsdata); int ntfs3_write_inode(struct inode *inode, struct writeback_control *wbc); int ntfs_sync_inode(struct inode *inode); int ntfs_flush_inodes(struct super_block *sb, struct inode *i1, From patchwork Sun May 8 20:29:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842889 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AA2BC433EF for ; Sun, 8 May 2022 20:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232897AbiEHUgl (ORCPT ); Sun, 8 May 2022 16:36:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232306AbiEHUd6 (ORCPT ); Sun, 8 May 2022 16:33:58 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81169E006 for ; Sun, 8 May 2022 13:30:05 -0700 (PDT) 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=2Xve34hjRh2vFPByrJiJ2GP6eKReITIeVdbF5HgAW34=; b=B1FtpQNoobWNv/Fd0rIFxjaWMQ Js/P8SYJQDfx2mlfKdU87ICm/N0ZMlR85EohDzr/rg86vMHh1zhyglZRhdAdW8YCMNbvF84LDrDtD NtOGs5AKL/Kxpx9eKkCDqqGYuhD/RZf/hOAFF0zot4HdrQvE0YY+wlxrC6TkX+MbEbtYTMlumyPoN OQDIuMZ6qzSSg6jn5y1ODmaU2LxvdXZKHSbM1CfiousufNPsNvA5OBVq2SdEBDHZokFxyjnwB54PA fG0mBCCoLM103EvTLbleLex+E9AHgv4eX51oLNESlv9k1Yf/QuTBg+wyLxNi5DujyOyh0iHrA6PyK HaQJiieQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXT-002nZX-SC; Sun, 08 May 2022 20:29:59 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Dan Carpenter Subject: [PATCH 19/25] ntfs3: Remove fsdata parameter from ntfs_extend_initialized_size() Date: Sun, 8 May 2022 21:29:35 +0100 Message-Id: <20220508202941.667024-20-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org After the last patch, Smatch reports: fs/ntfs3/file.c:168 ntfs_extend_initialized_size() error: uninitialized symbol 'fsdata'. fsdata is indeed unused. This is not new, but Smatch couldn't see it before because calls through pagecache_write_begin()/pagecache_write_end() could theoretically call any implemention of ->write_begin/write_end, some of which do use fsdata. Now that the calls are direct, Smatch can see they're never used. Fix this by simply passing NULL. While ntfs3 does pass this parameter on to generic functions, those generic functions also never dereference the fsdata parameter, so it's unnecessary to pass the address of a real pointer. Reported-by: Dan Carpenter Signed-off-by: Matthew Wilcox (Oracle) --- fs/ntfs3/file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index c2e7e561958a..e61f335c9c63 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -115,7 +115,6 @@ static int ntfs_extend_initialized_size(struct file *file, for (;;) { u32 zerofrom, len; struct page *page; - void *fsdata; u8 bits; CLST vcn, lcn, clen; @@ -157,15 +156,14 @@ static int ntfs_extend_initialized_size(struct file *file, if (pos + len > new_valid) len = new_valid - pos; - err = ntfs_write_begin(file, mapping, pos, len, &page, &fsdata); + err = ntfs_write_begin(file, mapping, pos, len, &page, NULL); if (err) goto out; zero_user_segment(page, zerofrom, PAGE_SIZE); /* This function in any case puts page. */ - err = ntfs_write_end(file, mapping, pos, len, len, page, - fsdata); + err = ntfs_write_end(file, mapping, pos, len, len, page, NULL); if (err < 0) goto out; pos += len; From patchwork Sun May 8 20:29:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842813 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDBBEC433EF for ; Sun, 8 May 2022 20:30:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232398AbiEHUeU (ORCPT ); Sun, 8 May 2022 16:34:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232276AbiEHUdz (ORCPT ); Sun, 8 May 2022 16:33:55 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3602CE009 for ; Sun, 8 May 2022 13:30:03 -0700 (PDT) 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=xgg3hfFzmZXJAZ0Ce7ibjyyF9U0Uk00kS7JDxy/9M+o=; b=uLPYciElESQty1vYyYaVgCy4JR chbX58zP1/6+m9El++7kW6sGc3zr5wtoQgmrygp3X2c1ULJtkga9RZR+rIICzm3Ejsl1wtxITvXAh 5Fkf+PbNwZQPNz0VrAB2J514kNGL+StBoNR4xlUL+Og4BqN6dLg3OmojQV51NjN3NarQIxuzn6Zhu qnbv2a4kUnbnPIUxAolgW3btMx70Ue9HnYkbUTWPJs6K0rAp5R7tbOptPfQ2L6L0FQ2rSVdjLXwE8 CtB7wJfn9BoEsPxuoCej4eITRoS3DCijnDcvJ6NB5I3qoPf804ATManDx4/pCkTmMjwwpb1Fr/dGd BMD90FjA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXT-002nZd-VO; Sun, 08 May 2022 20:29:59 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 20/25] hfs: Call hfs_write_begin() and generic_write_end() directly Date: Sun, 8 May 2022 21:29:36 +0100 Message-Id: <20220508202941.667024-21-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org There is only one kind of write_begin/write_end aops, so we don't need to look up which aop it is, just make hfs_write_begin() available to this file and call it directly. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/hfs/extent.c | 6 +++--- fs/hfs/hfs_fs.h | 2 ++ fs/hfs/inode.c | 5 ++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c index 263d5028d9d1..3f7e9bef9874 100644 --- a/fs/hfs/extent.c +++ b/fs/hfs/extent.c @@ -491,10 +491,10 @@ void hfs_file_truncate(struct inode *inode) /* XXX: Can use generic_cont_expand? */ size = inode->i_size - 1; - res = pagecache_write_begin(NULL, mapping, size+1, 0, 0, - &page, &fsdata); + res = hfs_write_begin(NULL, mapping, size + 1, 0, &page, + &fsdata); if (!res) { - res = pagecache_write_end(NULL, mapping, size+1, 0, 0, + res = generic_write_end(NULL, mapping, size + 1, 0, 0, page, fsdata); } if (res) diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h index b8eb0322a3e5..68d0305880f7 100644 --- a/fs/hfs/hfs_fs.h +++ b/fs/hfs/hfs_fs.h @@ -201,6 +201,8 @@ extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int); extern const struct address_space_operations hfs_aops; extern const struct address_space_operations hfs_btree_aops; +int hfs_write_begin(struct file *file, struct address_space *mapping, + loff_t pos, unsigned len, struct page **pagep, void **fsdata); extern struct inode *hfs_new_inode(struct inode *, const struct qstr *, umode_t); extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *); extern int hfs_write_inode(struct inode *, struct writeback_control *); diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 93d9aa832139..9a26b9510da0 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -49,9 +49,8 @@ static void hfs_write_failed(struct address_space *mapping, loff_t to) } } -static int hfs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, - struct page **pagep, void **fsdata) +int hfs_write_begin(struct file *file, struct address_space *mapping, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; From patchwork Sun May 8 20:29:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842809 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87281C433F5 for ; Sun, 8 May 2022 20:30:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232045AbiEHUeP (ORCPT ); Sun, 8 May 2022 16:34:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232234AbiEHUdx (ORCPT ); Sun, 8 May 2022 16:33:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3AF5E006 for ; Sun, 8 May 2022 13:30:01 -0700 (PDT) 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=4AdYNoxSNYf1znHoghZsAbHVJkiPcg5j1cBHuf1ltuk=; b=NsOlI24So2HoTS7H6TKae/1N/R xyWQ278aizy7F3JyzNf6hpjszA9ZxJ79jsB+caj7XtVDVPsWn6qEZpwl5qQ187fwOPRWCiTvXiIPI z5gyZfnH6/FcS7UNbyEgtSp1gp9dcZluGPinLv4FcZuCtC/ZtfD4+MbyJCimIGN4B5Woviqc5vkam oucjCkvXfTu/3hIPnzqOGRKUmPoU0BICUFLPT4B3ayVGy6cz/i0+1671aNYCQMuaVoW41U52dq287 Uic/QBqd15scY/ec3iqYcQvRSp5nFKWlXRlJCnsRAeRiqrTvu2vJBR6xDJBealZqfz+w4jaadQd/m UuOWLirA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXU-002nZf-1Y; Sun, 08 May 2022 20:30:00 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 21/25] hfsplus: Call hfsplus_write_begin() and generic_write_end() directly Date: Sun, 8 May 2022 21:29:37 +0100 Message-Id: <20220508202941.667024-22-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org There is only one kind of write_begin/write_end aops, so we don't need to look up which aop it is, just make hfsplus_write_begin() available to this file and call it directly. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/hfsplus/extents.c | 8 ++++---- fs/hfsplus/hfsplus_fs.h | 2 ++ fs/hfsplus/inode.c | 5 ++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index 7054a542689f..721f779b4ec3 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c @@ -557,12 +557,12 @@ void hfsplus_file_truncate(struct inode *inode) void *fsdata; loff_t size = inode->i_size; - res = pagecache_write_begin(NULL, mapping, size, 0, 0, - &page, &fsdata); + res = hfsplus_write_begin(NULL, mapping, size, 0, + &page, &fsdata); if (res) return; - res = pagecache_write_end(NULL, mapping, size, - 0, 0, page, fsdata); + res = generic_write_end(NULL, mapping, size, 0, 0, + page, fsdata); if (res < 0) return; mark_inode_dirty(inode); diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index 1798949f269b..396e73aa0961 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h @@ -468,6 +468,8 @@ extern const struct address_space_operations hfsplus_aops; extern const struct address_space_operations hfsplus_btree_aops; extern const struct dentry_operations hfsplus_dentry_operations; +int hfsplus_write_begin(struct file *file, struct address_space *mapping, + loff_t pos, unsigned len, struct page **pagep, void **fsdata); struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir, umode_t mode); void hfsplus_delete_inode(struct inode *inode); diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 73010aa4623f..905ae3660315 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -43,9 +43,8 @@ static void hfsplus_write_failed(struct address_space *mapping, loff_t to) } } -static int hfsplus_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, - struct page **pagep, void **fsdata) +int hfsplus_write_begin(struct file *file, struct address_space *mapping, + loff_t pos, unsigned len, struct page **pagep, void **fsdata) { int ret; From patchwork Sun May 8 20:29:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842819 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95282C433EF for ; Sun, 8 May 2022 20:30:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232365AbiEHUed (ORCPT ); Sun, 8 May 2022 16:34:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232243AbiEHUdx (ORCPT ); Sun, 8 May 2022 16:33:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38870E08C for ; Sun, 8 May 2022 13:30:02 -0700 (PDT) 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=z232WyiFLUOa7PdfqmUYaKDHKWp0ty7SoxNoS8Kk2s0=; b=MWzsq7Inth8YVhXeR8j9FFde1m E7wRmvd8NuaS11q5qj2sctttW3voirDf0vYEWwbC+gViX52+lJb3VLw7NKd8Jm/cvAlX/uCsLzLAn l9B7Y2MUyUx0GAh0uLQghkLiZK5FPMkqk+RriEIDOblVTo+OUqNlNczGm5FhRpT8V9lBj91danTpQ ePjYnagqQ4JgMNAv7xtwT9HpQ6c1KCDaBTy2W4/VIhHupUFpmu6t0Tg801orjZ13lx6nZ2VmCFi/m 8FEHZeH3kAUd4BVrpGr+IAgrfCpK82lFwLtzh29ZyaQAZtQaCuQSgLuZMHCpo/2/LX5UinIseEv7D Rbcj3ljA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXU-002nZl-5e; Sun, 08 May 2022 20:30:00 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 22/25] ext4: Call aops write_begin() and write_end() directly Date: Sun, 8 May 2022 21:29:38 +0100 Message-Id: <20220508202941.667024-23-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org pagecache_write_begin() and pagecache_write_end() are now trivial wrappers, so call the aops directly. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/ext4/verity.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/ext4/verity.c b/fs/ext4/verity.c index eacbd489e3bf..b051d19b5c8a 100644 --- a/fs/ext4/verity.c +++ b/fs/ext4/verity.c @@ -69,6 +69,9 @@ static int pagecache_read(struct inode *inode, void *buf, size_t count, static int pagecache_write(struct inode *inode, const void *buf, size_t count, loff_t pos) { + struct address_space *mapping = inode->i_mapping; + const struct address_space_operations *aops = mapping->a_ops; + if (pos + count > inode->i_sb->s_maxbytes) return -EFBIG; @@ -79,15 +82,13 @@ static int pagecache_write(struct inode *inode, const void *buf, size_t count, void *fsdata; int res; - res = pagecache_write_begin(NULL, inode->i_mapping, pos, n, 0, - &page, &fsdata); + res = aops->write_begin(NULL, mapping, pos, n, &page, &fsdata); if (res) return res; memcpy_to_page(page, offset_in_page(pos), buf, n); - res = pagecache_write_end(NULL, inode->i_mapping, pos, n, n, - page, fsdata); + res = aops->write_end(NULL, mapping, pos, n, n, page, fsdata); if (res < 0) return res; if (res != n) From patchwork Sun May 8 20:29:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842812 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B9F9C433F5 for ; Sun, 8 May 2022 20:30:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232231AbiEHUeT (ORCPT ); Sun, 8 May 2022 16:34:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232287AbiEHUd5 (ORCPT ); Sun, 8 May 2022 16:33:57 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 406AEE018 for ; Sun, 8 May 2022 13:30:03 -0700 (PDT) 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=EY88G43WjdyudKh5Yl3ezx6267meKLzch+pMC3VXPRo=; b=FU4S4BN0aluO6eFlnP7j0Gzg8w ewxLxJ7ESnnn/Ut7J1N9nsOxaXmGU8PAecXRj5wSIsExIBEfjs3LC6rOSZXe5Zzi6B/vRDZy3vWAF ORN5mnEM3V2uk904yqNe+HMMs2CE1JwPKB2t8w5JiW53MvldW3yYD99/zSiZJmZJh9YwyFhyYaa7M tGD6riX7xnRIV1TMQpLaR1CHQ0A9p0ajBcsGwaG7yNYPyzxpwHmuK7X+DO3HsSTUPF5qWWewD3kls SJZRK9cD6zPXBv3u28D+KxdB8LpgkYznNd04yzWZsPs/y1l805cexD0tjA/BfGSNjl0lcOXjjBPFd tLJgz7OQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXU-002nZr-9h; Sun, 08 May 2022 20:30:00 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 23/25] f2fs: Call aops write_begin() and write_end() directly Date: Sun, 8 May 2022 21:29:39 +0100 Message-Id: <20220508202941.667024-24-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org pagecache_write_begin() and pagecache_write_end() are now trivial wrappers, so call the aops directly. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/f2fs/verity.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c index 3d793202cc9f..65395ae188aa 100644 --- a/fs/f2fs/verity.c +++ b/fs/f2fs/verity.c @@ -74,6 +74,9 @@ static int pagecache_read(struct inode *inode, void *buf, size_t count, static int pagecache_write(struct inode *inode, const void *buf, size_t count, loff_t pos) { + struct address_space *mapping = inode->i_mapping; + const struct address_space_operations *aops = mapping->a_ops; + if (pos + count > inode->i_sb->s_maxbytes) return -EFBIG; @@ -85,8 +88,7 @@ static int pagecache_write(struct inode *inode, const void *buf, size_t count, void *addr; int res; - res = pagecache_write_begin(NULL, inode->i_mapping, pos, n, 0, - &page, &fsdata); + res = aops->write_begin(NULL, mapping, pos, n, &page, &fsdata); if (res) return res; @@ -94,8 +96,7 @@ static int pagecache_write(struct inode *inode, const void *buf, size_t count, memcpy(addr + offset_in_page(pos), buf, n); kunmap_atomic(addr); - res = pagecache_write_end(NULL, inode->i_mapping, pos, n, n, - page, fsdata); + res = aops->write_end(NULL, mapping, pos, n, n, page, fsdata); if (res < 0) return res; if (res != n) From patchwork Sun May 8 20:29:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842818 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EED40C433F5 for ; Sun, 8 May 2022 20:30:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232454AbiEHUea (ORCPT ); Sun, 8 May 2022 16:34:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232253AbiEHUdx (ORCPT ); Sun, 8 May 2022 16:33:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F730E0B4 for ; Sun, 8 May 2022 13:30:02 -0700 (PDT) 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=Y7ANhKBEeOL+HpxLMBbN76BQItszULMjrcPRRXnozKI=; b=leYMjraW6pWHlJrncaJD0Vv/DS S+hX3WJD0IRBfG8Ut87eO0Rt6COr82vwP/UcEIT7EOgRK9yBl0OEfiKOoajoEVkAqlJUe1SxeSwXC eCBiatExw3V/IYsk8CwE+tugGv1jGF21aA6VJ6L34COh7gCd0NePL3jL5iGFLLICwHXb6FKJcvYnq gARC2ARVqJ3tm1XsNeJX1Rrxh4zLFYh9uBWFG21LySlKmmINe07SBVSg982ReZBQAaOqdYWp5eL8S kjAUAZC6yhEYKO8zfR5bCsrxwM0ajl5lXMzSWxRrKAvAsTsnHcce8CicNHArT3q8W0WKkjiTrdxxO 7ZGIwEBg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXU-002nZy-F7; Sun, 08 May 2022 20:30:00 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 24/25] i915: Call aops write_begin() and write_end() directly Date: Sun, 8 May 2022 21:29:40 +0100 Message-Id: <20220508202941.667024-25-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org pagecache_write_begin() and pagecache_write_end() are now trivial wrappers, so call the aops directly. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c index 3a1c782ed791..e92cc9d7257c 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c @@ -408,6 +408,7 @@ shmem_pwrite(struct drm_i915_gem_object *obj, const struct drm_i915_gem_pwrite *arg) { struct address_space *mapping = obj->base.filp->f_mapping; + const struct address_space_operations *aops = mapping->a_ops; char __user *user_data = u64_to_user_ptr(arg->data_ptr); u64 remain, offset; unsigned int pg; @@ -465,9 +466,8 @@ shmem_pwrite(struct drm_i915_gem_object *obj, if (err) return err; - err = pagecache_write_begin(obj->base.filp, mapping, - offset, len, 0, - &page, &data); + err = aops->write_begin(obj->base.filp, mapping, offset, len, + &page, &data); if (err < 0) return err; @@ -477,9 +477,8 @@ shmem_pwrite(struct drm_i915_gem_object *obj, len); kunmap_atomic(vaddr); - err = pagecache_write_end(obj->base.filp, mapping, - offset, len, len - unwritten, - page, data); + err = aops->write_end(obj->base.filp, mapping, offset, len, + len - unwritten, page, data); if (err < 0) return err; @@ -622,6 +621,7 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *dev_priv, { struct drm_i915_gem_object *obj; struct file *file; + const struct address_space_operations *aops; resource_size_t offset; int err; @@ -633,15 +633,15 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *dev_priv, GEM_BUG_ON(obj->write_domain != I915_GEM_DOMAIN_CPU); file = obj->base.filp; + aops = file->f_mapping->a_ops; offset = 0; do { unsigned int len = min_t(typeof(size), size, PAGE_SIZE); struct page *page; void *pgdata, *vaddr; - err = pagecache_write_begin(file, file->f_mapping, - offset, len, 0, - &page, &pgdata); + err = aops->write_begin(file, file->f_mapping, offset, len, + &page, &pgdata); if (err < 0) goto fail; @@ -649,9 +649,8 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *dev_priv, memcpy(vaddr, data, len); kunmap(page); - err = pagecache_write_end(file, file->f_mapping, - offset, len, len, - page, pgdata); + err = aops->write_end(file, file->f_mapping, offset, len, len, + page, pgdata); if (err < 0) goto fail; From patchwork Sun May 8 20:29:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12842890 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAE57C433F5 for ; Sun, 8 May 2022 20:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232902AbiEHUgn (ORCPT ); Sun, 8 May 2022 16:36:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232295AbiEHUd5 (ORCPT ); Sun, 8 May 2022 16:33:57 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 416CCE03D for ; Sun, 8 May 2022 13:30:03 -0700 (PDT) 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=mjyfBTpOJgCBlOyjPfFUjVzjlrihQGqwX4FhlGxYBRo=; b=Y1dxK57aYXMNMEA75aZHSm7ZDe MRfh+5b8AzD7HJWlGScFfyL8ywqi5vW+nRCeHzggNucYikeDkk6LZ5+y2ckCiSxRkGwOnszXN3tfg uF/007czMdtgjUGYsmt7f42ZWw+O8jT+xGb4ILA8vmGZnvcyHvBsFvuKiZb/g7ndr4v2QeFb8D5QV TH28S4IWPG0RtqaXXRFPZvzWHXWcFi97aVmObckYRkbLBDfttohptMGqfkL9XNE5bW8NSPYwnWQVJ 8uUs/JJULIK/zXT2aPoq4yZfqEA/Q5YV5zhhxMCWX9iIA5CFRj+a+IeYyCEtC/FsDxvrQ6THmO8gv dpqiL51w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnnXU-002na4-JA; Sun, 08 May 2022 20:30:00 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig Subject: [PATCH 25/25] fs: Remove pagecache_write_begin() and pagecache_write_end() Date: Sun, 8 May 2022 21:29:41 +0100 Message-Id: <20220508202941.667024-26-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220508202941.667024-1-willy@infradead.org> References: <20220508202941.667024-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org These wrappers have no more users; remove them. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- include/linux/fs.h | 12 ------------ mm/filemap.c | 20 -------------------- 2 files changed, 32 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index a0e73432526f..b35ce086a7a1 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -380,18 +380,6 @@ struct address_space_operations { extern const struct address_space_operations empty_aops; -/* - * pagecache_write_begin/pagecache_write_end must be used by general code - * to write into the pagecache. - */ -int pagecache_write_begin(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, - struct page **pagep, void **fsdata); - -int pagecache_write_end(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned copied, - struct page *page, void *fsdata); - /** * struct address_space - Contents of a cacheable, mappable object. * @host: Owner, either the inode or the block_device. diff --git a/mm/filemap.c b/mm/filemap.c index 0751843b052f..c15cfc28f9ce 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3622,26 +3622,6 @@ struct page *read_cache_page_gfp(struct address_space *mapping, } EXPORT_SYMBOL(read_cache_page_gfp); -int pagecache_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, - struct page **pagep, void **fsdata) -{ - const struct address_space_operations *aops = mapping->a_ops; - - return aops->write_begin(file, mapping, pos, len, pagep, fsdata); -} -EXPORT_SYMBOL(pagecache_write_begin); - -int pagecache_write_end(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned copied, - struct page *page, void *fsdata) -{ - const struct address_space_operations *aops = mapping->a_ops; - - return aops->write_end(file, mapping, pos, len, copied, page, fsdata); -} -EXPORT_SYMBOL(pagecache_write_end); - /* * Warn about a page cache invalidation failure during a direct I/O write. */