Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6513245rdb; Tue, 2 Jan 2024 04:45:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5iUOFQsTcDmcrea+EBaLXQEek1or9IuDr26cSF70yR7hstiwjd0NPZf2Xl3DOL+HuliX2 X-Received: by 2002:a17:902:ea0b:b0:1d4:4c91:b8a1 with SMTP id s11-20020a170902ea0b00b001d44c91b8a1mr6561438plg.129.1704199519436; Tue, 02 Jan 2024 04:45:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704199519; cv=none; d=google.com; s=arc-20160816; b=rCjIFXbCPSqBNXUVkWaFzripwVOAcS65ly/aGxnxP31oWqW4IL1d1Jr3yqV0C7U9Rb 5kDHQnuUJn0WRGlMbggtHEvtuM2OlfnPIjvE8ANK0BZ+korImz7b1RI0FWgPz2wE5HRa GIWsDwdRzN0c4hnOQ/FroXDnbVmDmRk2FtO+qHmOphjtBoGMFNNke+GZ2Qu9n6xkirEM iZMnknFu3egub0TA8QZTd/tBzwYrwwVY7gJiiOcljy/7puCjgQSlErdqGHFA/9EFyFL/ h0Pn8cTF03xmzWOSbBFBiQq7aahldh+MIaRg/A9d7BguhYNGhspv69u6yq1BqrWTtKed XqKg== 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=E9qhI9N6Pwn96OXyrzci98fe/EB+GehfMn5RR6fqvtQ=; fh=yWWoL3IRufgA/+2kSpO6uyfw9eN3ZOO7zvul0qbDPkA=; b=P7Z+l6F328Tp0msI4BGyn4yhWq8n6gQUheLnoSlZC2qaTzL13UurnPFaMslTXAfjKA /rZDTI2cS8QWMGsHulnVJONJF/P9IojGW5WjKy8g9X+W21PYGL9jnxNx/BTY/O3Jap3y jGzBhnSmlCJk/Up3KZW8SL8GlWYNusDYQt3aj/eTByZcHHpUsRCgfE140HVLihW/QhAC C4g4qkNgmgDiJji9KjPbLzl2ni7yLK3fiCl07RZtxfo1X5XvrlWOa/HDA9zFELvkGfIM SboVn1G1UbjXzPdBT/+IVbldhttqo3t8SQc+R2e9VE/4EpHA++V5P4/5/WhPWe/QP6c+ VNbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-619-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-619-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h7-20020a170902ac8700b001d09ffdfe1fsi19984795plr.171.2024.01.02.04.45.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 04:45:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-619-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-619-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-619-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 5882DB20F4C for ; Tue, 2 Jan 2024 12:45:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7211E12E5E; Tue, 2 Jan 2024 12:42:23 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A847F156F4; Tue, 2 Jan 2024 12:42:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4T4CD51x7lz4f3nK9; Tue, 2 Jan 2024 20:42:13 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id DF7041A0803; Tue, 2 Jan 2024 20:42:18 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgBnwUGUBJRl+EvDFQ--.31823S29; Tue, 02 Jan 2024 20:42:18 +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, willy@infradead.org, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com, wangkefeng.wang@huawei.com Subject: [RFC PATCH v2 25/25] ext4: enable large folio for regular file with iomap buffered IO path Date: Tue, 2 Jan 2024 20:39:18 +0800 Message-Id: <20240102123918.799062-26-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240102123918.799062-1-yi.zhang@huaweicloud.com> References: <20240102123918.799062-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:gCh0CgBnwUGUBJRl+EvDFQ--.31823S29 X-Coremail-Antispam: 1UD129KBjvJXoW7uw4DXFWfXF47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CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ From: Zhang Yi After we convert buffered IO path to iomap for regular files, we can enable large foilo for them together, that should be able to bring a lot of performance gains for large IO. Signed-off-by: Zhang Yi --- fs/ext4/ialloc.c | 4 +++- fs/ext4/inode.c | 4 +++- fs/ext4/move_extent.c | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 956b9d69c559..5a22fe5aa46b 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 2d2b8f2b634d..49a5b9b85407 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5319,8 +5319,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; diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 7a9ca71d4cac..aecd6112d8a2 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -560,6 +560,7 @@ static int ext4_disable_buffered_iomap_aops(struct inode *inode) truncate_inode_pages(inode->i_mapping, 0); ext4_clear_inode_state(inode, EXT4_STATE_BUFFERED_IOMAP); + mapping_clear_large_folios(inode->i_mapping); ext4_set_aops(inode); filemap_invalidate_unlock(inode->i_mapping); -- 2.39.2