Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp418497rdb; Mon, 18 Sep 2023 21:53:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxds25eWXXKON2JgIxHlp6Xy5olKQ56AAnmj/JnOpP85sPRIfC+tM84UPpeJ+EgPAS/n0h X-Received: by 2002:a17:903:2786:b0:1c5:7aa1:3a52 with SMTP id jw6-20020a170903278600b001c57aa13a52mr2958176plb.2.1695099230843; Mon, 18 Sep 2023 21:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695099230; cv=none; d=google.com; s=arc-20160816; b=Ld69kNl9Lc0JeAnP/20wfIuXQqzx9UarPmFvi2S0fVmQGlux/+f9GBCwzJaJDsfPxv qUidbXuDi1q3x9ioA216yYz12VrOGalAltlTZY73KAMZNvQkmgtels2+OsyC/YASpro3 P3objy/jVp4xT86F86lwosxWOolQMX6DiW+/oT95RFsHh15D3VxYZzvgxJ+kMDlAbAFK QN1BTuxiR/ZzgBQpAZC551XrRD7gOvazLO1ga4dAWDzUGXKXxKtrtSCdsva5JMs7ypfq 2AzHhwxGtnhGJ8wRk5+oSCDq02Bt24xOU1olT2U7P1wq7mPkPXaZTuY9uXPwiT88LL09 jJzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2AizBRSvoAwMQss5U4Q6NQxeqUYZOASj4Ibiz5oNoKg=; fh=Ex900LeWemyNv8v7eVaT25lhS5hAbxvedq4sD5vnIX8=; b=RTO9xguKNM3+ueVGyPQddWTdqVwtWbGLXMbIDmyWDIUnAJ+D0FUw9tf9CIC3nUjGY8 TLbpONnxCeNK1Mb07mExaDwsJMMoB4Fc9LppBAs9DnqKxOgVkQaXipkIOoiPWgfGwu3N D8GJO9DiVsPdB4FDw78QJxe47hJuUVkWYn4UnxA2V9maJYuzz4IIlx8af3dJ//0ZYs3z nJKLffg7FLUazuOYcCpVIfeGFpF7qlmk8bMRRhKQ0ZR55svaGGg70WnlnlNPNDXucA07 HQr81GbmxH6O5E+c//7n0Wzor0wSS0lOKhmGObh5E1QDPp5u7SNpabs7G4Dut0oTSx0A 1qnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=V2znE11Q; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f9-20020a170902684900b001c43cd8b2d5si6348725pln.592.2023.09.18.21.53.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 21:53:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=V2znE11Q; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7AF428184E1C; Mon, 18 Sep 2023 21:53:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231644AbjISExR (ORCPT + 99 others); Tue, 19 Sep 2023 00:53:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231678AbjISEwd (ORCPT ); Tue, 19 Sep 2023 00:52:33 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94127191; Mon, 18 Sep 2023 21:51:52 -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=2AizBRSvoAwMQss5U4Q6NQxeqUYZOASj4Ibiz5oNoKg=; b=V2znE11QCzbIBsv3LQLxDWkQUk BVxYADbK8OVLuf3nE1HOQqQse9s2EvFGORQoD/7LhWbIX2cSA77t3Xbl9ctOdtZxfybufcDiRWt1r wDKrQx2nxuWEuoGZxd2kg+z3WXHcEIm9dOvaQtPP/lGgLhjKRt1AM+V4c1WriiJTkHwoWguEQJdbS pj4ycdFA4+K/yxTHLUNzBfw9PV7DrBmLorm45J/jqnu52fctRy3XQ/TXsNgT/+0+ENSEfad0GDs9w tCMk9cEJOyPK5sl0Yria+Idg6hFCFnRZFNpa4B6JFw7QfKMoy8hG9+MiNZlHLzHNOAR+fwcfIAAhD HEaW+hFw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qiSi2-00FFkL-8r; Tue, 19 Sep 2023 04:51:38 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, gfs2@lists.linux.dev, linux-nilfs@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, ntfs3@lists.linux.dev, ocfs2-devel@lists.linux.dev, reiserfs-devel@vger.kernel.org, linux-ext4@vger.kernel.org, Pankaj Raghav Subject: [PATCH 03/26] ext4: Convert to folio_create_empty_buffers Date: Tue, 19 Sep 2023 05:51:12 +0100 Message-Id: <20230919045135.3635437-4-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230919045135.3635437-1-willy@infradead.org> References: <20230919045135.3635437-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 18 Sep 2023 21:53:14 -0700 (PDT) Remove an unnecessary folio->page->folio conversion and take advantage of the new return value from folio_create_empty_buffers(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/ext4/inode.c | 14 +++++--------- fs/ext4/move_extent.c | 11 +++++------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 4ce35f1c8b0a..8e431ff2fd95 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1020,10 +1020,8 @@ static int ext4_block_write_begin(struct folio *folio, loff_t pos, unsigned len, BUG_ON(from > to); head = folio_buffers(folio); - if (!head) { - create_empty_buffers(&folio->page, blocksize, 0); - head = folio_buffers(folio); - } + if (!head) + head = folio_create_empty_buffers(folio, blocksize, 0); bbits = ilog2(blocksize); block = (sector_t)folio->index << (PAGE_SHIFT - bbits); @@ -1153,7 +1151,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping, * starting the handle. */ if (!folio_buffers(folio)) - create_empty_buffers(&folio->page, inode->i_sb->s_blocksize, 0); + folio_create_empty_buffers(folio, inode->i_sb->s_blocksize, 0); folio_unlock(folio); @@ -3643,10 +3641,8 @@ static int __ext4_block_zero_page_range(handle_t *handle, iblock = index << (PAGE_SHIFT - inode->i_sb->s_blocksize_bits); bh = folio_buffers(folio); - if (!bh) { - create_empty_buffers(&folio->page, blocksize, 0); - bh = folio_buffers(folio); - } + if (!bh) + bh = folio_create_empty_buffers(folio, blocksize, 0); /* Find the buffer that contains "offset" */ pos = blocksize; diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 18a9e7c47975..7fe448fb948b 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -183,10 +183,8 @@ mext_page_mkuptodate(struct folio *folio, unsigned from, unsigned to) blocksize = i_blocksize(inode); head = folio_buffers(folio); - if (!head) { - create_empty_buffers(&folio->page, blocksize, 0); - head = folio_buffers(folio); - } + if (!head) + head = folio_create_empty_buffers(folio, blocksize, 0); block = (sector_t)folio->index << (PAGE_SHIFT - inode->i_blkbits); for (bh = head, block_start = 0; bh != head || !block_start; @@ -380,9 +378,10 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode, } /* Perform all necessary steps similar write_begin()/write_end() * but keeping in mind that i_size will not change */ - if (!folio_buffers(folio[0])) - create_empty_buffers(&folio[0]->page, 1 << orig_inode->i_blkbits, 0); bh = folio_buffers(folio[0]); + if (!bh) + bh = folio_create_empty_buffers(folio[0], + 1 << orig_inode->i_blkbits, 0); for (i = 0; i < data_offset_in_page; i++) bh = bh->b_this_page; for (i = 0; i < block_len_in_page; i++) { -- 2.40.1