From patchwork Thu Dec 15 21:43:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13074559 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 8F83DC10F1E for ; Thu, 15 Dec 2022 21:44:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229793AbiLOVoI (ORCPT ); Thu, 15 Dec 2022 16:44:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229728AbiLOVoE (ORCPT ); Thu, 15 Dec 2022 16:44:04 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 221095C760 for ; Thu, 15 Dec 2022 13:44:00 -0800 (PST) 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=khJQ00oVdRi4Ce9uKr3QlH6vu2l+5ozsXEuEfKPCRzE=; b=jHNjcLMrc10jhoazTapdMyn5OJ nsOq5fpnYGvbpimYAi2Pmkv+1JYJ98lGaQf3xVWhZx4rInsQ0yeVPcT2aSQfKghkcmE2C6FYYvU58 HP6cnbA6+S4nJr/NJjlV2/BELo86wWtJx0Z5HPsswuuTNjaXM+SbY7vijoK3cLPKwpIQL0DiBi8sv Bi/rwaUiPat6BLfFnspMt8G4ydXxjsW0bRH+u2Q8cOufXctwTzDUy7W5yTH9T/UMGZtJvmlqmz6Uh ehddLXdODTU39Lk45ISndAyD9CJpO4mjcKDWYjSDmyqy2F48s9Dkit4PBPKXmlxwG5nOv9pUD/8ID FG4hZB0g==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5w1O-00EmL8-4p; Thu, 15 Dec 2022 21:44:06 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 01/12] buffer: Add b_folio as an alias of b_page Date: Thu, 15 Dec 2022 21:43:51 +0000 Message-Id: <20221215214402.3522366-2-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221215214402.3522366-1-willy@infradead.org> References: <20221215214402.3522366-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Buffer heads point to the allocation (ie the folio), not the page. This is currently the same thing for all filesystems that use buffer heads, so this is a safe transitional step. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/buffer_head.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 33fa5e94aa80..8f14dca5fed7 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -61,7 +61,10 @@ typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate); struct buffer_head { unsigned long b_state; /* buffer state bitmap (see above) */ struct buffer_head *b_this_page;/* circular list of page's buffers */ - struct page *b_page; /* the page this bh is mapped to */ + union { + struct page *b_page; /* the page this bh is mapped to */ + struct folio *b_folio; /* the folio this bh is mapped to */ + }; sector_t b_blocknr; /* start block number */ size_t b_size; /* size of mapping */ From patchwork Thu Dec 15 21:43:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13074566 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 01CDCC10F1E for ; Thu, 15 Dec 2022 21:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbiLOVoS (ORCPT ); Thu, 15 Dec 2022 16:44:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbiLOVoE (ORCPT ); Thu, 15 Dec 2022 16:44:04 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21DDA5C74B for ; Thu, 15 Dec 2022 13:44:00 -0800 (PST) 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=d4Jtz4zVUN9lysY3cHa9FMXu2AtjTw5WKWoJYsuMphg=; b=hi1RS1jwlkAAXN9uZGvcmwRl7/ TOcjb7x/iJmBbgjj9BWxZ8aUjK+IxwiTGvW8BRqMm/0iJqvkA5J6N0fvKxMZ3MxSugSE4xF2CYSOv v/xSgEnpNn2q/X7xG9oqH1BscecrH+TehIWL4lyFk7wcZXNFW5nWE1Z/Rs3fcLBxyobaZ1LzdbClv 9WXLcOqaLy8cHjp+gxLvM5SMPZpUxROO5ZzYc6t1ZvvXv6UcV74OvE8rKl760K1+1tAZnwug8vlAM YJlRucHKEuVlBaxPza5SMOANDiJoPIDeT8W3RuSfoCufnWpagO1X1Ntr/i9ixP9UpsXplIibw9ILb cnoEnqCQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5w1O-00EmLE-9B; Thu, 15 Dec 2022 21:44:06 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 02/12] buffer: Replace obvious uses of b_page with b_folio Date: Thu, 15 Dec 2022 21:43:52 +0000 Message-Id: <20221215214402.3522366-3-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221215214402.3522366-1-willy@infradead.org> References: <20221215214402.3522366-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org These cases just check if it's NULL, or use b_page to get to the page's address space. They are assumptions that b_page never points to a tail page. Signed-off-by: Matthew Wilcox (Oracle) --- fs/buffer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index d9c6d1fbb6dd..e1055fe0b366 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -321,7 +321,7 @@ static void end_buffer_async_read_io(struct buffer_head *bh, int uptodate) { /* Decrypt if needed */ if (uptodate && - fscrypt_inode_uses_fs_layer_crypto(bh->b_page->mapping->host)) { + fscrypt_inode_uses_fs_layer_crypto(bh->b_folio->mapping->host)) { struct decrypt_bh_ctx *ctx = kmalloc(sizeof(*ctx), GFP_ATOMIC); if (ctx) { @@ -570,7 +570,7 @@ void write_boundary_block(struct block_device *bdev, void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode) { struct address_space *mapping = inode->i_mapping; - struct address_space *buffer_mapping = bh->b_page->mapping; + struct address_space *buffer_mapping = bh->b_folio->mapping; mark_buffer_dirty(bh); if (!mapping->private_data) { @@ -1073,7 +1073,7 @@ __getblk_slow(struct block_device *bdev, sector_t block, * and then attach the address_space's inode to its superblock's dirty * inode list. * - * mark_buffer_dirty() is atomic. It takes bh->b_page->mapping->private_lock, + * mark_buffer_dirty() is atomic. It takes bh->b_folio->mapping->private_lock, * i_pages lock and mapping->host->i_lock. */ void mark_buffer_dirty(struct buffer_head *bh) @@ -1117,8 +1117,8 @@ void mark_buffer_write_io_error(struct buffer_head *bh) set_buffer_write_io_error(bh); /* FIXME: do we need to set this in both places? */ - if (bh->b_page && bh->b_page->mapping) - mapping_set_error(bh->b_page->mapping, -EIO); + if (bh->b_folio && bh->b_folio->mapping) + mapping_set_error(bh->b_folio->mapping, -EIO); if (bh->b_assoc_map) mapping_set_error(bh->b_assoc_map, -EIO); rcu_read_lock(); @@ -1154,7 +1154,7 @@ void __bforget(struct buffer_head *bh) { clear_buffer_dirty(bh); if (bh->b_assoc_map) { - struct address_space *buffer_mapping = bh->b_page->mapping; + struct address_space *buffer_mapping = bh->b_folio->mapping; spin_lock(&buffer_mapping->private_lock); list_del_init(&bh->b_assoc_buffers); From patchwork Thu Dec 15 21:43:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13074556 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 E019BC4332F for ; Thu, 15 Dec 2022 21:44:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229785AbiLOVoE (ORCPT ); Thu, 15 Dec 2022 16:44:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbiLOVoD (ORCPT ); Thu, 15 Dec 2022 16:44:03 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20493396F9 for ; Thu, 15 Dec 2022 13:44:00 -0800 (PST) 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=Dcm9/6g8BjFdXRPPxqIgd6WNImoV7y2C+AwRujEkEmY=; b=dq6sFbWRNpiuCWX5hHsKqpaIwk ZTaXLpEVMzKRxs5aiYPw4kQahQnup9T9OPEm1avIbxlmBvNaAg3agJs7hVXuaO8IfBWUAIkfd1Ae7 w82ykPwzxFBckW7CQ05zKyCpmPWE+Tp0weqpz9dI6mbeepSSbgmCEO3mVvoZ/srb5EOZpjfGe7iC6 uHAlTphrV35D0jtuw96yjdOjGI8o1qAYUE32wJJnjt0XDRRtpw9w6eEiRhnBDHos09l/XnU5rLIZl /0Vn5mzYmu0D/8ylsbNOevqX4iO7UuTGVQRJ+VEBGc8faQDUa3KRvLR8AJsGkt8A1y3Ds36gMgBwR S+sH3TmA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5w1O-00EmLK-DE; Thu, 15 Dec 2022 21:44:06 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 03/12] buffer: Use b_folio in touch_buffer() Date: Thu, 15 Dec 2022 21:43:53 +0000 Message-Id: <20221215214402.3522366-4-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221215214402.3522366-1-willy@infradead.org> References: <20221215214402.3522366-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Removes a call to compound_head() in this path. Signed-off-by: Matthew Wilcox (Oracle) --- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index e1055fe0b366..8a02fdaeec9a 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -60,7 +60,7 @@ static void submit_bh_wbc(blk_opf_t opf, struct buffer_head *bh, inline void touch_buffer(struct buffer_head *bh) { trace_block_touch_buffer(bh); - mark_page_accessed(bh->b_page); + folio_mark_accessed(bh->b_folio); } EXPORT_SYMBOL(touch_buffer); From patchwork Thu Dec 15 21:43:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13074561 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 B8058C4167B for ; Thu, 15 Dec 2022 21:44:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229815AbiLOVoL (ORCPT ); Thu, 15 Dec 2022 16:44:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbiLOVoD (ORCPT ); Thu, 15 Dec 2022 16:44:03 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 244F25C771 for ; Thu, 15 Dec 2022 13:44:00 -0800 (PST) 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=qdO/DqGtnGYOBvBVhitPl5mQ783V5yC6feoboQP062M=; b=o9cdh32C9HCIUu30/PEpOiWsox DBvIpD4x2L1Jw/kmJwNhChLEeHiq2VvcDKWFqQZcfg5zGog1+Yg3qPIpq4CdXtUoqhmGUiyU+vx/U J/IdIXlttY4o96BUCK2bxcdW+Vy5nRLgwuIu0lV5TvP8e38KXFvJPyryZ+EffZU01lVrkhd0U8ShV zTvM35l/rY5wfHO2zMTKqgV+61A2hRpK5PywfG1Trkvb46RrtxGOG/tPe018GnlwoUIbJ3sE1FpqR E3XyCREvTIwWQh911FnSEcEyJWOiVMfW+z2myTkJuAPE+ENlAL/JOrB05Ext/sXDpWGO5k3PBS62g 6L7uJldg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5w1O-00EmLQ-Hc; Thu, 15 Dec 2022 21:44:06 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 04/12] buffer: Use b_folio in end_buffer_async_read() Date: Thu, 15 Dec 2022 21:43:54 +0000 Message-Id: <20221215214402.3522366-5-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221215214402.3522366-1-willy@infradead.org> References: <20221215214402.3522366-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Removes a call to compound_head() in SetPageError(), saving 76 bytes of text. Signed-off-by: Matthew Wilcox (Oracle) --- fs/buffer.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 8a02fdaeec9a..5bdcc040eca3 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -246,18 +246,18 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) unsigned long flags; struct buffer_head *first; struct buffer_head *tmp; - struct page *page; - int page_uptodate = 1; + struct folio *folio; + int folio_uptodate = 1; BUG_ON(!buffer_async_read(bh)); - page = bh->b_page; + folio = bh->b_folio; if (uptodate) { set_buffer_uptodate(bh); } else { clear_buffer_uptodate(bh); buffer_io_error(bh, ", async page read"); - SetPageError(page); + folio_set_error(folio); } /* @@ -265,14 +265,14 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) * two buffer heads end IO at almost the same time and both * decide that the page is now completely done. */ - first = page_buffers(page); + first = folio_buffers(folio); spin_lock_irqsave(&first->b_uptodate_lock, flags); clear_buffer_async_read(bh); unlock_buffer(bh); tmp = bh; do { if (!buffer_uptodate(tmp)) - page_uptodate = 0; + folio_uptodate = 0; if (buffer_async_read(tmp)) { BUG_ON(!buffer_locked(tmp)); goto still_busy; @@ -285,9 +285,9 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) * If all of the buffers are uptodate then we can set the page * uptodate. */ - if (page_uptodate) - SetPageUptodate(page); - unlock_page(page); + if (folio_uptodate) + folio_mark_uptodate(folio); + folio_unlock(folio); return; still_busy: From patchwork Thu Dec 15 21:43:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13074567 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 9C8CEC4332F for ; Thu, 15 Dec 2022 21:44:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229847AbiLOVoT (ORCPT ); Thu, 15 Dec 2022 16:44:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbiLOVoE (ORCPT ); Thu, 15 Dec 2022 16:44:04 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21EDE5C750 for ; Thu, 15 Dec 2022 13:44:00 -0800 (PST) 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=XNtV03kYWqvwcuI+GKUmwm+3ChSXjAfg0Z+REe98p9g=; b=SjHy+LTeV2i/8sohLzrV2N1IZx 6WjXcDY8Ld5Z3/DHuFR0FKmUvyyi0DRCmHwUfs0XxjoUxklBRUN3R+4w3mTQ7R16Kb4e55PiJ7pxp i5vmnWpTQtC4/gYNfgK85bUcl8iTOmLd1b0AFl6oCKKJ/a2fZIWgOjYVwjE0M17P+hrZ7WvT/q6lZ 1GjYIWBBPlpKaSdaqgtPQWu5soFqbo6rFvVUuN0QgVDHNqHR/UUGqdxJD3USlAxdgwW2ZpZk7HXBp y0IpDhUD2G8vtMFwlMB9OHaSVDWGThPOKinVtsIWo1AY3dyPMOAHmTWXu3zGZc69RFitYe6TLBLHS 8hZqcQLQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5w1O-00EmLW-LO; Thu, 15 Dec 2022 21:44:06 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 05/12] buffer: Use b_folio in end_buffer_async_write() Date: Thu, 15 Dec 2022 21:43:55 +0000 Message-Id: <20221215214402.3522366-6-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221215214402.3522366-1-willy@infradead.org> References: <20221215214402.3522366-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Save 76 bytes from avoiding the call to compound_head() in SetPageError(). Also avoid the call to compound_head() in end_page_writeback(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/buffer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 5bdcc040eca3..c44ca40530c3 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -344,21 +344,21 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate) unsigned long flags; struct buffer_head *first; struct buffer_head *tmp; - struct page *page; + struct folio *folio; BUG_ON(!buffer_async_write(bh)); - page = bh->b_page; + folio = bh->b_folio; if (uptodate) { set_buffer_uptodate(bh); } else { buffer_io_error(bh, ", lost async page write"); mark_buffer_write_io_error(bh); clear_buffer_uptodate(bh); - SetPageError(page); + folio_set_error(folio); } - first = page_buffers(page); + first = folio_buffers(folio); spin_lock_irqsave(&first->b_uptodate_lock, flags); clear_buffer_async_write(bh); @@ -372,7 +372,7 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate) tmp = tmp->b_this_page; } spin_unlock_irqrestore(&first->b_uptodate_lock, flags); - end_page_writeback(page); + folio_end_writeback(folio); return; still_busy: From patchwork Thu Dec 15 21:43:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13074557 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 9BA7BC10F1E for ; Thu, 15 Dec 2022 21:44:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229787AbiLOVoF (ORCPT ); Thu, 15 Dec 2022 16:44:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbiLOVoD (ORCPT ); Thu, 15 Dec 2022 16:44:03 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22A9B5C767 for ; Thu, 15 Dec 2022 13:44:00 -0800 (PST) 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=v/AkinrTDVgEfNNO6qpaH3R9dXVC5qhyWPsFiWk0rso=; b=UCttcRqbgCOPA62MHGB77ed36d Ozi+5KnHy+yfU5opNJK4JSbiVa8IkuZpoLr6OJgXfnT9EYroI/O1mhHq+BrhW3tvfBFqmSSWGsb1V ei6COEw+JllL6MJJG+fuh4qHHXIMI2wkZAcsyFK/3B+86wsVUJuUc6V4KocbOPN/nPPHfRhJ+DFX6 CGHUs7AsYXu5ztDygodZzfKmb93PjMlDopZWDnDlMwR6ARYfq45laUsmQUVWMa9IVmK5OvAoYVSj8 ia4i4rpxGQsc7GUvAudCzmC3zJiqZsLKAgZNmMJ3PbUlFsjpQLGINeeb3tCN3nsZFkfB1gLZ62XQc 0rMNHcdw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5w1O-00EmLc-PB; Thu, 15 Dec 2022 21:44:06 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 06/12] page_io: Remove buffer_head include Date: Thu, 15 Dec 2022 21:43:56 +0000 Message-Id: <20221215214402.3522366-7-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221215214402.3522366-1-willy@infradead.org> References: <20221215214402.3522366-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org page_io never uses buffer_heads to do I/O. Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mm/page_io.c b/mm/page_io.c index 3a5f921b932e..905d9fcc0c96 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include From patchwork Thu Dec 15 21:43:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13074563 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 36C5EC4167B for ; Thu, 15 Dec 2022 21:44:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229797AbiLOVoO (ORCPT ); Thu, 15 Dec 2022 16:44:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229736AbiLOVoE (ORCPT ); Thu, 15 Dec 2022 16:44:04 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 220C85C759 for ; Thu, 15 Dec 2022 13:44:00 -0800 (PST) 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=HsMY9MrG5/c4/8q0wd8SB76CtOUUi8D1teXRxfN/iv0=; b=BEzOxntbptC2WdedNpdlPQRq+/ BLQYCY/yYga8/rPn7/CJt+UCsrzybA614h4s7xKMpUWADxRFKJcd/ZX173Gf/xYpO3BAx36mvjMjZ TDA0SRMhv7CvTWDLqKooUFjad8ulcATa4ScbPKZ4hx1Nk0q8VkDDa9SkS9c6fNt3HKyIHvPuUV2L1 0jVBSPakWdIM8JOcAZibji8Zsp5eNCwXs3fOSq10z+D7XmqqBZG9gSf08HdFGPqJZtTFhwfST3S3X 5fMpiBrk5zZFh8/oKC1rQhRHi8hyJZ/aDYMyHcY0lAGaZkZSQo/RGYx91tn3VNEIgcWF/Cs0mysJq qLcqivUw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5w1O-00EmLk-SA; Thu, 15 Dec 2022 21:44:06 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 07/12] buffer: Use b_folio in mark_buffer_dirty() Date: Thu, 15 Dec 2022 21:43:57 +0000 Message-Id: <20221215214402.3522366-8-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221215214402.3522366-1-willy@infradead.org> References: <20221215214402.3522366-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Removes about four calls to compound_head(). Two of them are inline which removes 132 bytes from the kernel text. Signed-off-by: Matthew Wilcox (Oracle) --- fs/buffer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index c44ca40530c3..7e42d67bcaad 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1095,16 +1095,16 @@ void mark_buffer_dirty(struct buffer_head *bh) } if (!test_set_buffer_dirty(bh)) { - struct page *page = bh->b_page; + struct folio *folio = bh->b_folio; struct address_space *mapping = NULL; - lock_page_memcg(page); - if (!TestSetPageDirty(page)) { - mapping = page_mapping(page); + folio_memcg_lock(folio); + if (!folio_test_set_dirty(folio)) { + mapping = folio->mapping; if (mapping) - __set_page_dirty(page, mapping, 0); + __folio_mark_dirty(folio, mapping, 0); } - unlock_page_memcg(page); + folio_memcg_unlock(folio); if (mapping) __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); } From patchwork Thu Dec 15 21:43:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13074564 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 402C7C4332F for ; Thu, 15 Dec 2022 21:44:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229807AbiLOVoP (ORCPT ); Thu, 15 Dec 2022 16:44:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229740AbiLOVoE (ORCPT ); Thu, 15 Dec 2022 16:44:04 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 221755C765 for ; Thu, 15 Dec 2022 13:44:00 -0800 (PST) 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=MLGJwhDountcuCLbbenFUGHbgCYIGmLfecx3jnzH9ks=; b=pFFJ1gesuLLg195NtZTf+MZmmg XC25p6TNocwllfifXKh4jhgNaf/PAy0Kzym/aoho6VhDUDE9TBoduDweQ+vbsHtvwCENJjLoE5ng9 MQUkZ/E1BUtdcfzU9vFiJqJZPHrE7F8EqoOpqoQZ0b32F4mPCiyJsVPAaM8amnSj6Odkd+oD7ZpIQ 5AwJEn5XMxVkgrCIRToBUiWm8+zSnyzLsrf5P8RejtgvCCAYyrJEdrY7X/Bgki0cpfBXYjWSrisyC CYgoMxVVymFOuTJFXiN4hyMN6BRkdlblDJuiclwc3X2bCvfZSE5sE8lsQ4KIz4FVBZmbNqjunezXf pbF3y9Ng==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5w1O-00EmLq-WE; Thu, 15 Dec 2022 21:44:07 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 08/12] gfs2: Replace obvious uses of b_page with b_folio Date: Thu, 15 Dec 2022 21:43:58 +0000 Message-Id: <20221215214402.3522366-9-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221215214402.3522366-1-willy@infradead.org> References: <20221215214402.3522366-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org These places just use b_page to get to the buffer's address_space. Signed-off-by: Matthew Wilcox (Oracle) --- fs/gfs2/glops.c | 2 +- fs/gfs2/log.c | 2 +- fs/gfs2/meta_io.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index d78b61ecc1cd..081422644ec5 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -39,7 +39,7 @@ static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh) "AIL buffer %p: blocknr %llu state 0x%08lx mapping %p page " "state 0x%lx\n", bh, (unsigned long long)bh->b_blocknr, bh->b_state, - bh->b_page->mapping, bh->b_page->flags); + bh->b_folio->mapping, bh->b_folio->flags); fs_err(sdp, "AIL glock %u:%llu mapping %p\n", gl->gl_name.ln_type, gl->gl_name.ln_number, gfs2_glock2aspace(gl)); diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 723639376ae2..1fcc829f02ab 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -127,7 +127,7 @@ __acquires(&sdp->sd_ail_lock) continue; gl = bd->bd_gl; list_move(&bd->bd_ail_st_list, &tr->tr_ail1_list); - mapping = bh->b_page->mapping; + mapping = bh->b_folio->mapping; if (!mapping) continue; spin_unlock(&sdp->sd_ail_lock); diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 3c41b864ee5b..924361fa510b 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c @@ -334,7 +334,7 @@ int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh) void gfs2_remove_from_journal(struct buffer_head *bh, int meta) { - struct address_space *mapping = bh->b_page->mapping; + struct address_space *mapping = bh->b_folio->mapping; struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping); struct gfs2_bufdata *bd = bh->b_private; struct gfs2_trans *tr = current->journal_info; From patchwork Thu Dec 15 21:43:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13074568 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 A4462C10F1E for ; Thu, 15 Dec 2022 21:44:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229848AbiLOVoW (ORCPT ); Thu, 15 Dec 2022 16:44:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229755AbiLOVoE (ORCPT ); Thu, 15 Dec 2022 16:44:04 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2314A5C76A for ; Thu, 15 Dec 2022 13:44:00 -0800 (PST) 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=VpMOH9i1GJ3y+J8KYvAq+MfLKoGEueDMKAxxqvP3xO0=; b=jjk01CIdcLM+3Ex+uHmCyJB2Zh NVWAL7xHdU3C234UKwjnP7tO4OfPasmTpCFyK7z9ScUWvSQpvhPUtQMYrHGaSiLGsW/V+gYvKlyJ7 QR3qQDJTKsqEipqrhSjKmvX/hkQuXY//Jt6JU7ebuKaexerp1SA6+G7ZsoqQFE8+VTujtfpMdMYaz MCD5YvL47a0LfOOz3NNRp+h6a0riEn32NV4ZwRTJ5EeBHnDGVSnHPUh5Za7RuPKFirTKTvQFFqvce K/3byhXk72EWN6Hf7/7o14mSnkNIGgsKTXV3LC+vwi59g3mBOvqusDgsIyQ/6019X5YxlKSSWc+p9 MY0fEfHQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5w1P-00EmM4-Gk; Thu, 15 Dec 2022 21:44:07 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 09/12] jbd2: Replace obvious uses of b_page with b_folio Date: Thu, 15 Dec 2022 21:43:59 +0000 Message-Id: <20221215214402.3522366-10-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221215214402.3522366-1-willy@infradead.org> References: <20221215214402.3522366-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org These places just use b_page to get to the buffer's address_space or have already been converted to folio. Signed-off-by: Matthew Wilcox (Oracle) --- fs/jbd2/commit.c | 8 ++------ fs/jbd2/journal.c | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 4810438b7856..96a1ebc6342d 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -63,16 +63,12 @@ static void journal_end_buffer_io_sync(struct buffer_head *bh, int uptodate) static void release_buffer_page(struct buffer_head *bh) { struct folio *folio; - struct page *page; if (buffer_dirty(bh)) goto nope; if (atomic_read(&bh->b_count) != 1) goto nope; - page = bh->b_page; - if (!page) - goto nope; - folio = page_folio(page); + folio = bh->b_folio; if (folio->mapping) goto nope; @@ -1040,7 +1036,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) * already detached from the mapping and buffers cannot * get reused. */ - mapping = READ_ONCE(bh->b_page->mapping); + mapping = READ_ONCE(bh->b_folio->mapping); if (mapping && !sb_is_blkdev_sb(mapping->host->i_sb)) { clear_buffer_mapped(bh); clear_buffer_new(bh); diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 2696f43e7239..4095fe91457f 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -2938,7 +2938,7 @@ struct journal_head *jbd2_journal_add_journal_head(struct buffer_head *bh) } else { J_ASSERT_BH(bh, (atomic_read(&bh->b_count) > 0) || - (bh->b_page && bh->b_page->mapping)); + (bh->b_folio && bh->b_folio->mapping)); if (!new_jh) { jbd_unlock_bh_journal_head(bh); From patchwork Thu Dec 15 21:44:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13074565 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 3B715C4167B for ; Thu, 15 Dec 2022 21:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbiLOVoR (ORCPT ); Thu, 15 Dec 2022 16:44:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229748AbiLOVoE (ORCPT ); Thu, 15 Dec 2022 16:44:04 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21FE85C757 for ; Thu, 15 Dec 2022 13:44:00 -0800 (PST) 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=0k+Hmew8uEf7FDAacVor3Mh6CSlwV+m6dr5BNsU01p8=; b=jU3tz14SzE+kFxrT9h9LonHRW5 expWMiNEIKfn4GRTgV29iJj8pYReGkQl1qDW4hbnSk3XWY309K5FHTPX6/MqZKLXmSKU1sJkMG0gH Zk1Ou8DG811PpZ7YaGeMvC8zf3+GLcgdniiSx67qoJETPAfHeOeCXBHv0OYqSTtftgXcT1H6386fQ pY00W1fShpCXKfXNzi2L8Zcf5mW5nIzdG0rn69vFddgqJljp4n2BYT54cf1G6lsDJcSIP9njZ1f8G zFTF52vxp0lC4oiBcNY4TUY0afXDrpBfpwqzPjxChxdOTXLN5nkXya2kSZ+RB+cwpn3s5hMD8Mcau I0/mUZQw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5w1P-00EmMA-Km; Thu, 15 Dec 2022 21:44:07 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 10/12] nilfs2: Replace obvious uses of b_page with b_folio Date: Thu, 15 Dec 2022 21:44:00 +0000 Message-Id: <20221215214402.3522366-11-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221215214402.3522366-1-willy@infradead.org> References: <20221215214402.3522366-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org These places just use b_page to get to the buffer's address_space or the index of the page the buffer is in. Signed-off-by: Matthew Wilcox (Oracle) --- fs/nilfs2/btnode.c | 2 +- fs/nilfs2/btree.c | 2 +- fs/nilfs2/gcinode.c | 2 +- fs/nilfs2/mdt.c | 4 ++-- fs/nilfs2/segment.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c index e74fda212620..e956f886a1a1 100644 --- a/fs/nilfs2/btnode.c +++ b/fs/nilfs2/btnode.c @@ -188,7 +188,7 @@ int nilfs_btnode_prepare_change_key(struct address_space *btnc, struct page *opage = obh->b_page; lock_page(opage); retry: - /* BUG_ON(oldkey != obh->b_page->index); */ + /* BUG_ON(oldkey != obh->b_folio->index); */ if (unlikely(oldkey != opage->index)) NILFS_PAGE_BUG(opage, "invalid oldkey %lld (newkey=%lld)", diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index b9d15c3df3cc..6b914217b0c7 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c @@ -398,7 +398,7 @@ int nilfs_btree_broken_node_block(struct buffer_head *bh) if (buffer_nilfs_checked(bh)) return 0; - inode = bh->b_page->mapping->host; + inode = bh->b_folio->mapping->host; ret = nilfs_btree_node_broken((struct nilfs_btree_node *)bh->b_data, bh->b_size, inode, bh->b_blocknr); if (likely(!ret)) diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c index b0d22ff24b67..48fe71d309cb 100644 --- a/fs/nilfs2/gcinode.c +++ b/fs/nilfs2/gcinode.c @@ -140,7 +140,7 @@ int nilfs_gccache_wait_and_mark_dirty(struct buffer_head *bh) { wait_on_buffer(bh); if (!buffer_uptodate(bh)) { - struct inode *inode = bh->b_page->mapping->host; + struct inode *inode = bh->b_folio->mapping->host; nilfs_err(inode->i_sb, "I/O error reading %s block for GC (ino=%lu, vblocknr=%llu)", diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index cbf4fa60eea2..19c8158605ed 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c @@ -563,7 +563,7 @@ int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh) struct page *page; int blkbits = inode->i_blkbits; - page = grab_cache_page(shadow->inode->i_mapping, bh->b_page->index); + page = grab_cache_page(shadow->inode->i_mapping, bh->b_folio->index); if (!page) return -ENOMEM; @@ -595,7 +595,7 @@ nilfs_mdt_get_frozen_buffer(struct inode *inode, struct buffer_head *bh) struct page *page; int n; - page = find_lock_page(shadow->inode->i_mapping, bh->b_page->index); + page = find_lock_page(shadow->inode->i_mapping, bh->b_folio->index); if (page) { if (page_has_buffers(page)) { n = bh_offset(bh) >> inode->i_blkbits; diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 3335ef352915..05a151e5c52b 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -1581,7 +1581,7 @@ nilfs_segctor_update_payload_blocknr(struct nilfs_sc_info *sci, nblocks = le32_to_cpu(finfo->fi_nblocks); ndatablk = le32_to_cpu(finfo->fi_ndatablk); - inode = bh->b_page->mapping->host; + inode = bh->b_folio->mapping->host; if (mode == SC_LSEG_DSYNC) sc_op = &nilfs_sc_dsync_ops; From patchwork Thu Dec 15 21:44:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13074560 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 0E1A0C4332F for ; Thu, 15 Dec 2022 21:44:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229809AbiLOVoJ (ORCPT ); Thu, 15 Dec 2022 16:44:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbiLOVoD (ORCPT ); Thu, 15 Dec 2022 16:44:03 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 222845C766 for ; Thu, 15 Dec 2022 13:44:00 -0800 (PST) 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=OuWSqYcbZjkcwq3U2LAw3KmB8IBcZ9iMYpK/n9em/18=; b=f8LDvWdU6VVqRLVOgAsl4tEhEv 9ADVgpogoFhGhwhgbmlYhGjgQN5CP9zvUHDxxEcVk/u5azfzTt5XjfAZmTN6l/Yg58ZY5Pfkw94vU WT6IMQWF/tKdfgOs2oSdsI2w0/p/xh4h6E1efhnMZ1U6VNkSNLsgQj1D9+CBzwW2xdfsVXO4f4j5e cHd8Ie/AekfXDdhTfxsfpLbTuZBQOuO9UNjzBShC8icGfSYEoOu5rsVWYo+lwxOUsiRbau2AAg1g8 ap3rz5UkNF3lovw8n5Emhi4x11pZdE0Avi6Ao1Pjspu1ru1BrO/kPdsCSUpDWgbuJAs8OTDCrWKIs IWHW4w4w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5w1P-00EmMG-PR; Thu, 15 Dec 2022 21:44:07 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 11/12] reiserfs: Replace obvious uses of b_page with b_folio Date: Thu, 15 Dec 2022 21:44:01 +0000 Message-Id: <20221215214402.3522366-12-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221215214402.3522366-1-willy@infradead.org> References: <20221215214402.3522366-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org These places just use b_page to get to the buffer's address_space or call page_folio() on b_page to get a folio. Signed-off-by: Matthew Wilcox (Oracle) --- fs/reiserfs/journal.c | 4 ++-- fs/reiserfs/tail_conversion.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 9f62da7471c9..9ce4ec296b74 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c @@ -601,7 +601,7 @@ static int journal_list_still_alive(struct super_block *s, */ static void release_buffer_page(struct buffer_head *bh) { - struct folio *folio = page_folio(bh->b_page); + struct folio *folio = bh->b_folio; if (!folio->mapping && folio_trylock(folio)) { folio_get(folio); put_bh(bh); @@ -866,7 +866,7 @@ static int write_ordered_buffers(spinlock_t * lock, * will ever write the buffer. We're safe if we write the * page one last time after freeing the journal header. */ - if (buffer_dirty(bh) && unlikely(bh->b_page->mapping == NULL)) { + if (buffer_dirty(bh) && unlikely(bh->b_folio->mapping == NULL)) { spin_unlock(lock); write_dirty_buffer(bh, 0); spin_lock(lock); diff --git a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c index b0ae088dffc7..2cec61af2a9e 100644 --- a/fs/reiserfs/tail_conversion.c +++ b/fs/reiserfs/tail_conversion.c @@ -177,7 +177,7 @@ void reiserfs_unmap_buffer(struct buffer_head *bh) * BUG() on attempt to write not mapped buffer */ if ((!list_empty(&bh->b_assoc_buffers) || bh->b_private) && bh->b_page) { - struct inode *inode = bh->b_page->mapping->host; + struct inode *inode = bh->b_folio->mapping->host; struct reiserfs_journal *j = SB_JOURNAL(inode->i_sb); spin_lock(&j->j_dirty_buffers_lock); list_del_init(&bh->b_assoc_buffers); From patchwork Thu Dec 15 21:44:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13074558 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 7ACAEC4332F for ; Thu, 15 Dec 2022 21:44:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229789AbiLOVoG (ORCPT ); Thu, 15 Dec 2022 16:44:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbiLOVoD (ORCPT ); Thu, 15 Dec 2022 16:44:03 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3131C5C773 for ; Thu, 15 Dec 2022 13:44:00 -0800 (PST) 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=dolFcnZSbP8XIvTbLJTtj44AzsL03OwQAE61xgsj16w=; b=SJxFU+GAh61E2VPOFiSQhHDaV0 cBK7PGSWzdIqCsaZz1F29jFEApQdstVyxk8AZMKEJchesJSQ6xLQbn8vbX7ctaKpQ2qaKwBrcixkx WrLIOJUYqJMHkG5fsoV6J0Yh6o7P2tVlsXR2SimIimlEtzstEl3ZELDMtRgAZj0Stnet4avBIdIJh i0BDSHTeW0nejKMWBXOAFX0JK2r64zqo8JtCIlDZj0dfzJeV918wVKYEok1fHuUbeSztn7xK0uF8c XauOLQu4jiW1k9kPA1PmKNqtKwapJe+xgwx4GM1dIo2JGEZjkJP3gBetRWeQtIf7iU7mZ+d9i8wAm EoJHOw6w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5w1P-00EmMM-TC; Thu, 15 Dec 2022 21:44:07 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 12/12] mpage: Use b_folio in do_mpage_readpage() Date: Thu, 15 Dec 2022 21:44:02 +0000 Message-Id: <20221215214402.3522366-13-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221215214402.3522366-1-willy@infradead.org> References: <20221215214402.3522366-1-willy@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Remove this conversion of a folio back to a page. Signed-off-by: Matthew Wilcox (Oracle) --- fs/mpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/mpage.c b/fs/mpage.c index 0f8ae954a579..db59cbf6affc 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -198,7 +198,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) /* * Then do more get_blocks calls until we are done with this folio. */ - map_bh->b_page = &folio->page; + map_bh->b_folio = folio; while (page_block < blocks_per_page) { map_bh->b_state = 0; map_bh->b_size = 0;