[PATCH] ext4: Experiment with checksum computation during orphan handling

From: Jan Kara
Date: Thu May 20 2021 - 05:46:02 EST


DONTMERGE. Just experiment whether this recovers performance.

Signed-off-by: Jan Kara <jack@xxxxxxx>
---
fs/ext4/namei.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index afb9d05a99ba..bb687ed4a604 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -3105,7 +3105,6 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
NEXT_ORPHAN(inode) = le32_to_cpu(sbi->s_es->s_last_orphan);
lock_buffer(sbi->s_sbh);
sbi->s_es->s_last_orphan = cpu_to_le32(inode->i_ino);
- ext4_superblock_csum_set(sb);
unlock_buffer(sbi->s_sbh);
dirty = true;
}
@@ -3113,6 +3112,9 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
mutex_unlock(&sbi->s_orphan_lock);

if (dirty) {
+ lock_buffer(sbi->s_sbh);
+ ext4_superblock_csum_set(sb);
+ unlock_buffer(sbi->s_sbh);
err = ext4_handle_dirty_metadata(handle, NULL, sbi->s_sbh);
rc = ext4_mark_iloc_dirty(handle, inode, &iloc);
if (!err)
@@ -3191,9 +3193,9 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
}
lock_buffer(sbi->s_sbh);
sbi->s_es->s_last_orphan = cpu_to_le32(ino_next);
+ mutex_unlock(&sbi->s_orphan_lock);
ext4_superblock_csum_set(inode->i_sb);
unlock_buffer(sbi->s_sbh);
- mutex_unlock(&sbi->s_orphan_lock);
err = ext4_handle_dirty_metadata(handle, NULL, sbi->s_sbh);
} else {
struct ext4_iloc iloc2;
--
2.26.2


--gBBFr7Ir9EOA20Yy--