From mboxrd@z Thu Jan 1 00:00:00 1970 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 184DFCCA482 for ; Tue, 21 Jun 2022 21:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355231AbiFUVBC (ORCPT ); Tue, 21 Jun 2022 17:01:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355522AbiFUU6h (ORCPT ); Tue, 21 Jun 2022 16:58:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20DD1326D7; Tue, 21 Jun 2022 13:51:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BBB8AB81B44; Tue, 21 Jun 2022 20:51:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1995C3411C; Tue, 21 Jun 2022 20:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655844675; bh=OKNCzPk7vVfAMkaUiY4QbquW9hSRx8Tl2WO4N54GDmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tp+8ncqrKFvjPYYIPBJ28NVh/4ZdLFwG8MwOFUtQ8sU7rvymYMTkq8bSM8igeZOvq D/wMjvW5A88jLiP4O7bN3ZVUY25O6LZKQM//kCHtDL1NiZkVEDMUzhRg6A8VEyhEj0 NvWEXZaO7+6IQeruxaTdKISUTu3YX+nnGoiXVAvaQEL9mgHQP2UxdlOJUBoqpK4is5 6I3/rZ1ZwtrSPwqpAAo80gkcpGs8GdbW9xX2VNxJ48En6xPG7joQ774fCqfzhJC+Q1 9k5pPCG49sqbrZQnipfkNaW1zHC1Ys95T3x3YmVT7DQpYALbTfhpCmu5AhHnjTtl4W Jo2ZaqYfS0PQg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jan Kara , Theodore Ts'o , Sasha Levin , adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 08/11] ext4: improve write performance with disabled delalloc Date: Tue, 21 Jun 2022 16:51:02 -0400 Message-Id: <20220621205105.250640-8-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220621205105.250640-1-sashal@kernel.org> References: <20220621205105.250640-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Kara [ Upstream commit 8d5459c11f548131ce48b2fbf45cccc5c382558f ] When delayed allocation is disabled (either through mount option or because we are running low on free space), ext4_write_begin() allocates blocks with EXT4_GET_BLOCKS_IO_CREATE_EXT flag. With this flag extent merging is disabled and since ext4_write_begin() is called for each page separately, we end up with a *lot* of 1 block extents in the extent tree and following writeback is writing 1 block at a time which results in very poor write throughput (4 MB/s instead of 200 MB/s). These days when ext4_get_block_unwritten() is used only by ext4_write_begin(), ext4_page_mkwrite() and inline data conversion, we can safely allow extent merging to happen from these paths since following writeback will happen on different boundaries anyway. So use EXT4_GET_BLOCKS_CREATE_UNRIT_EXT instead which restores the performance. Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220520111402.4252-1-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 72e3f55f1e07..6837b0122e2c 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -823,7 +823,7 @@ int ext4_get_block_unwritten(struct inode *inode, sector_t iblock, ext4_debug("ext4_get_block_unwritten: inode %lu, create flag %d\n", inode->i_ino, create); return _ext4_get_block(inode, iblock, bh_result, - EXT4_GET_BLOCKS_IO_CREATE_EXT); + EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT); } /* Maximum number of blocks we map for direct IO at once. */ -- 2.35.1