From 78bed6a53e3cd1c10534db0c7a470c6a7a2b6754 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Tue, 4 Jun 2024 15:25:35 +0300 Subject: [PATCH] LU-10026 ldiskfs: mballoc to preserve preallocation's start .. used in dense preallocation. otherwise it's possible to lose preallocated space when the corresponding cache bitmap is dropped from the cache, then ldiskfs will be printing error messages about block counter mismatch. Fixes: 686dee707f ("LU-10026 osd-ldiskfs: use preallocation for dense writes") Signed-off-by: Alex Zhuravlev Change-Id: I93177510af959e849dba7a9c35d81bc27809a31b Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55467 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Artem Blagodarenko Reviewed-by: Oleg Drokin --- ldiskfs/kernel_patches/patches/rhel8/ext4-mballoc-dense.patch | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ldiskfs/kernel_patches/patches/rhel8/ext4-mballoc-dense.patch b/ldiskfs/kernel_patches/patches/rhel8/ext4-mballoc-dense.patch index a3d17ff..e920283 100644 --- a/ldiskfs/kernel_patches/patches/rhel8/ext4-mballoc-dense.patch +++ b/ldiskfs/kernel_patches/patches/rhel8/ext4-mballoc-dense.patch @@ -49,23 +49,21 @@ if (flags & EXT4_GET_BLOCKS_METADATA_NOFAIL) --- linux-4.18.0-80.1.2.el8_0.orig/fs/ext4/mballoc.c +++ linux-4.18.0-80.1.2.el8_0/fs/ext4/mballoc.c -@@ -4267,6 +4291,25 @@ ext4_mb_use_inode_pa(struct ext4 +@@ -4267,6 +4291,23 @@ ext4_mb_use_inode_pa(struct ext4 ext4_fsblk_t end; int len; -+ if (ac->ac_flags & EXT4_MB_VERY_DENSE && !pa->pa_regular) { ++ if (!pa->pa_regular && (ac->ac_flags & EXT4_MB_VERY_DENSE || ++ pa->pa_free != pa->pa_len)) { + unsigned int len = ac->ac_o_ex.fe_len; + if (len > pa->pa_free) + len = pa->pa_free; + ext4_get_group_no_and_offset(ac->ac_sb, -+ pa->pa_pstart, ++ pa->pa_pstart + (pa->pa_len - pa->pa_free), + &ac->ac_b_ex.fe_group, + &ac->ac_b_ex.fe_start); + ac->ac_b_ex.fe_len = len; -+ pa->pa_lstart += len; -+ pa->pa_pstart += len; + pa->pa_free -= len; -+ pa->pa_len -= len; + ac->ac_status = AC_STATUS_FOUND; + ac->ac_pa = pa; + return; -- 1.8.3.1