From 1970a12d7d559dd6d08765047af2b99a3a388524 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Thu, 21 May 2020 10:30:29 -0500 Subject: [PATCH] LU-13344 osd-ldiskfs: timespec64 is broken 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 Change-Id: I112da3385e5f33cbee8aadfd3efdbb4b3b823819 Reviewed-on: https://review.whamcloud.com/38314 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- config/lustre-build-ldiskfs.m4 | 25 ++++++++++++++++++++++++- lustre/autoconf/lustre-core.m4 | 7 +++++-- lustre/osd-ldiskfs/osd_internal.h | 9 ++++++--- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/config/lustre-build-ldiskfs.m4 b/config/lustre-build-ldiskfs.m4 index 56a43ef..8948c7e 100644 --- a/config/lustre-build-ldiskfs.m4 +++ b/config/lustre-build-ldiskfs.m4 @@ -340,12 +340,34 @@ ext4fs_dirhash, [ (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 # +# 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 +],[ + 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], [ @@ -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_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]) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index e8e17d7..446598f 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2004,6 +2004,9 @@ vm_fault_t, [ # 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" @@ -2012,9 +2015,9 @@ inode_timespec64, [ #include ],[ 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, diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index 0ebba32..7dc4bde 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -578,10 +578,8 @@ int osd_security_file_alloc(struct file *file); #ifdef HAVE_INODE_TIMESPEC64 # define osd_timespec timespec64 -# define osd_timespec_trunc(ts, gran) timespec64_trunc((ts), (gran)) #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, @@ -589,7 +587,7 @@ static inline struct osd_timespec osd_inode_time(struct inode *inode, { 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 @@ -1181,6 +1179,11 @@ static inline void osd_trans_declare_op(const struct lu_env *env, 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) -- 1.8.3.1