From: Andreas Dilger Date: Fri, 14 Dec 2018 22:49:36 +0000 (-0700) Subject: LU-11453 misc: add compat for INIT_LIST_HEAD_RCU X-Git-Tag: 2.12.51~102 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=773e60669b53b0ca2fb48723a21dcddba592af9a LU-11453 misc: add compat for INIT_LIST_HEAD_RCU Add a compat version of INIT_LIST_HEAD_RCU() if unavailable. Fixes: 68bc3984975bb72f730d8a8ab7aa2d836e50abe5 Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I9c1296206e002b895bb6bdf55ddd0d8ec70cab07 Reviewed-on: https://review.whamcloud.com/33875 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 735d0dc..f4d6a25 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1676,6 +1676,27 @@ kiocb_ki_left, [ ]) # LC_KIOCB_KI_LEFT # +# LC_INIT_LIST_HEAD_RCU +# +# 3.12 added INIT_LIST_HEAD_RCU in commit 2a855b644c310d5db5 +# which is unfortunately an inline function and not a macro +# that can be tested directly, so it needs a configure check. +# +AC_DEFUN([LC_INIT_LIST_HEAD_RCU], [ +LB_CHECK_COMPILE([if 'INIT_LIST_HEAD_RCU' exists], +init_list_head_rcu, [ + #include + #include +],[ + struct list_head list; + INIT_LIST_HEAD_RCU(&list); +],[ + AC_DEFINE(HAVE_INIT_LIST_HEAD_RCU, 1, + [INIT_LIST_HEAD_RCU exists]) +]) +]) # LC_INIT_LIST_HEAD_RCU + +# # LC_VFS_RENAME_5ARGS # # 3.13 has vfs_rename with 5 args @@ -3099,6 +3120,7 @@ AC_DEFUN([LC_PROG_LINUX], [ LC_OLDSIZE_TRUNCATE_PAGECACHE LC_PTR_ERR_OR_ZERO_MISSING LC_KIOCB_KI_LEFT + LC_INIT_LIST_HEAD_RCU # 3.13 LC_VFS_RENAME_5ARGS diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index fdb2010..34465f1 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -148,6 +148,14 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt, #define SLAB_DESTROY_BY_RCU 0 #endif +#ifndef HAVE_INIT_LIST_HEAD_RCU +static inline void INIT_LIST_HEAD_RCU(struct list_head *list) +{ + WRITE_ONCE(list->next, list); + WRITE_ONCE(list->prev, list); +} +#endif + #ifndef HAVE_DQUOT_SUSPEND # define ll_vfs_dq_init vfs_dq_init # define ll_vfs_dq_drop vfs_dq_drop