Whamcloud - gitweb
LU-4423 libcfs: remove some unused code and wrappers in libcfs 75/17375/7
authorShraddha Barke <shraddha.6596@gmail.com>
Wed, 16 Mar 2016 16:40:20 +0000 (12:40 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 23 Mar 2016 06:01:53 +0000 (06:01 +0000)
Remove code that is not used by anyone anymore in the
libcfs module. Also simplify the code by removing
several one line wrappers. This is a collection of work
done upstream by Shraddha Barke. The linux commits are:

Linux-commit : 8eefa1c028f5b16f33ce1b3c7bbabdf74efc63b1
Linux-commit : d11f8cc4bb7ff4ee8cc89d2799cdda206da0f434
Linux-commit : 7fb6f46b14d01a185dfe563a8ba20cda514d4f9a
Linux-commit : 7cbf673d8b4a68916fe362fe9a9c3a55a604700e
Linux-commit : e4ce7f7779313ff23f958049b91cc7ac1b24d8e8
Linux-commit : 5a2f464af23bc90a77df6b9b30815e602efb99af
Linux-commit : 87af1d2e0c29ce4f025da0cdbb9c74a3958fd71d
Linux-commit : 9561c25c590afdcb27002dc168bcecbf5a757308
Linux-commit : 7d6e398ca61427e903246f1c11853f6f967bbb5e
Linux-commit : 90f8b4643023b23061a15229c0c0b8ee747438a8
Linux-commit : a2aadf23d1437ddcce86fa0673a6ecb5f932d3ec

Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: I667f98b3c73d4ac9e884d6ada6fed0733a3f6451
Reviewed-on: http://review.whamcloud.com/17375
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/libcfs/debug.c
libcfs/libcfs/hash.c
libcfs/libcfs/linux/linux-cpu.c
libcfs/libcfs/linux/linux-crypto-adler.c
libcfs/libcfs/linux/linux-prim.c
libcfs/libcfs/tracefile.c
libcfs/libcfs/tracefile.h
libcfs/libcfs/workitem.c

index e533b8b..2b6c84b 100644 (file)
@@ -340,13 +340,6 @@ int libcfs_debug_mark_buffer(const char *text)
 #undef DEBUG_SUBSYSTEM
 #define DEBUG_SUBSYSTEM S_LNET
 
 #undef DEBUG_SUBSYSTEM
 #define DEBUG_SUBSYSTEM S_LNET
 
-void libcfs_debug_set_level(unsigned int debug_level)
-{
-       printk(KERN_WARNING "Lustre: Setting portals debug level to %08x\n",
-              debug_level);
-       libcfs_debug = debug_level;
-}
-
 long libcfs_log_return(struct libcfs_debug_msg_data *msgdata, long rc)
 {
         libcfs_debug_msg(msgdata, "Process leaving (rc=%lu : %ld : %lx)\n",
 long libcfs_log_return(struct libcfs_debug_msg_data *msgdata, long rc)
 {
         libcfs_debug_msg(msgdata, "Process leaving (rc=%lu : %ld : %lx)\n",
index 9c37ee1..5133628 100644 (file)
@@ -681,25 +681,6 @@ cfs_hash_bd_peek_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd,
 }
 EXPORT_SYMBOL(cfs_hash_bd_peek_locked);
 
 }
 EXPORT_SYMBOL(cfs_hash_bd_peek_locked);
 
-struct hlist_node *
-cfs_hash_bd_findadd_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd,
-                          const void *key, struct hlist_node *hnode,
-                           int noref)
-{
-       return cfs_hash_bd_lookup_intent(hs, bd, key, hnode,
-                                       CFS_HS_LOOKUP_IT_ADD |
-                                       (!noref * CFS_HS_LOOKUP_MASK_REF));
-}
-
-struct hlist_node *
-cfs_hash_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd,
-                          const void *key, struct hlist_node *hnode)
-{
-       /* hnode can be NULL, we find the first item with @key */
-       return cfs_hash_bd_lookup_intent(hs, bd, key, hnode,
-                                       CFS_HS_LOOKUP_IT_FINDDEL);
-}
-
 static void
 cfs_hash_multi_bd_lock(struct cfs_hash *hs, struct cfs_hash_bd *bds,
                        unsigned n, int excl)
 static void
 cfs_hash_multi_bd_lock(struct cfs_hash *hs, struct cfs_hash_bd *bds,
                        unsigned n, int excl)
index d3b8e76..82e0e73 100644 (file)
@@ -79,13 +79,6 @@ struct cfs_cpt_data {
 
 static struct cfs_cpt_data     cpt_data;
 
 
 static struct cfs_cpt_data     cpt_data;
 
-void
-cfs_cpu_core_siblings(int cpu, cpumask_t *mask)
-{
-       /* return cpumask of cores in the same socket */
-       cpumask_copy(mask, topology_core_cpumask(cpu));
-}
-
 /* return number of cores in the same socket of \a cpu */
 int
 cfs_cpu_core_nsiblings(int cpu)
 /* return number of cores in the same socket of \a cpu */
 int
 cfs_cpu_core_nsiblings(int cpu)
@@ -94,7 +87,7 @@ cfs_cpu_core_nsiblings(int cpu)
 
        mutex_lock(&cpt_data.cpt_mutex);
 
 
        mutex_lock(&cpt_data.cpt_mutex);
 
-       cfs_cpu_core_siblings(cpu, cpt_data.cpt_cpumask);
+       cpumask_copy(cpt_data.cpt_cpumask, topology_core_cpumask(cpu));
        num = cpumask_weight(cpt_data.cpt_cpumask);
 
        mutex_unlock(&cpt_data.cpt_mutex);
        num = cpumask_weight(cpt_data.cpt_cpumask);
 
        mutex_unlock(&cpt_data.cpt_mutex);
@@ -681,7 +674,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt,
                cpu = cpumask_first(node);
 
                /* get cpumask for cores in the same socket */
                cpu = cpumask_first(node);
 
                /* get cpumask for cores in the same socket */
-               cfs_cpu_core_siblings(cpu, socket);
+               cpumask_copy(socket, topology_core_cpumask(cpu));
                cpumask_and(socket, socket, node);
 
                LASSERT(!cpumask_empty(socket));
                cpumask_and(socket, socket, node);
 
                LASSERT(!cpumask_empty(socket));
@@ -690,7 +683,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt,
                        int     i;
 
                        /* get cpumask for hts in the same core */
                        int     i;
 
                        /* get cpumask for hts in the same core */
-                       cfs_cpu_ht_siblings(cpu, core);
+                       cpumask_copy(core, topology_sibling_cpumask(cpu));
                        cpumask_and(core, core, node);
 
                        LASSERT(!cpumask_empty(core));
                        cpumask_and(core, core, node);
 
                        LASSERT(!cpumask_empty(core));
@@ -1038,7 +1031,8 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
 
                mutex_lock(&cpt_data.cpt_mutex);
                /* if all HTs in a core are offline, it may break affinity */
 
                mutex_lock(&cpt_data.cpt_mutex);
                /* if all HTs in a core are offline, it may break affinity */
-               cfs_cpu_ht_siblings(cpu, cpt_data.cpt_cpumask);
+               cpumask_copy(cpt_data.cpt_cpumask,
+                            topology_sibling_cpumask(cpu));
                warn = cpumask_any_and(cpt_data.cpt_cpumask,
                                       cpu_online_mask) >= nr_cpu_ids;
                mutex_unlock(&cpt_data.cpt_mutex);
                warn = cpumask_any_and(cpt_data.cpt_cpumask,
                                       cpu_online_mask) >= nr_cpu_ids;
                mutex_unlock(&cpt_data.cpt_mutex);
index 10b91fc..90f502f 100644 (file)
 #include <libcfs/linux/linux-crypto.h>
 #include <crypto/internal/hash.h>
 
 #include <libcfs/linux/linux-crypto.h>
 #include <crypto/internal/hash.h>
 
-
 #define CHKSUM_BLOCK_SIZE      1
 #define CHKSUM_DIGEST_SIZE     4
 
 #define CHKSUM_BLOCK_SIZE      1
 #define CHKSUM_DIGEST_SIZE     4
 
-
-static u32 __adler32(u32 cksum, unsigned char const *p, size_t len)
-{
-       return zlib_adler32(cksum, p, len);
-}
-
 static int adler32_cra_init(struct crypto_tfm *tfm)
 {
        u32 *key = crypto_tfm_ctx(tfm);
 static int adler32_cra_init(struct crypto_tfm *tfm)
 {
        u32 *key = crypto_tfm_ctx(tfm);
@@ -81,13 +74,13 @@ static int adler32_update(struct shash_desc *desc, const u8 *data,
 {
        u32 *cksump = shash_desc_ctx(desc);
 
 {
        u32 *cksump = shash_desc_ctx(desc);
 
-       *cksump = __adler32(*cksump, data, len);
+       *cksump = zlib_adler32(*cksump, data, len);
        return 0;
 }
 static int __adler32_finup(u32 *cksump, const u8 *data, unsigned int len,
                           u8 *out)
 {
        return 0;
 }
 static int __adler32_finup(u32 *cksump, const u8 *data, unsigned int len,
                           u8 *out)
 {
-       *(u32 *)out = __adler32(*cksump, data, len);
+       *(u32 *)out = zlib_adler32(*cksump, data, len);
        return 0;
 }
 
        return 0;
 }
 
index dd2ac35..1204c1c 100644 (file)
@@ -84,16 +84,6 @@ cfs_time_t cfs_timer_deadline(struct timer_list *t)
 }
 EXPORT_SYMBOL(cfs_timer_deadline);
 
 }
 EXPORT_SYMBOL(cfs_timer_deadline);
 
-void cfs_enter_debugger(void)
-{
-#if defined(CONFIG_KGDB)
-//        BREAKPOINT();
-#else
-        /* nothing */
-#endif
-}
-EXPORT_SYMBOL(cfs_enter_debugger);
-
 sigset_t
 cfs_block_allsigs(void)
 {
 sigset_t
 cfs_block_allsigs(void)
 {
index 0c721a9..2baecb8 100644 (file)
@@ -449,7 +449,7 @@ console:
                 cfs_print_to_console(&header, mask,
                                      string_buf, needed, file, msgdata->msg_fn);
 
                 cfs_print_to_console(&header, mask,
                                      string_buf, needed, file, msgdata->msg_fn);
 
-                cfs_trace_put_console_buffer(string_buf);
+               put_cpu();
         }
 
         if (cdls != NULL && cdls->cdls_count != 0) {
         }
 
         if (cdls != NULL && cdls->cdls_count != 0) {
@@ -463,7 +463,7 @@ console:
                 cfs_print_to_console(&header, mask,
                                      string_buf, needed, file, msgdata->msg_fn);
 
                 cfs_print_to_console(&header, mask,
                                      string_buf, needed, file, msgdata->msg_fn);
 
-                cfs_trace_put_console_buffer(string_buf);
+               put_cpu();
                 cdls->cdls_count = 0;
         }
 
                 cdls->cdls_count = 0;
         }
 
@@ -800,11 +800,6 @@ int cfs_trace_allocate_string_buffer(char **str, int nob)
         return 0;
 }
 
         return 0;
 }
 
-void cfs_trace_free_string_buffer(char *str, int nob)
-{
-       kfree(str);
-}
-
 int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob)
 {
         char         *str;
 int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob)
 {
         char         *str;
@@ -825,7 +820,7 @@ int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob)
         }
         rc = cfs_tracefile_dump_all_pages(str);
 out:
         }
         rc = cfs_tracefile_dump_all_pages(str);
 out:
