File 0007-LU-15544-osd-Handle-removal-of-EXT4_GET_BLOCKS_KEEP_.patch of Package lustre_2_15

From 895c1ad51b008d2887e4a0c27d7e456a882a07f6 Mon Sep 17 00:00:00 2001
From: Shaun Tancheff <shaun.tancheff@hpe.com>
Date: Mon, 14 Nov 2022 21:29:50 -0600
Subject: [PATCH 07/30] LU-15544 osd: Handle removal of
 EXT4_GET_BLOCKS_KEEP_SIZE

Linux commit v5.6-rc4-4-g4337ecd1fe99
  ext4: remove EXT4_EOFBLOCKS_FL and associated code

This change removes the define for EXT4_EOFBLOCKS_FL
as well as the enum value EXT_INODE_EOFBLOCKS.

Linux commit v5.7-rc4-4-g9e52484c7133
  ext4: remove EXT4_GET_BLOCKS_KEEP_SIZE flag

This change removes the define for EXT4_GET_BLOCKS_KEEP_SIZE

Fix the usage in osd_io.c to check for the existence of the
related definitions and remove the configure test.

Test-Parameters: trivial
Fixes: 791f656a03 ("LU-14776 ldiskfs: Add Ubuntu 20.04 HWE support")
HPE-bug-id: LUS-10744
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I883708ce2879f4d7d41ad3f7b75db2e751f6eb9b
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49134
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
---
 config/lustre-build-ldiskfs.m4 | 24 ------------------------
 lustre/osd-ldiskfs/osd_io.c    |  4 ++--
 2 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/config/lustre-build-ldiskfs.m4 b/config/lustre-build-ldiskfs.m4
index bd08832bf9e0..e3d43d84c67f 100644
--- a/config/lustre-build-ldiskfs.m4
+++ b/config/lustre-build-ldiskfs.m4
@@ -446,29 +446,6 @@ handle_t_h_revoke_credits, [
 EXTRA_KCFLAGS="$tmp_flags"
 ]) # LB_JBD2_H_TOTAL_CREDITS
 
-#
-# LB_EXT4_GET_BLOCKS_KEEP_SIZE
-#
-# kernel 5.6-rc4 commit 9e52484c713321e84e8834803a44ca0a001376d2
-# ext4: remove EXT4_GET_BLOCKS_KEEP_SIZE flag
-#
-AC_DEFUN([LB_EXT4_GET_BLOCKS_KEEP_SIZE], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if EXT4_GET_BLOCKS_KEEP_SIZE exists],
-ext4_get_blocks_keep_size, [
-	#include <linux/fs.h>
-	#include "$EXT4_SRC_DIR/ext4.h"
-],[
-	int f = EXT4_IGET_SPECIAL;
-	(void)f;
-],[
-	AC_DEFINE(HAVE_LDISKFS_GET_BLOCKS_KEEP_SIZE, 1,
-		[EXT4_GET_BLOCKS_KEEP_SIZE exists])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-]) # LB_EXT4_GET_BLOCKS_KEEP_SIZE
-
 #
 # LB_EXT4_INC_DEC_COUNT_2ARGS
 #
@@ -561,7 +538,6 @@ AS_IF([test x$enable_ldiskfs != xno],[
 	LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
 	LB_LDISKFSFS_DIRHASH_WANTS_DIR
 	LB_JBD2_H_TOTAL_CREDITS
-	LB_EXT4_GET_BLOCKS_KEEP_SIZE
 	LB_EXT4_INC_DEC_COUNT_2ARGS
 	LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
 	AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c
index 74b1d3f9d53f..e7e4beeca8b2 100644
--- a/lustre/osd-ldiskfs/osd_io.c
+++ b/lustre/osd-ldiskfs/osd_io.c
@@ -2313,7 +2313,7 @@ static int osd_fallocate_preallocate(const struct lu_env *env,
 		 !ldiskfs_test_inode_flag(inode, LDISKFS_INODE_EXTENTS)) ?
 		LDISKFS_GET_BLOCKS_CREATE_ZERO :
 		LDISKFS_GET_BLOCKS_CREATE_UNWRIT_EXT;
-#ifndef HAVE_LDISKFS_GET_BLOCKS_KEEP_SIZE
+#ifdef LDISKFS_GET_BLOCKS_KEEP_SIZE
 	if (mode & FALLOC_FL_KEEP_SIZE)
 		flags |= LDISKFS_GET_BLOCKS_KEEP_SIZE;
 #endif
@@ -2378,7 +2378,7 @@ static int osd_fallocate_preallocate(const struct lu_env *env,
 				epos = end;
 			if (ldiskfs_update_inode_size(inode, epos) & 0x1)
 				inode->i_mtime = inode->i_ctime;
-#ifndef HAVE_LDISKFS_GET_BLOCKS_KEEP_SIZE
+#ifdef LDISKFS_EOFBLOCKS_FL
 		} else {
 			if (epos > inode->i_size)
 				ldiskfs_set_inode_flag(inode,
-- 
2.38.1

openSUSE Build Service is sponsored by