Whamcloud - gitweb
LU-13344 osd-ldiskfs: timespec64 is broken 14/38314/6
authorShaun Tancheff <shaun.tancheff@hpe.com>
Thu, 21 May 2020 15:30:29 +0000 (10:30 -0500)
committerOleg Drokin <green@whamcloud.com>
Fri, 19 Jun 2020 16:50:52 +0000 (16:50 +0000)
Linux commit v5.5-rc1-6-gba70609d5ec6 removed timespec64_trunc
which was being used to determine if inode times were timespec64
Change this test to work with kernels without timespec64_truc

Linux-commit: ba70609d5ec664a8f36ba1c857fcd97a478adf79

Linux commit v5.4-rc3-21-g933f1c1e0b75 renamed h_buffer_credits
to h_total_credits

Add a configure test to determine and #define to handle this
change of name.

Linux-commit: 933f1c1e0b75bbc29730eef07c9e196c6dfd37e5

Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I112da3385e5f33cbee8aadfd3efdbb4b3b823819
Reviewed-on: https://review.whamcloud.com/38314
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
config/lustre-build-ldiskfs.m4
lustre/autoconf/lustre-core.m4
lustre/osd-ldiskfs/osd_internal.h

index 56a43ef..8948c7e 100644 (file)
@@ -340,12 +340,34 @@ ext4fs_dirhash, [
        (void)f;
 ],[
        AC_DEFINE(HAVE_LDISKFSFS_GETHASH_INODE_ARG, 1,
        (void)f;
 ],[
        AC_DEFINE(HAVE_LDISKFSFS_GETHASH_INODE_ARG, 1,
-               [if ldiskfsfs_dirhash takes an inode argument])
+               [ldiskfsfs_dirhash takes an inode argument])
 ])
 EXTRA_KCFLAGS="$tmp_flags"
 ]) # LB_LDISKFSFS_DIRHASH_WANTS_DIR
 
 #
 ])
 EXTRA_KCFLAGS="$tmp_flags"
 ]) # LB_LDISKFSFS_DIRHASH_WANTS_DIR
 
 #
+# LB_JBD2_H_TOTAL_CREDITS
+#
+# kernel 5.5 commit 933f1c1e0b75bbc29730eef07c9e196c6dfd37e5
+# jbd2: Reserve space for revoke descriptor blocks
+#
+AC_DEFUN([LB_JBD2_H_TOTAL_CREDITS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if struct jbd2_journal_handle has h_total_credits member],
+handle_t_h_revoke_credits, [
+       #include <linux/jbd2.h>
+],[
+       int x = offsetof(struct jbd2_journal_handle, h_total_credits);
+       (void)x;
+],[
+       AC_DEFINE(HAVE_JOURNAL_TOTAL_CREDITS, 1,
+               [struct jbd2_journal_handle has h_total_credits member])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LB_JBD2_H_TOTAL_CREDITS
+
+#
 # LB_CONFIG_LDISKFS
 #
 AC_DEFUN([LB_CONFIG_LDISKFS], [
 # LB_CONFIG_LDISKFS
 #
 AC_DEFUN([LB_CONFIG_LDISKFS], [
@@ -396,6 +418,7 @@ AS_IF([test x$enable_ldiskfs != xno],[
        LB_LDISKFS_IGET_HAS_FLAGS_ARG
        LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
        LB_LDISKFSFS_DIRHASH_WANTS_DIR
        LB_LDISKFS_IGET_HAS_FLAGS_ARG
        LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
        LB_LDISKFSFS_DIRHASH_WANTS_DIR
+       LB_JBD2_H_TOTAL_CREDITS
        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])
        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])
index e8e17d7..446598f 100644 (file)
@@ -2004,6 +2004,9 @@ vm_fault_t, [
 # When inode times are timespec64 stop using the deprecated
 # time interfaces.
 #
 # When inode times are timespec64 stop using the deprecated
 # time interfaces.
 #
+# kernel v5.5-rc1-6-gba70609d5ec6 ba70609d5ec664a8f36ba1c857fcd97a478adf79
+# fs: Delete timespec64_trunc()
+#
 AC_DEFUN([LC_INODE_TIMESPEC64], [
 tmp_flags="$EXTRA_KCFLAGS"
 EXTRA_KCFLAGS="-Werror"
 AC_DEFUN([LC_INODE_TIMESPEC64], [
 tmp_flags="$EXTRA_KCFLAGS"
 EXTRA_KCFLAGS="-Werror"
@@ -2012,9 +2015,9 @@ inode_timespec64, [
        #include <linux/fs.h>
 ],[
        struct inode *inode = NULL;
        #include <linux/fs.h>
 ],[
        struct inode *inode = NULL;
-       struct timespec64 ts = {};
+       struct timespec64 ts = {0, 1};
 
 
-       inode->i_atime = timespec64_trunc(ts, 1);
+       inode->i_atime = ts;
        (void)inode;
 ],[
        AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
        (void)inode;
 ],[
        AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
index 0ebba32..7dc4bde 100644 (file)
@@ -578,10 +578,8 @@ int osd_security_file_alloc(struct file *file);
 
 #ifdef HAVE_INODE_TIMESPEC64
 # define osd_timespec                  timespec64
 
 #ifdef HAVE_INODE_TIMESPEC64
 # define osd_timespec                  timespec64
-# define osd_timespec_trunc(ts, gran)  timespec64_trunc((ts), (gran))
 #else
 # define osd_timespec                  timespec
 #else
 # define osd_timespec                  timespec
-# define osd_timespec_trunc(ts, gran)  timespec_trunc((ts), (gran))
 #endif
 
 static inline struct osd_timespec osd_inode_time(struct inode *inode,
 #endif
 
 static inline struct osd_timespec osd_inode_time(struct inode *inode,
@@ -589,7 +587,7 @@ static inline struct osd_timespec osd_inode_time(struct inode *inode,
 {
        struct osd_timespec ts = { .tv_sec = seconds };
 
 {
        struct osd_timespec ts = { .tv_sec = seconds };
 
-       return osd_timespec_trunc(ts, inode->i_sb->s_time_gran);
+       return ts;
 }
 
 #define OSD_INS_CACHE_SIZE     8
 }
 
 #define OSD_INS_CACHE_SIZE     8
@@ -1181,6 +1179,11 @@ static inline void osd_trans_declare_op(const struct lu_env *env,
        oh->ot_credits += credits;
 }
 
        oh->ot_credits += credits;
 }
 
+/* linux: v5.4-rc3-21-g933f1c1e0b75 renamed h_buffer_credits */
+#ifdef HAVE_JOURNAL_TOTAL_CREDITS
+#define h_buffer_credits h_total_credits
+#endif
+
 static inline void osd_trans_exec_op(const struct lu_env *env,
                                     struct thandle *th,
                                     enum osd_op_type op)
 static inline void osd_trans_exec_op(const struct lu_env *env,
                                     struct thandle *th,
                                     enum osd_op_type op)