-        cfs_trace_free_string_buffer(str, usr_str_nob + 1);
+       kfree(str);
         return rc;
 }
 
         return rc;
 }
 
@@ -881,7 +876,7 @@ int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob)
         if (rc == 0)
                 rc = cfs_trace_daemon_command(str);
 
         if (rc == 0)
                 rc = cfs_trace_daemon_command(str);
 
-        cfs_trace_free_string_buffer(str, usr_str_nob + 1);
+       kfree(str);
         return rc;
 }
 
         return rc;
 }
 
index d2d92c8..7c570fa 100644 (file)
@@ -83,7 +83,6 @@ int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob,
 int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
                              const char *knl_str, char *append);
 int cfs_trace_allocate_string_buffer(char **str, int nob);
 int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
                              const char *knl_str, char *append);
 int cfs_trace_allocate_string_buffer(char **str, int nob);
-void cfs_trace_free_string_buffer(char *str, int nob);
 int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob);
 int cfs_trace_daemon_command(char *str);
 int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob);
 int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob);
 int cfs_trace_daemon_command(char *str);
 int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob);
@@ -277,12 +276,6 @@ static inline char *cfs_trace_get_console_buffer(void)
        return cfs_trace_console_buffers[i][j];
 }
 
        return cfs_trace_console_buffers[i][j];
 }
 
