public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jan Kara <jack@suse.cz>, Theodore Ts'o <tytso@mit.edu>,
	Sasha Levin <sashal@kernel.org>,
	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	[thread overview]
Message-ID: <20220621205105.250640-8-sashal@kernel.org> (raw)
In-Reply-To: <20220621205105.250640-1-sashal@kernel.org>

From: Jan Kara <jack@suse.cz>

[ 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 <jack@suse.cz>
Link: https://lore.kernel.org/r/20220520111402.4252-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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


  parent reply	other threads:[~2022-06-21 21:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 20:50 [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts Sasha Levin
2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 02/11] irqchip/uniphier-aidet: Add compatible string for NX1 SoC Sasha Levin
2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 03/11] mei: me: set internal pg flag to off on hardware reset Sasha Levin
2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 04/11] nvme-pci: add trouble shooting steps for timeouts Sasha Levin
2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 05/11] nvme-pci: phison e12 has bogus namespace ids Sasha Levin
2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 06/11] nvme-pci: smi " Sasha Levin
2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 07/11] nvme-pci: sk hynix p31 " Sasha Levin
2022-06-21 20:51 ` Sasha Levin [this message]
2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 09/11] blk-mq: protect q->elevator by ->sysfs_lock in blk_mq_elv_switch_none Sasha Levin
2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 10/11] blk-mq: don't clear flush_rq from tags->rqs[] Sasha Levin
2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 11/11] ext4: correct the judgment of BUG in ext4_mb_normalize_request Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220621205105.250640-8-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox