From 68d96d2f650a6d9ae04e48eac9c66b2cd4be0a23 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Sat, 12 Mar 2022 00:14:39 +0700 Subject: [PATCH] LU-15635 ldiskfs: Interface change fix server v5.10 Linux v5.9-rc7-8-g15ed2851b0f4 ext4: remove unused argument from ext4_(inc|dec)_count Test for ext4_inc_count with 2 arguments and provide a compat wrapper for ldiskfs_inc|dec_count that discards handle has needed. HPE-bug-id: LUS-10808 Fixes: c93a3e5b15 ("LU-14195 ldiskfs: update patches for Linux 5.10") Signed-off-by: Shaun Tancheff Change-Id: I48fb52e67ad334e2fc0c045e96fc5dffd3243842 Reviewed-on: https://review.whamcloud.com/46775 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- config/lustre-build-ldiskfs.m4 | 20 +++++- .../patches/linux-5.10/ext4-misc.patch | 73 ++++++++++++---------- .../patches/linux-5.8/ext4-misc.patch | 4 +- .../kernel_patches/patches/rhel7.6/ext4-misc.patch | 4 +- .../kernel_patches/patches/rhel7.7/ext4-misc.patch | 4 +- .../kernel_patches/patches/rhel8.1/ext4-misc.patch | 4 +- .../kernel_patches/patches/rhel8.3/ext4-misc.patch | 4 +- .../kernel_patches/patches/rhel8/ext4-misc.patch | 4 +- .../patches/sles15sp1/ext4-misc.patch | 4 +- .../kernel_patches/patches/suse15/ext4-misc.patch | 4 +- .../patches/ubuntu18/ext4-misc.patch | 4 +- .../patches/ubuntu19/ext4-misc.patch | 4 +- .../patches/ubuntu2004/ext4-misc.patch | 4 +- lustre/osd-ldiskfs/osd_compat.c | 4 +- lustre/osd-ldiskfs/osd_handler.c | 4 +- lustre/osd-ldiskfs/osd_internal.h | 9 ++- 16 files changed, 103 insertions(+), 51 deletions(-) diff --git a/config/lustre-build-ldiskfs.m4 b/config/lustre-build-ldiskfs.m4 index cc32f68..87d4bcf 100644 --- a/config/lustre-build-ldiskfs.m4 +++ b/config/lustre-build-ldiskfs.m4 @@ -463,12 +463,29 @@ ext4_get_blocks_keep_size, [ (void)f; ],[ AC_DEFINE(HAVE_LDISKFS_GET_BLOCKS_KEEP_SIZE, 1, - [EXT4_GET_BLOCKS_KEEP_SIZE hasn't been removed]) + [EXT4_GET_BLOCKS_KEEP_SIZE exists]) ]) EXTRA_KCFLAGS="$tmp_flags" ]) # LB_EXT4_GET_BLOCKS_KEEP_SIZE # +# LB_EXT4_INC_DEC_COUNT_2ARGS +# +# Linux v5.9-rc7-8-g15ed2851b0f4 +# ext4: remove unused argument from ext4_(inc|dec)_count +# +AC_DEFUN([LB_EXT4_INC_DEC_COUNT_2ARGS], [ + AC_MSG_CHECKING([if ext4_(inc|dec)_count() have 2 arguments]) + AS_IF([grep -q -E 'void ext4_inc_count.handle_t \*handle' $EXT4_SRC_DIR/namei.c],[ + AC_DEFINE(HAVE_EXT4_INC_DEC_COUNT_2ARGS, 1, + [ext4_(inc|dec)_count() has 2 arguments]) + AC_MSG_RESULT(yes) + ],[ + AC_MSG_RESULT(no) + ]) +]) # LB_EXT4_INC_DEC_COUNT_2ARGS + +# # LB_CONFIG_LDISKFS # AC_DEFUN([LB_CONFIG_LDISKFS], [ @@ -522,6 +539,7 @@ AS_IF([test x$enable_ldiskfs != xno],[ LB_LDISKFSFS_DIRHASH_WANTS_DIR LB_JBD2_H_TOTAL_CREDITS LB_EXT4_GET_BLOCKS_KEEP_SIZE + LB_EXT4_INC_DEC_COUNT_2ARGS AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs]) AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs]) AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs]) diff --git a/ldiskfs/kernel_patches/patches/linux-5.10/ext4-misc.patch b/ldiskfs/kernel_patches/patches/linux-5.10/ext4-misc.patch index 2f0cab7..b694fd4 100644 --- a/ldiskfs/kernel_patches/patches/linux-5.10/ext4-misc.patch +++ b/ldiskfs/kernel_patches/patches/linux-5.10/ext4-misc.patch @@ -1,15 +1,16 @@ --- - fs/ext4/ext4.h | 29 ++++++++++++++++++++++- - fs/ext4/ialloc.c | 3 ++- - fs/ext4/inode.c | 15 +++++++++++++++ - fs/ext4/namei.c | 9 ++++++--- - fs/ext4/super.c | 10 ++-------- - 5 files changed, 47 insertions(+), 13 deletions(-) + fs/ext4/ext4.h | 25 ++++++++++++++++++++++++- + fs/ext4/ialloc.c | 3 ++- + fs/ext4/inode.c | 16 ++++++++++++++++ + fs/ext4/namei.c | 9 ++++++--- + fs/ext4/super.c | 10 ++-------- + 5 files changed, 50 insertions(+), 13 deletions(-) -diff -ur a/fs/ext4/ext4.h b/fs/ext4/ext4.h ---- a/fs/ext4/ext4.h 2021-12-09 07:30:00.134965109 -0700 -+++ b/fs/ext4/ext4.h 2021-12-09 07:32:16.038650421 -0700 -@@ -1849,6 +1849,8 @@ +diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h +index 2c8b1ae..1d80381 100644 +--- a/fs/ext4/ext4.h ++++ b/fs/ext4/ext4.h +@@ -1849,6 +1849,8 @@ static inline bool ext4_verity_in_progress(struct inode *inode) #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime @@ -18,7 +19,7 @@ diff -ur a/fs/ext4/ext4.h b/fs/ext4/ext4.h /* * Codes for operating systems */ -@@ -2089,7 +2091,21 @@ +@@ -2089,7 +2091,21 @@ static inline bool ext4_has_unknown_ext##ver##_incompat_features(struct super_bl EXTN_FEATURE_FUNCS(2) EXTN_FEATURE_FUNCS(3) @@ -41,22 +42,25 @@ diff -ur a/fs/ext4/ext4.h b/fs/ext4/ext4.h static inline bool ext4_has_compat_features(struct super_block *sb) { -@@ -3554,6 +3575,11 @@ +@@ -3554,6 +3570,13 @@ struct ext4_extent; #define EXT_MAX_BLOCKS 0xffffffff extern void ext4_ext_tree_init(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb, + ext4_group_t block_group); ++extern void ext4_inc_count(struct inode *inode); ++extern void ext4_dec_count(struct inode *inode); +extern struct buffer_head *ext4_append(handle_t *handle, + struct inode *inode, + ext4_lblk_t *block); extern int ext4_ext_index_trans_blocks(struct inode *inode, int extents); extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, struct ext4_map_blocks *map, int flags); -diff -ur a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c ---- a/fs/ext4/ialloc.c 2021-12-09 07:30:00.086965299 -0700 -+++ b/fs/ext4/ialloc.c 2021-12-09 07:30:47.418778395 -0700 -@@ -120,7 +120,7 @@ +diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c +index 221d849..e83c30e 100644 +--- a/fs/ext4/ialloc.c ++++ b/fs/ext4/ialloc.c +@@ -120,7 +120,7 @@ verified: * * Return buffer_head of bitmap on success, or an ERR_PTR on error. */ @@ -65,7 +69,7 @@ diff -ur a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) { struct ext4_group_desc *desc; -@@ -215,6 +215,7 @@ +@@ -215,6 +215,7 @@ out: put_bh(bh); return ERR_PTR(err); } @@ -73,10 +77,11 @@ diff -ur a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c /* * NOTE! When we get the inode, we're the only people -diff -ur a/fs/ext4/inode.c b/fs/ext4/inode.c ---- a/fs/ext4/inode.c 2021-12-09 07:30:00.126965141 -0700 -+++ b/fs/ext4/inode.c 2021-12-09 07:30:47.422778379 -0700 -@@ -6197,3 +6197,19 @@ +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index ea9976b..e3630b0 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -6206,3 +6206,19 @@ vm_fault_t ext4_filemap_fault(struct vm_fault *vmf) return ret; } @@ -96,9 +101,10 @@ diff -ur a/fs/ext4/inode.c b/fs/ext4/inode.c +EXPORT_SYMBOL(ext4fs_dirhash); +EXPORT_SYMBOL(ext4_get_inode_loc); +EXPORT_SYMBOL(__ext4_journal_ensure_credits); -diff -ur a/fs/ext4/namei.c b/fs/ext4/namei.c ---- a/fs/ext4/namei.c 2021-12-09 07:30:00.138965094 -0700 -+++ b/fs/ext4/namei.c 2021-12-09 07:30:47.426778363 -0700 +diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c +index f09b60b..ff6c251 100644 +--- a/fs/ext4/namei.c ++++ b/fs/ext4/namei.c @@ -50,7 +50,7 @@ #define NAMEI_RA_BLOCKS 4 #define NAMEI_RA_SIZE (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS) @@ -108,7 +114,7 @@ diff -ur a/fs/ext4/namei.c b/fs/ext4/namei.c struct inode *inode, ext4_lblk_t *block) { -@@ -181,6 +181,7 @@ +@@ -181,6 +181,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode, } return bh; } @@ -116,7 +122,7 @@ diff -ur a/fs/ext4/namei.c b/fs/ext4/namei.c #ifndef assert #define assert(test) J_ASSERT(test) -@@ -2575,23 +2576,25 @@ +@@ -2578,23 +2579,25 @@ EXPORT_SYMBOL(ext4_delete_entry); * for checking S_ISDIR(inode) (since the INODE_INDEX feature will not be set * on regular files) and to avoid creating huge/slow non-HTREE directories. */ @@ -144,10 +150,11 @@ diff -ur a/fs/ext4/namei.c b/fs/ext4/namei.c /* -diff -ur a/fs/ext4/super.c b/fs/ext4/super.c ---- a/fs/ext4/super.c 2021-12-09 07:30:00.050965441 -0700 -+++ b/fs/ext4/super.c 2021-12-09 07:30:47.426778363 -0700 -@@ -435,7 +435,7 @@ +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index ea5aefa..056009e 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -435,7 +435,7 @@ static void __save_error_info(struct super_block *sb, int error, return; es->s_state |= cpu_to_le16(EXT4_ERROR_FS); ext4_update_tstamp(es, s_last_error_time); @@ -156,7 +163,7 @@ diff -ur a/fs/ext4/super.c b/fs/ext4/super.c es->s_last_error_line = cpu_to_le32(line); es->s_last_error_ino = cpu_to_le32(ino); es->s_last_error_block = cpu_to_le64(block); -@@ -496,7 +496,7 @@ +@@ -496,7 +496,7 @@ static void __save_error_info(struct super_block *sb, int error, if (!es->s_first_error_time) { es->s_first_error_time = es->s_last_error_time; es->s_first_error_time_hi = es->s_last_error_time_hi; @@ -165,7 +172,7 @@ diff -ur a/fs/ext4/super.c b/fs/ext4/super.c sizeof(es->s_first_error_func)); es->s_first_error_line = cpu_to_le32(line); es->s_first_error_ino = es->s_last_error_ino; -@@ -6683,16 +6683,12 @@ +@@ -6673,16 +6673,12 @@ static int __init ext4_init_fs(void) if (err) goto out05; @@ -182,7 +189,7 @@ diff -ur a/fs/ext4/super.c b/fs/ext4/super.c out05: destroy_inodecache(); out1: -@@ -6716,8 +6712,6 @@ +@@ -6706,8 +6702,6 @@ out7: static void __exit ext4_exit_fs(void) { ext4_destroy_lazyinit_thread(); diff --git a/ldiskfs/kernel_patches/patches/linux-5.8/ext4-misc.patch b/ldiskfs/kernel_patches/patches/linux-5.8/ext4-misc.patch index 463fd12..3766f07 100644 --- a/ldiskfs/kernel_patches/patches/linux-5.8/ext4-misc.patch +++ b/ldiskfs/kernel_patches/patches/linux-5.8/ext4-misc.patch @@ -42,12 +42,14 @@ diff -ur a/fs/ext4/ext4.h b/fs/ext4/ext4.h static inline bool ext4_has_compat_features(struct super_block *sb) { -@@ -3399,6 +3415,11 @@ +@@ -3399,6 +3415,13 @@ #define EXT_MAX_BLOCKS 0xffffffff extern void ext4_ext_tree_init(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb, + ext4_group_t block_group); ++extern void ext4_inc_count(handle_t *handle, struct inode *inode); ++extern void ext4_dec_count(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_append(handle_t *handle, + struct inode *inode, + ext4_lblk_t *block); diff --git a/ldiskfs/kernel_patches/patches/rhel7.6/ext4-misc.patch b/ldiskfs/kernel_patches/patches/rhel7.6/ext4-misc.patch index f19455d..bbcfc7e 100644 --- a/ldiskfs/kernel_patches/patches/rhel7.6/ext4-misc.patch +++ b/ldiskfs/kernel_patches/patches/rhel7.6/ext4-misc.patch @@ -11,12 +11,14 @@ Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/ext4.h /* * Codes for operating systems */ -@@ -2612,6 +2614,11 @@ struct ext4_extent; +@@ -2612,6 +2614,13 @@ struct ext4_extent; extern int ext4_ext_tree_init(handle_t *handle, struct inode *); extern int ext4_ext_writepage_trans_blocks(struct inode *, int); +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb, + ext4_group_t block_group); ++extern void ext4_inc_count(handle_t *handle, struct inode *inode); ++extern void ext4_dec_count(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_append(handle_t *handle, + struct inode *inode, + ext4_lblk_t *block); diff --git a/ldiskfs/kernel_patches/patches/rhel7.7/ext4-misc.patch b/ldiskfs/kernel_patches/patches/rhel7.7/ext4-misc.patch index 065c814..20fcf26 100644 --- a/ldiskfs/kernel_patches/patches/rhel7.7/ext4-misc.patch +++ b/ldiskfs/kernel_patches/patches/rhel7.7/ext4-misc.patch @@ -11,12 +11,14 @@ Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/ext4.h /* * Codes for operating systems */ -@@ -2612,6 +2614,11 @@ struct ext4_extent; +@@ -2612,6 +2614,13 @@ struct ext4_extent; extern int ext4_ext_tree_init(handle_t *handle, struct inode *); extern int ext4_ext_writepage_trans_blocks(struct inode *, int); +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb, + ext4_group_t block_group); ++extern void ext4_inc_count(handle_t *handle, struct inode *inode); ++extern void ext4_dec_count(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_append(handle_t *handle, + struct inode *inode, + ext4_lblk_t *block); diff --git a/ldiskfs/kernel_patches/patches/rhel8.1/ext4-misc.patch b/ldiskfs/kernel_patches/patches/rhel8.1/ext4-misc.patch index 7dac806..baeff91 100644 --- a/ldiskfs/kernel_patches/patches/rhel8.1/ext4-misc.patch +++ b/ldiskfs/kernel_patches/patches/rhel8.1/ext4-misc.patch @@ -34,12 +34,14 @@ Index: linux-4.18.0-80.1.2.el8_0/fs/ext4/ext4.h static inline bool ext4_has_compat_features(struct super_block *sb) { -@@ -3111,6 +3127,11 @@ struct ext4_extent; +@@ -3111,6 +3127,13 @@ struct ext4_extent; extern int ext4_ext_tree_init(handle_t *handle, struct inode *); extern int ext4_ext_writepage_trans_blocks(struct inode *, int); +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb, + ext4_group_t block_group); ++extern void ext4_inc_count(handle_t *handle, struct inode *inode); ++extern void ext4_dec_count(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_append(handle_t *handle, + struct inode *inode, + ext4_lblk_t *block); diff --git a/ldiskfs/kernel_patches/patches/rhel8.3/ext4-misc.patch b/ldiskfs/kernel_patches/patches/rhel8.3/ext4-misc.patch index 8cefb24..47e6bb6 100644 --- a/ldiskfs/kernel_patches/patches/rhel8.3/ext4-misc.patch +++ b/ldiskfs/kernel_patches/patches/rhel8.3/ext4-misc.patch @@ -34,12 +34,14 @@ Index: linux-4.18.0-80.1.2.el8_0/fs/ext4/ext4.h static inline bool ext4_has_compat_features(struct super_block *sb) { -@@ -3111,6 +3127,11 @@ struct ext4_extent; +@@ -3111,6 +3127,13 @@ struct ext4_extent; extern int ext4_ext_tree_init(handle_t *handle, struct inode *); extern int ext4_ext_writepage_trans_blocks(struct inode *, int); +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb, + ext4_group_t block_group); ++extern void ext4_inc_count(handle_t *handle, struct inode *inode); ++extern void ext4_dec_count(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_append(handle_t *handle, + struct inode *inode, + ext4_lblk_t *block); diff --git a/ldiskfs/kernel_patches/patches/rhel8/ext4-misc.patch b/ldiskfs/kernel_patches/patches/rhel8/ext4-misc.patch index d15042c..90d4626 100644 --- a/ldiskfs/kernel_patches/patches/rhel8/ext4-misc.patch +++ b/ldiskfs/kernel_patches/patches/rhel8/ext4-misc.patch @@ -34,12 +34,14 @@ Index: linux-4.18.0-80.1.2.el8_0/fs/ext4/ext4.h static inline bool ext4_has_compat_features(struct super_block *sb) { -@@ -3111,6 +3127,11 @@ struct ext4_extent; +@@ -3111,6 +3127,13 @@ struct ext4_extent; extern int ext4_ext_tree_init(handle_t *handle, struct inode *); extern int ext4_ext_writepage_trans_blocks(struct inode *, int); +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb, + ext4_group_t block_group); ++extern void ext4_inc_count(handle_t *handle, struct inode *inode); ++extern void ext4_dec_count(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_append(handle_t *handle, + struct inode *inode, + ext4_lblk_t *block); diff --git a/ldiskfs/kernel_patches/patches/sles15sp1/ext4-misc.patch b/ldiskfs/kernel_patches/patches/sles15sp1/ext4-misc.patch index 395ef2c..7f94909 100644 --- a/ldiskfs/kernel_patches/patches/sles15sp1/ext4-misc.patch +++ b/ldiskfs/kernel_patches/patches/sles15sp1/ext4-misc.patch @@ -40,12 +40,14 @@ static inline bool ext4_has_compat_features(struct super_block *sb) { -@@ -3133,6 +3149,11 @@ struct ext4_extent; +@@ -3133,6 +3149,13 @@ struct ext4_extent; extern int ext4_ext_tree_init(handle_t *handle, struct inode *); extern int ext4_ext_writepage_trans_blocks(struct inode *, int); +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb, + ext4_group_t block_group); ++extern void ext4_inc_count(handle_t *handle, struct inode *inode); ++extern void ext4_dec_count(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_append(handle_t *handle, + struct inode *inode, + ext4_lblk_t *block); diff --git a/ldiskfs/kernel_patches/patches/suse15/ext4-misc.patch b/ldiskfs/kernel_patches/patches/suse15/ext4-misc.patch index adadf13..7f2b6d3 100644 --- a/ldiskfs/kernel_patches/patches/suse15/ext4-misc.patch +++ b/ldiskfs/kernel_patches/patches/suse15/ext4-misc.patch @@ -40,12 +40,14 @@ static inline bool ext4_has_compat_features(struct super_block *sb) { -@@ -3133,6 +3149,11 @@ struct ext4_extent; +@@ -3133,6 +3149,13 @@ struct ext4_extent; extern int ext4_ext_tree_init(handle_t *handle, struct inode *); extern int ext4_ext_writepage_trans_blocks(struct inode *, int); +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb, + ext4_group_t block_group); ++extern void ext4_inc_count(handle_t *handle, struct inode *inode); ++extern void ext4_dec_count(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_append(handle_t *handle, + struct inode *inode, + ext4_lblk_t *block); diff --git a/ldiskfs/kernel_patches/patches/ubuntu18/ext4-misc.patch b/ldiskfs/kernel_patches/patches/ubuntu18/ext4-misc.patch index 3ace5eb..77591ab 100644 --- a/ldiskfs/kernel_patches/patches/ubuntu18/ext4-misc.patch +++ b/ldiskfs/kernel_patches/patches/ubuntu18/ext4-misc.patch @@ -34,12 +34,14 @@ Index: linux-4.15.0/fs/ext4/ext4.h static inline bool ext4_has_compat_features(struct super_block *sb) { -@@ -3103,6 +3119,11 @@ struct ext4_extent; +@@ -3103,6 +3119,13 @@ struct ext4_extent; extern int ext4_ext_tree_init(handle_t *handle, struct inode *); extern int ext4_ext_writepage_trans_blocks(struct inode *, int); +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb, + ext4_group_t block_group); ++extern void ext4_inc_count(handle_t *handle, struct inode *inode); ++extern void ext4_dec_count(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_append(handle_t *handle, + struct inode *inode, + ext4_lblk_t *block); diff --git a/ldiskfs/kernel_patches/patches/ubuntu19/ext4-misc.patch b/ldiskfs/kernel_patches/patches/ubuntu19/ext4-misc.patch index 9ef9fe6..3076c803 100644 --- a/ldiskfs/kernel_patches/patches/ubuntu19/ext4-misc.patch +++ b/ldiskfs/kernel_patches/patches/ubuntu19/ext4-misc.patch @@ -34,12 +34,14 @@ index 0df15ed..da97ee5 100644 static inline bool ext4_has_compat_features(struct super_block *sb) { -@@ -3136,6 +3152,11 @@ struct ext4_extent; +@@ -3136,6 +3152,13 @@ struct ext4_extent; extern int ext4_ext_tree_init(handle_t *handle, struct inode *); extern int ext4_ext_writepage_trans_blocks(struct inode *, int); +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb, + ext4_group_t block_group); ++extern void ext4_inc_count(handle_t *handle, struct inode *inode); ++extern void ext4_dec_count(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_append(handle_t *handle, + struct inode *inode, + ext4_lblk_t *block); diff --git a/ldiskfs/kernel_patches/patches/ubuntu2004/ext4-misc.patch b/ldiskfs/kernel_patches/patches/ubuntu2004/ext4-misc.patch index 1fe02a0..c6fe6a5 100644 --- a/ldiskfs/kernel_patches/patches/ubuntu2004/ext4-misc.patch +++ b/ldiskfs/kernel_patches/patches/ubuntu2004/ext4-misc.patch @@ -34,12 +34,14 @@ Index: linux-4.18.0-80.1.2.el8_0/fs/ext4/ext4.h static inline bool ext4_has_compat_features(struct super_block *sb) { -@@ -3111,6 +3127,11 @@ struct ext4_extent; +@@ -3111,6 +3127,13 @@ struct ext4_extent; extern int ext4_ext_tree_init(handle_t *handle, struct inode *); extern int ext4_ext_writepage_trans_blocks(struct inode *, int); +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb, + ext4_group_t block_group); ++extern void ext4_inc_count(handle_t *handle, struct inode *inode); ++extern void ext4_dec_count(handle_t *handle, struct inode *inode); +extern struct buffer_head *ext4_append(handle_t *handle, + struct inode *inode, + ext4_lblk_t *block); diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c index 80a87a0..e60b228 100644 --- a/lustre/osd-ldiskfs/osd_compat.c +++ b/lustre/osd-ldiskfs/osd_compat.c @@ -358,7 +358,7 @@ int osd_add_to_remote_parent(const struct lu_env *env, struct osd_device *osd, rc = osd_ldiskfs_add_entry(info, osd, oh->ot_handle, dentry, obj->oo_inode, NULL); if (!rc && S_ISDIR(obj->oo_inode->i_mode)) - ldiskfs_inc_count(oh->ot_handle, parent->d_inode); + osd_ldiskfs_inc_count(oh->ot_handle, parent->d_inode); else if (unlikely(rc == -EEXIST)) rc = 0; if (!rc) @@ -401,7 +401,7 @@ int osd_delete_from_remote_parent(const struct lu_env *env, rc = ldiskfs_delete_entry(oh->ot_handle, parent->d_inode, de, bh); if (!rc && S_ISDIR(obj->oo_inode->i_mode)) - ldiskfs_dec_count(oh->ot_handle, parent->d_inode); + osd_ldiskfs_dec_count(oh->ot_handle, parent->d_inode); mark_inode_dirty(parent->d_inode); inode_unlock(parent->d_inode); brelse(bh); diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index c0f3da9..5b034cc 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -4269,7 +4269,7 @@ static int osd_ref_add(const struct lu_env *env, struct dt_object *dt, /* inc_nlink from 0 may cause WARN_ON */ set_nlink(inode, 1); else { - ldiskfs_inc_count(oh->ot_handle, inode); + osd_ldiskfs_inc_count(oh->ot_handle, inode); if (!S_ISDIR(inode->i_mode)) LASSERT(inode->i_nlink <= LDISKFS_LINK_MAX); } @@ -4348,7 +4348,7 @@ static int osd_ref_del(const struct lu_env *env, struct dt_object *dt, CDEBUG(D_INODE, DFID" decrease nlink %d\n", PFID(lu_object_fid(&dt->do_lu)), inode->i_nlink); - ldiskfs_dec_count(oh->ot_handle, inode); + osd_ldiskfs_dec_count(oh->ot_handle, inode); spin_unlock(&obj->oo_guard); osd_dirty_inode(inode, I_DIRTY_DATASYNC); diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index b77ade7..4ca7656 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -1493,8 +1493,13 @@ bool bio_integrity_enabled(struct bio *bio); # define bio_get_queue(bio) (bio_get_disk(bio)->queue) #endif -void ldiskfs_inc_count(handle_t *handle, struct inode *inode); -void ldiskfs_dec_count(handle_t *handle, struct inode *inode); +#ifdef HAVE_EXT4_INC_DEC_COUNT_2ARGS +#define osd_ldiskfs_inc_count(h, inode) ldiskfs_inc_count((h), (inode)) +#define osd_ldiskfs_dec_count(h, inode) ldiskfs_dec_count((h), (inode)) +#else +#define osd_ldiskfs_inc_count(h, inode) ldiskfs_inc_count((inode)) +#define osd_ldiskfs_dec_count(h, inode) ldiskfs_dec_count((inode)) +#endif /* HAVE_EXT4_INC_DEC_COUNT_2ARGS */ void osd_fini_iobuf(struct osd_device *d, struct osd_iobuf *iobuf); -- 1.8.3.1