-static inline void
-cfs_trace_put_console_buffer(char *buffer)
-{
-       put_cpu();
-}
-
 static inline struct cfs_trace_cpu_data *cfs_trace_get_tcd(void)
 {
        struct cfs_trace_cpu_data *tcd =
 static inline struct cfs_trace_cpu_data *cfs_trace_get_tcd(void)
 {
        struct cfs_trace_cpu_data *tcd =
index 386ba17..168fea5 100644 (file)
@@ -87,32 +87,20 @@ static struct cfs_workitem_data {
        int                     wi_stopping;
 } cfs_wi_data;
 
        int                     wi_stopping;
 } cfs_wi_data;
 
-static inline void
-cfs_wi_sched_lock(struct cfs_wi_sched *sched)
-{
-       spin_lock(&sched->ws_lock);
-}
-
-static inline void
-cfs_wi_sched_unlock(struct cfs_wi_sched *sched)
-{
-       spin_unlock(&sched->ws_lock);
-}
-
 static inline int
 cfs_wi_sched_cansleep(struct cfs_wi_sched *sched)
 {
 static inline int
 cfs_wi_sched_cansleep(struct cfs_wi_sched *sched)
 {
-       cfs_wi_sched_lock(sched);
+       spin_lock(&sched->ws_lock);
        if (sched->ws_stopping) {
        if (sched->ws_stopping) {
-               cfs_wi_sched_unlock(sched);
+               spin_unlock(&sched->ws_lock);
                return 0;
        }
 
        if (!list_empty(&sched->ws_runq)) {
                return 0;
        }
 
        if (!list_empty(&sched->ws_runq)) {
-               cfs_wi_sched_unlock(sched);
+               spin_unlock(&sched->ws_lock);
                return 0;
        }
                return 0;
        }
-       cfs_wi_sched_unlock(sched);
+       spin_unlock(&sched->ws_lock);
        return 1;
 }
 
        return 1;
 }
 
@@ -126,7 +114,7 @@ cfs_wi_exit(struct cfs_wi_sched *sched, struct cfs_workitem *wi)
        LASSERT(!in_interrupt()); /* because we use plain spinlock */
        LASSERT(!sched->ws_stopping);
 
        LASSERT(!in_interrupt()); /* because we use plain spinlock */
        LASSERT(!sched->ws_stopping);
 
-       cfs_wi_sched_lock(sched);
+       spin_lock(&sched->ws_lock);
 
        LASSERT(wi->wi_running);
 
 
        LASSERT(wi->wi_running);
 
@@ -141,7 +129,7 @@ cfs_wi_exit(struct cfs_wi_sched *sched, struct cfs_workitem *wi)
        LASSERT(list_empty(&wi->wi_list));
 
        wi->wi_scheduled = 1; /* LBUG future schedule attempts */
        LASSERT(list_empty(&wi->wi_list));
 
        wi->wi_scheduled = 1; /* LBUG future schedule attempts */
-       cfs_wi_sched_unlock(sched);
+       spin_unlock(&sched->ws_lock);
 
        return;
 }
 
        return;
 }
