Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp311985rdh; Thu, 23 Nov 2023 04:55:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDC8t559G9vNJhMMM/Sf2lWugNSXnAgmq+O59/+S+EsPuyDEBgL6OOnmU6XBAgUj4N18jK X-Received: by 2002:a05:6830:10cb:b0:6b9:a926:4a12 with SMTP id z11-20020a05683010cb00b006b9a9264a12mr5570691oto.28.1700744122187; Thu, 23 Nov 2023 04:55:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700744122; cv=none; d=google.com; s=arc-20160816; b=RV5G+w88z6tZjbuNuJVKnXIeCUdV2Y3nvk8np/X7RCOhtSp1L5ImoMkoWU1JEvkqaV qaQN2Oj7Leta095pEnZZNYPjRMAqKMpv/2cgySkOY7Mbuc4tGKxmAETLWWk8glmydSgN mvv2Jm4sphlEWBMsDFvJqro++7pfcjKIZswDUYTsq9F4w2qcQpLgdeyaDygYLoVMQA80 7lZTMfIsqlGd0u3oJu+LHeaZuJPwT4e2GpBlLMAXKq1J/RcD3W+264Z5ITg4ahN7wY/G rC08DdMYBesx7BCGpeShQdMJ7LVeOTjN/NfqfqyevontzIRaXrkUm7IG12rGfphA6EHv w90g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=X8pAHRkeZ29dJypFdoUgaj5AZCY61M64h2XtZmX7VTM=; fh=oXgJbFeK1mY0T4jBbK/Fs3Mi9F4SdMRqpoziDljuAF4=; b=b6p8UhYhmZ+Ftm5BN/PfvtKNtG1lId9IATrOJ1bkApwnQ1/jVhL2XIyNfO0h82Fhn6 CDfQXqeIWkJ5vM4FY7PpVEptZEjKjgKbX1aBBSNzyH4jS5TStaFBNvTg3GtkRbm/Hv9v FfGYSbTVgXmfC1EMz48MlolO926WtLkiHD/C70WfDOP94XMiYO0UZgrQV92ZIOkXYLlg xQ92E6c4aT1oeSehk77vgEabLNMCAXu26hc+JvcWSBfISOOhtydW/DIsbB0USZb/wucD Xln8Ih0yrBMWQuue8E2yv1EfLdGKQURndRNn4AtqY0xm6PwyAY+Tk8GaSHaayp1idRsF YyCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-122-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-122-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e28-20020a631e1c000000b005c200b11630si1233226pge.45.2023.11.23.04.55.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 04:55:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-122-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-122-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-122-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2A97FB21C9E for ; Thu, 23 Nov 2023 12:53:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E86C30CFB; Thu, 23 Nov 2023 12:52:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A993189; Thu, 23 Nov 2023 04:52:10 -0800 (PST) Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4SbdKx0g1hz4f3kKp; Thu, 23 Nov 2023 20:52:05 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id CC5741A04B4; Thu, 23 Nov 2023 20:52:07 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgDn6xHdSl9lSfnfBg--.20473S23; Thu, 23 Nov 2023 20:52:07 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, hch@infradead.org, djwong@kernel.org, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: [RFC PATCH 18/18] ext4: enable large folio for regular file which has been switched to use iomap Date: Thu, 23 Nov 2023 20:51:21 +0800 Message-Id: <20231123125121.4064694-20-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231123125121.4064694-1-yi.zhang@huaweicloud.com> References: <20231123125121.4064694-1-yi.zhang@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgDn6xHdSl9lSfnfBg--.20473S23 X-Coremail-Antispam: 1UD129KBjvJXoW7Zr13WFWUCrWxJFWrtw1kXwb_yoW8Xry3pF sxK3W8GrWkX34q9a1Sgr1xZr1Uta1xGw4UuFWF93Z8ur9rX34ftF4jyF1fAa18JrWrA3yI qFy2kr13Z3W3C3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPI14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2 kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVW8JVW5JwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Gr1j6F4UJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr 0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUQ SdkUUUUU= X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ From: Zhang Yi After switching to use iomap for regular file in the default mode, we can enable large foilo for it together, that could bring a lot of performance gains. Signed-off-by: Zhang Yi --- fs/ext4/ialloc.c | 4 +++- fs/ext4/inode.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 0aae2810dbf6..a72c7167c33f 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c @@ -1336,8 +1336,10 @@ struct inode *__ext4_new_inode(struct mnt_idmap *idmap, } } - if (ext4_should_use_buffered_iomap(inode)) + if (ext4_should_use_buffered_iomap(inode)) { ext4_set_inode_state(inode, EXT4_STATE_BUFFERED_IOMAP); + mapping_set_large_folios(inode->i_mapping); + } if (ext4_handle_valid(handle)) { ei->i_sync_tid = handle->h_transaction->t_tid; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 33920dc461a8..f8801d3378e3 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5477,8 +5477,10 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, if (ret) goto bad_inode; - if (ext4_should_use_buffered_iomap(inode)) + if (ext4_should_use_buffered_iomap(inode)) { ext4_set_inode_state(inode, EXT4_STATE_BUFFERED_IOMAP); + mapping_set_large_folios(inode->i_mapping); + } if (S_ISREG(inode->i_mode)) { inode->i_op = &ext4_file_inode_operations; -- 2.39.2