Whamcloud - gitweb
LU-3963 libcfs: remove invalid cfs_hlist_for_each_* checks 05/11005/9
authorJames Simmons <uja.ornl@gmail.com>
Fri, 15 Aug 2014 16:32:35 +0000 (12:32 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 25 Aug 2014 16:58:21 +0000 (16:58 +0000)
For newer kernels cfs_hlist_for_each_entry* changed the
number of arguments so in this case lustre still needs
wrappers. The HPDD script to test decrepit wrappers
incorrectly complains about cfs_hlist_for_* functions
that are required. Added some more wrappers to deal with
kernel api change that were missing before.

Change-Id: Idda94c147f2e3e9c138ee50c242604494041c244
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-on: http://review.whamcloud.com/11005
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
contrib/scripts/checkpatch.pl
libcfs/include/libcfs/list.h
lustre/llite/remote_perm.c
lustre/obdclass/capa.c
lustre/ptlrpc/gss/gss_keyring.c
lustre/ptlrpc/gss/gss_pipefs.c

index b91310a..f701b20 100755 (executable)
@@ -389,13 +389,6 @@ my %dep_functions = (
        'cfs_hlist_empty',              'hlist_empty',
        'cfs_hlist_entry',              'hlist_entry',
        'cfs_hlist_for_each',           'hlist_for_each',
-       'cfs_hlist_for_each_entry',     'hlist_for_each_entry',
-       'cfs_hlist_for_each_entry_continue',
-                                       'hlist_for_each_entry_continue',
-       'cfs_hlist_for_each_entry_from',
-                                       'hlist_for_each_entry_from',
-       'cfs_hlist_for_each_entry_safe',
-                                       'hlist_for_each_entry_safe',
        'cfs_hlist_for_each_safe',      'hlist_for_each_safe',
        'cfs_hlist_head_t',             'struct hlist_head',
        'cfs_hlist_node_t',             'struct hlist_node',
index f9652a1..6dca9ad 100644 (file)
@@ -569,23 +569,22 @@ typedef struct hlist_node cfs_hlist_node_t;
        hlist_for_each_safe(pos, n, head)
 #ifdef HAVE_HLIST_FOR_EACH_3ARG
 #define cfs_hlist_for_each_entry(tpos, pos, head, member) \
-       pos = NULL; hlist_for_each_entry(tpos, head, member)
-#else
-#define cfs_hlist_for_each_entry(tpos, pos, head, member) \
-       hlist_for_each_entry(tpos, pos, head, member)
-#endif
+       hlist_for_each_entry(tpos, head, member)
+#define cfs_hlist_for_each_entry_safe(tpos, pos, n, head, member) \
+       hlist_for_each_entry_safe(tpos, n, head, member)
 #define cfs_hlist_for_each_entry_continue(tpos, pos, member) \
-       hlist_for_each_entry_continue(tpos, pos, member)
+       hlist_for_each_entry_continue(tpos, member)
 #define cfs_hlist_for_each_entry_from(tpos, pos, member) \
-       hlist_for_each_entry_from(tpos, pos, member)
-#ifdef HAVE_HLIST_FOR_EACH_3ARG
-#define cfs_hlist_for_each_entry_safe(tpos, pos, n, head, member) \
-       pos = NULL; hlist_for_each_entry_safe(tpos, n, head, member)
+       hlist_for_each_entry_from(tpos, member)
 #else
 #define cfs_hlist_for_each_entry(tpos, pos, head, member) \
        hlist_for_each_entry(tpos, pos, head, member)
 #define cfs_hlist_for_each_entry_safe(tpos, pos, n, head, member) \
        hlist_for_each_entry_safe(tpos, pos, n, head, member)
+#define cfs_hlist_for_each_entry_continue(tpos, pos, member) \
+       hlist_for_each_entry_continue(tpos, pos, member)
+#define cfs_hlist_for_each_entry_from(tpos, pos, member) \
+       hlist_for_each_entry_from(tpos, pos, member)
 #endif
 
 #define cfs_list_for_each_entry_typed(pos, head, type, member) \
index 52d09bb..0738182 100644 (file)
@@ -97,9 +97,10 @@ static struct hlist_head *alloc_rmtperm_hash(void)
 
 void free_rmtperm_hash(struct hlist_head *hash)
 {
-        int i;
-        struct ll_remote_perm *lrp;
-       struct hlist_node *node, *next;
+       int i;
+       struct ll_remote_perm *lrp;
+       struct hlist_node __maybe_unused *node;
+       struct hlist_node *next;
 
         if(!hash)
                 return;
@@ -122,10 +123,10 @@ static inline int remote_perm_hashfunc(uid_t uid)
 static int do_check_remote_perm(struct ll_inode_info *lli, int mask)
 {
        struct hlist_head *head;
-        struct ll_remote_perm *lrp;
-       struct hlist_node *node;
-        int found = 0, rc;
-        ENTRY;
+       struct ll_remote_perm *lrp;
+       struct hlist_node __maybe_unused *node;
+       int found = 0, rc;
+       ENTRY;
 
        if (!lli->lli_remote_perms)
                RETURN(-ENOENT);
@@ -162,11 +163,11 @@ out:
 
 int ll_update_remote_perm(struct inode *inode, struct mdt_remote_perm *perm)
 {
-        struct ll_inode_info *lli = ll_i2info(inode);
-        struct ll_remote_perm *lrp = NULL, *tmp = NULL;
+       struct ll_inode_info *lli = ll_i2info(inode);
+       struct ll_remote_perm *lrp = NULL, *tmp = NULL;
        struct hlist_head *head, *perm_hash = NULL;
-       struct hlist_node *node;
-        ENTRY;
+       struct hlist_node __maybe_unused *node;
+       ENTRY;
 
         LASSERT(ll_i2sbi(inode)->ll_flags & LL_SBI_RMT_CLIENT);
 
index 5b5b3b1..fa9d86a 100644 (file)
@@ -119,9 +119,10 @@ static inline void capa_delete(struct obd_capa *ocapa)
 
 void cleanup_capa_hash(struct hlist_head *hash)
 {
-       int i;
-       struct hlist_node *pos, *next;
+       struct hlist_node __maybe_unused *pos;
+       struct hlist_node *next;
        struct obd_capa *oc;
+       int i;
 
        spin_lock(&capa_lock);
        for (i = 0; i < NR_CAPAHASH; i++) {
@@ -153,16 +154,16 @@ static inline int capa_is_to_expire(struct obd_capa *oc)
 static struct obd_capa *find_capa(struct lustre_capa *capa,
                                  struct hlist_head *head, int alive)
 {
-       struct hlist_node *pos;
-        struct obd_capa *ocapa;
-        int len = alive ? offsetof(struct lustre_capa, lc_keyid):sizeof(*capa);
-
-        cfs_hlist_for_each_entry(ocapa, pos, head, u.tgt.c_hash) {
-                if (memcmp(&ocapa->c_capa, capa, len))
-                        continue;
-                /* don't return one that will expire soon in this case */
-                if (alive && capa_is_to_expire(ocapa))
-                        continue;
+       struct hlist_node __maybe_unused *pos;
+       struct obd_capa *ocapa;
+       int len = alive ? offsetof(struct lustre_capa, lc_keyid):sizeof(*capa);
+
+       cfs_hlist_for_each_entry(ocapa, pos, head, u.tgt.c_hash) {
+               if (memcmp(&ocapa->c_capa, capa, len))
+                       continue;
+               /* don't return one that will expire soon in this case */
+               if (alive && capa_is_to_expire(ocapa))
+                       continue;
 
                 LASSERT(capa_on_server(ocapa));
 
index 0bd3a1e..407b594 100644 (file)
@@ -444,12 +444,12 @@ static void kill_key_locked(struct key *key)
  */
 static void dispose_ctx_list_kr(cfs_hlist_head_t *freelist)
 {
-        cfs_hlist_node_t       *pos, *next;
-        struct ptlrpc_cli_ctx  *ctx;
-        struct gss_cli_ctx     *gctx;
+       struct hlist_node       __maybe_unused *pos, *next;
+       struct ptlrpc_cli_ctx   *ctx;
+       struct gss_cli_ctx      *gctx;
 
-        cfs_hlist_for_each_entry_safe(ctx, pos, next, freelist, cc_cache) {
-                cfs_hlist_del_init(&ctx->cc_cache);
+       cfs_hlist_for_each_entry_safe(ctx, pos, next, freelist, cc_cache) {
+               hlist_del_init(&ctx->cc_cache);
 
                /* reverse ctx: update current seq to buddy svcctx if exist.
                 * ideally this should be done at gss_cli_ctx_finalize(), but
@@ -491,8 +491,8 @@ struct ptlrpc_cli_ctx * sec_lookup_root_ctx_kr(struct ptlrpc_sec *sec)
         ctx = gsec_kr->gsk_root_ctx;
 
         if (ctx == NULL && unlikely(sec_is_reverse(sec))) {
-                cfs_hlist_node_t       *node;
-                struct ptlrpc_cli_ctx  *tmp;
+               struct hlist_node       __maybe_unused *node;
+               struct ptlrpc_cli_ctx   *tmp;
 
                 /* reverse ctx, search root ctx in list, choose the one
                  * with shortest expire time, which is most possibly have
@@ -526,11 +526,11 @@ void rvs_sec_install_root_ctx_kr(struct ptlrpc_sec *sec,
                                  struct ptlrpc_cli_ctx *new_ctx,
                                  struct key *key)
 {
-        struct gss_sec_keyring *gsec_kr = sec2gsec_keyring(sec);
-        cfs_hlist_node_t       *hnode;
-        struct ptlrpc_cli_ctx  *ctx;
-        cfs_time_t              now;
-        ENTRY;
+       struct gss_sec_keyring  *gsec_kr = sec2gsec_keyring(sec);
+       struct hlist_node       __maybe_unused *hnode;
+       struct ptlrpc_cli_ctx   *ctx;
+       cfs_time_t              now;
+       ENTRY;
 
         LASSERT(sec_is_reverse(sec));
 
@@ -893,11 +893,11 @@ void flush_spec_ctx_cache_kr(struct ptlrpc_sec *sec,
                              uid_t uid,
                              int grace, int force)
 {
-        struct gss_sec_keyring *gsec_kr;
-        cfs_hlist_head_t        freelist = CFS_HLIST_HEAD_INIT;
-        cfs_hlist_node_t       *pos, *next;
-        struct ptlrpc_cli_ctx  *ctx;
-        ENTRY;
+       struct gss_sec_keyring  *gsec_kr;
+       struct hlist_head        freelist = CFS_HLIST_HEAD_INIT;
+       struct hlist_node       __maybe_unused *pos, *next;
+       struct ptlrpc_cli_ctx   *ctx;
+       ENTRY;
 
         gsec_kr = sec2gsec_keyring(sec);
 
@@ -962,8 +962,8 @@ static
 void gss_sec_gc_ctx_kr(struct ptlrpc_sec *sec)
 {
        struct gss_sec_keyring  *gsec_kr = sec2gsec_keyring(sec);
-       cfs_hlist_head_t        freelist = CFS_HLIST_HEAD_INIT;
-       cfs_hlist_node_t        *pos, *next;
+       struct hlist_head        freelist = CFS_HLIST_HEAD_INIT;
+       struct hlist_node       __maybe_unused *pos, *next;
        struct ptlrpc_cli_ctx   *ctx;
        ENTRY;
 
@@ -994,16 +994,16 @@ void gss_sec_gc_ctx_kr(struct ptlrpc_sec *sec)
 static
 int gss_sec_display_kr(struct ptlrpc_sec *sec, struct seq_file *seq)
 {
-        struct gss_sec_keyring *gsec_kr = sec2gsec_keyring(sec);
-        cfs_hlist_node_t       *pos, *next;
-        struct ptlrpc_cli_ctx  *ctx;
-        struct gss_cli_ctx     *gctx;
-        time_t                  now = cfs_time_current_sec();
-        ENTRY;
+       struct gss_sec_keyring  *gsec_kr = sec2gsec_keyring(sec);
+       struct hlist_node       __maybe_unused *pos, *next;
+       struct ptlrpc_cli_ctx   *ctx;
+       struct gss_cli_ctx      *gctx;
+       time_t                   now = cfs_time_current_sec();
+       ENTRY;
 
        spin_lock(&sec->ps_lock);
         cfs_hlist_for_each_entry_safe(ctx, pos, next,
-                                  &gsec_kr->gsk_clist, cc_cache) {
+                                     &gsec_kr->gsk_clist, cc_cache) {
                 struct key             *key;
                 char                    flags_str[40];
                 char                    mech[40];
index 81c3635..45e0b0b 100644 (file)
@@ -261,12 +261,12 @@ static
 void gss_sec_ctx_replace_pf(struct gss_sec *gsec,
                             struct ptlrpc_cli_ctx *new)
 {
-        struct gss_sec_pipefs *gsec_pf;
-        struct ptlrpc_cli_ctx *ctx;
-        cfs_hlist_node_t      *pos, *next;
-        CFS_HLIST_HEAD(freelist);
-        unsigned int hash;
-        ENTRY;
+       struct hlist_node __maybe_unused *pos, *next;
+       struct gss_sec_pipefs *gsec_pf;
+       struct ptlrpc_cli_ctx *ctx;
+       HLIST_HEAD(freelist);
+       unsigned int hash;
+       ENTRY;
 
         gsec_pf = container_of(gsec, struct gss_sec_pipefs, gsp_base);
 
@@ -324,11 +324,12 @@ static
 void gss_ctx_cache_gc_pf(struct gss_sec_pipefs *gsec_pf,
                          cfs_hlist_head_t *freelist)
 {
-        struct ptlrpc_sec       *sec;
-        struct ptlrpc_cli_ctx   *ctx;
-        cfs_hlist_node_t        *pos, *next;
-        int i;
-        ENTRY;
+       struct ptlrpc_sec       *sec;
+       struct ptlrpc_cli_ctx   *ctx;
+       struct hlist_node       __maybe_unused *pos;
+       struct hlist_node       *next;
+       int i;
+       ENTRY;
 
         sec = &gsec_pf->gsp_base.gs_base;
 
@@ -420,13 +421,13 @@ struct ptlrpc_cli_ctx * gss_sec_lookup_ctx_pf(struct ptlrpc_sec *sec,
                                               struct vfs_cred *vcred,
                                               int create, int remove_dead)
 {
-        struct gss_sec         *gsec;
-        struct gss_sec_pipefs  *gsec_pf;
-        struct ptlrpc_cli_ctx  *ctx = NULL, *new = NULL;
-        cfs_hlist_head_t       *hash_head;
-        cfs_hlist_node_t       *pos, *next;
-       CFS_HLIST_HEAD(freelist);
-       unsigned int            hash, gc = 0, found = 0;
+       struct gss_sec          *gsec;
+       struct gss_sec_pipefs   *gsec_pf;
+       struct ptlrpc_cli_ctx   *ctx = NULL, *new = NULL;
+       struct hlist_head       *hash_head;
+       struct hlist_node       __maybe_unused *pos, *next;
+       unsigned int            hash, gc = 0, found = 0;
+       HLIST_HEAD(freelist);
        ENTRY;
 
        might_sleep();
@@ -543,11 +544,11 @@ int gss_sec_flush_ctx_cache_pf(struct ptlrpc_sec *sec,
                                uid_t uid,
                                int grace, int force)
 {
-        struct gss_sec          *gsec;
-        struct gss_sec_pipefs   *gsec_pf;
-        struct ptlrpc_cli_ctx   *ctx;
-       cfs_hlist_node_t        *pos, *next;
-       CFS_HLIST_HEAD(freelist);
+       struct gss_sec          *gsec;
+       struct gss_sec_pipefs   *gsec_pf;
+       struct ptlrpc_cli_ctx   *ctx;
+       struct hlist_node       __maybe_unused *pos, *next;
+       HLIST_HEAD(freelist);
        int i, busy = 0;
        ENTRY;