@@ -163,7 +151,7 @@ cfs_wi_deschedule(struct cfs_wi_sched *sched, struct cfs_workitem *wi)
          * means the workitem will not be scheduled and will not have
          * any race with wi_action.
          */
          * means the workitem will not be scheduled and will not have
          * any race with wi_action.
          */
-       cfs_wi_sched_lock(sched);
+       spin_lock(&sched->ws_lock);
 
        rc = !(wi->wi_running);
 
 
        rc = !(wi->wi_running);
 
@@ -179,7 +167,7 @@ cfs_wi_deschedule(struct cfs_wi_sched *sched, struct cfs_workitem *wi)
 
        LASSERT (list_empty(&wi->wi_list));
 
 
        LASSERT (list_empty(&wi->wi_list));
 
-       cfs_wi_sched_unlock(sched);
+       spin_unlock(&sched->ws_lock);
        return rc;
 }
 EXPORT_SYMBOL(cfs_wi_deschedule);
        return rc;
 }
 EXPORT_SYMBOL(cfs_wi_deschedule);
@@ -197,7 +185,7 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, struct cfs_workitem *wi)
        LASSERT(!in_interrupt()); /* because we use plain spinlock */
        LASSERT(!sched->ws_stopping);
 
        LASSERT(!in_interrupt()); /* because we use plain spinlock */
        LASSERT(!sched->ws_stopping);
 
