Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1482490rwl; Fri, 24 Mar 2023 11:04:18 -0700 (PDT) X-Google-Smtp-Source: AKy350bEGIOdJGs+zzv7apF+IwLzhEFz8laPgvkz9oldzgiiDSbV2LBA9eyDC1ZvA+hUj/oziFhu X-Received: by 2002:a17:906:94cc:b0:930:b130:b7b with SMTP id d12-20020a17090694cc00b00930b1300b7bmr3640055ejy.6.1679681058635; Fri, 24 Mar 2023 11:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679681058; cv=none; d=google.com; s=arc-20160816; b=VMV2bJp6bxXXpN0hRijcQqL2jpzpB/oTpumG/i2htpF02yh4hOHuQLuZ4NCFMcQIvi k9WEA0f8yttH0yx290GNBsjkoczFdav4HngTAVVdl33ekH7YOc9nuHhyLTHnPWyxmWH7 9GHrMBrKtPV3ekHz7gXxUckMRxoEqa6QQNsy5gV/RKfVh4PCyx+iPipaObsAmSqK48bZ rIQW2RFSoM5bgAbGVSxd8O+Z/6yCSelp84XFsKCRepU2L3XSK00NMgj4G36CYD607WmM jtIC7alkgkmrizOhAJC1BFyYECOe3/4WotUJhouHf+otlWqT9Oz0yJ4ogBXB6VwJ5GK5 36IA== 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=Wzu8+rP7kpLMx5Txvie5hKn/W6mtBGcbkKCDJJVaCV4=; b=atPMM/4M8QgnfAI+g7CPXqGJueZuHea2UUSzlshwz4/wUhiQmwP0Gw5kso0XoGA0Ei HPBEnvUk09vATyxXizhd4neOhpAFCK3tKSOCYqvClasXUICPP0w2eNGMd63ny9rww/Zt x2g0OHnBoZ3lZeTpc9X5+Xy+JXgBt9zprTWZ5o2y8awKLcOEn30l8lreC0TJGoTymmDy dza8EPLE/tpqZmRGlCbo/qLE4xpuUBKRVn1gttaPA4D1wlvSOElcsoOpKEh2jH/6I5A6 /CzO3l+gqLssStTshKbE5uMTBt+2maImrZPuF4fn2gjNE2pY5MNe1q2koylgQZH/Mvob fBeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=UNwQyAat; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w11-20020aa7da4b000000b004fe4630e141si18352855eds.281.2023.03.24.11.03.47; Fri, 24 Mar 2023 11:04:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=UNwQyAat; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229681AbjCXSDb (ORCPT + 99 others); Fri, 24 Mar 2023 14:03:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231838AbjCXSCY (ORCPT ); Fri, 24 Mar 2023 14:02:24 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C69572724; Fri, 24 Mar 2023 11:02: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=Wzu8+rP7kpLMx5Txvie5hKn/W6mtBGcbkKCDJJVaCV4=; b=UNwQyAat6ZHLbso/QNiRVck/if rKJ1PD90W9v03CSVSY4iskv8XIMvLBGHNWGBID1yudFU+L2dTag+QMc1K9OGHl7PU7eos7HZeg7p0 enOMA0nLi1mYvUwVGFOHGfGzAdmebzXr0gjUouFzEwl7SwIX97k4eA1qZROW/9EGKf8HbWrkCWo6K 6GWUzk2vohMhc3Ik20Bu2/svazLrxy6GodY13/uPCOuQ24ITuRl/gvEA43kHy30dzgiCyPEZUwrFF iNL1NKKUq7IaJfwp4oob3yri4K7F+fVDpD/9z4uuCuhLsnrqNzqxk3UNQvwwZME5bXfDXF8i1TJhA KaOBCXLg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pfljM-0057Zq-Ar; Fri, 24 Mar 2023 18:01:36 +0000 From: "Matthew Wilcox (Oracle)" To: tytso@mit.edu, adilger.kernel@dilger.ca Cc: "Matthew Wilcox (Oracle)" , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v2 13/29] ext4: Convert ext4_da_write_inline_data_begin() to use a folio Date: Fri, 24 Mar 2023 18:01:13 +0000 Message-Id: <20230324180129.1220691-14-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230324180129.1220691-1-willy@infradead.org> References: <20230324180129.1220691-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Saves a number of calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/ext4/inline.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 45d74274d822..2fa6c51baef9 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -909,10 +909,9 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, { int ret; handle_t *handle; - struct page *page; + struct folio *folio; struct ext4_iloc iloc; int retries = 0; - unsigned int flags; ret = ext4_get_inode_loc(inode, &iloc); if (ret) @@ -944,10 +943,9 @@ int ext4_da_write_inline_data_begin(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); - memalloc_nofs_restore(flags); - if (!page) { + folio = __filemap_get_folio(mapping, 0, FGP_WRITEBEGIN | FGP_NOFS, + mapping_gfp_mask(mapping)); + if (!folio) { ret = -ENOMEM; goto out_journal; } @@ -958,8 +956,8 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, goto out_release_page; } - if (!PageUptodate(page)) { - ret = ext4_read_inline_page(inode, page); + if (!folio_test_uptodate(folio)) { + ret = ext4_read_inline_page(inode, &folio->page); if (ret < 0) goto out_release_page; } @@ -969,13 +967,13 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, goto out_release_page; up_read(&EXT4_I(inode)->xattr_sem); - *pagep = page; + *pagep = &folio->page; brelse(iloc.bh); return 1; out_release_page: up_read(&EXT4_I(inode)->xattr_sem); - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); out_journal: ext4_journal_stop(handle); out: -- 2.39.2