From dfc22cde5ef2f0b286f0c897cda3e3523239a414 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Thu, 19 Oct 2023 07:49:45 +0300 Subject: [PATCH] EX-8369 ldiskfs: mballoc to store group in pa mballoc should store and then use group number from pa, not calculate it from pa_pstart which change and point to a subsequent group in the case of full pa consumption. Fixes: f36eda6a1e ("LU-10026 osd-ldiskfs: use preallocation for dense writes") Signed-off-by: Alex Zhuravlev Change-Id: I5e3c5c7e51fe9688f4d847a9ea0591486d8975d8 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52754 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo --- .../patches/rhel8/ext4-mballoc-dense.patch | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/ldiskfs/kernel_patches/patches/rhel8/ext4-mballoc-dense.patch b/ldiskfs/kernel_patches/patches/rhel8/ext4-mballoc-dense.patch index e9bd5e6..b11f015 100644 --- a/ldiskfs/kernel_patches/patches/rhel8/ext4-mballoc-dense.patch +++ b/ldiskfs/kernel_patches/patches/rhel8/ext4-mballoc-dense.patch @@ -1,3 +1,13 @@ +--- linux-4.18.0-80.1.2.el8_0.orig/fs/ext4/mballoc.h ++++ linux-4.18.0-80.1.2.el8_0/fs/ext4/mballoc.h +@@ -131,6 +131,7 @@ enum SHIFT_DIRECTION { + ext4_lblk_t pa_lstart; /* log. block */ + ext4_grpblk_t pa_len; /* len of preallocated chunk */ + ext4_grpblk_t pa_free; /* how many blocks are free */ ++ ext4_grpblk_t pa_group; + unsigned short pa_type; /* pa type. inode or group */ + unsigned short pa_error; + spinlock_t *pa_obj_lock; --- linux-4.18.0-80.1.2.el8_0.orig/fs/ext4/ext4.h +++ linux-4.18.0-80.1.2.el8_0/fs/ext4/ext4.h @@ -151,6 +151,7 @@ enum SHIFT_DIRECTION { @@ -76,3 +86,28 @@ /* first, try per-file preallocation */ rcu_read_lock(); list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) { +@@ -4833,7 +4833,7 @@ ext4_mb_put_pa(struct ext4 + if (pa->pa_type == MB_GROUP_PA) + grp_blk--; + +- grp = ext4_get_group_number(sb, grp_blk); ++ grp = pa->pa_group; + + /* + * possible race: +@@ -4894,6 +4894,7 @@ ext4_mb_new_inode_pa(struct ext4 + pa->pa_pstart = ext4_grp_offs_to_block(sb, &ac->ac_b_ex); + pa->pa_len = ac->ac_b_ex.fe_len; + pa->pa_free = pa->pa_len; ++ pa->pa_group = ac->ac_b_ex.fe_group; + spin_lock_init(&pa->pa_lock); + INIT_LIST_HEAD(&pa->pa_inode_list); + INIT_LIST_HEAD(&pa->pa_group_list); +@@ -5004,6 +5005,7 @@ ext4_mb_new_group_pa(struct ext4 + pa->pa_lstart = pa->pa_pstart; + pa->pa_len = ac->ac_b_ex.fe_len; + pa->pa_free = pa->pa_len; ++ pa->pa_group = ac->ac_b_ex.fe_group; + spin_lock_init(&pa->pa_lock); + INIT_LIST_HEAD(&pa->pa_inode_list); + INIT_LIST_HEAD(&pa->pa_group_list); -- 1.8.3.1