-       cfs_wi_sched_lock(sched);
+       spin_lock(&sched->ws_lock);
 
        if (!wi->wi_scheduled) {
                LASSERT (list_empty(&wi->wi_list));
 
        if (!wi->wi_scheduled) {
                LASSERT (list_empty(&wi->wi_list));
@@ -213,7 +201,7 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, struct cfs_workitem *wi)
        }
 
        LASSERT (!list_empty(&wi->wi_list));
        }
 
        LASSERT (!list_empty(&wi->wi_list));
-       cfs_wi_sched_unlock(sched);
+       spin_unlock(&sched->ws_lock);
        return;
 }
 EXPORT_SYMBOL(cfs_wi_schedule);
        return;
 }
 EXPORT_SYMBOL(cfs_wi_schedule);
@@ -239,7 +227,7 @@ cfs_wi_scheduler(void *arg)
 
        spin_unlock(&cfs_wi_data.wi_glock);
 
 
        spin_unlock(&cfs_wi_data.wi_glock);
 
-       cfs_wi_sched_lock(sched);
+       spin_lock(&sched->ws_lock);
 
        while (!sched->ws_stopping) {
                int             nloops = 0;
 
        while (!sched->ws_stopping) {
                int             nloops = 0;
@@ -260,13 +248,12 @@ cfs_wi_scheduler(void *arg)
                         wi->wi_running   = 1;
                         wi->wi_scheduled = 0;
 
                         wi->wi_running   = 1;
                         wi->wi_scheduled = 0;
 
-
-                        cfs_wi_sched_unlock(sched);
+                       spin_unlock(&sched->ws_lock);
                         nloops++;
 
                         rc = (*wi->wi_action) (wi);
 
                         nloops++;
 
                         rc = (*wi->wi_action) (wi);
 
-                        cfs_wi_sched_lock(sched);
+                       spin_lock(&sched->ws_lock);
                         if (rc != 0) /* WI should be dead, even be freed! */
                                 continue;
 
                         if (rc != 0) /* WI should be dead, even be freed! */
                                 continue;
 
@@ -281,21 +268,21 @@ cfs_wi_scheduler(void *arg)
                 }
 
                if (!list_empty(&sched->ws_runq)) {
                 }
 
                if (!list_empty(&sched->ws_runq)) {
-                       cfs_wi_sched_unlock(sched);
+                       spin_unlock(&sched->ws_lock);
                        /* don't sleep because some workitems still
                         * expect me to come back soon */
                        cond_resched();
                        /* don't sleep because some workitems still
                         * expect me to come back soon */
                        cond_resched();
-                       cfs_wi_sched_lock(sched);
+                       spin_lock(&sched->ws_lock);
                        continue;
                }
 
                        continue;
                }
 
-               cfs_wi_sched_unlock(sched);
+               spin_unlock(&sched->ws_lock);
                rc = wait_event_interruptible_exclusive(sched->ws_waitq,
                                !cfs_wi_sched_cansleep(sched));
                rc = wait_event_interruptible_exclusive(sched->ws_waitq,
                                !cfs_wi_sched_cansleep(sched));
-               cfs_wi_sched_lock(sched);
+               spin_lock(&sched->ws_lock);
         }
 
         }
 
-        cfs_wi_sched_unlock(sched);
+       spin_unlock(&sched->ws_lock);
 
        spin_lock(&cfs_wi_data.wi_glock);
        sched->ws_nthreads--;
 
        spin_lock(&cfs_wi_data.wi_glock);
        sched->ws_nthreads--;