Whamcloud - gitweb
LU-3963 libcfs: remove last cfs wrappers for cpu node handling
[fs/lustre-release.git] / lustre / lov / lov_pool.c
index 14dd336..37be01e 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_LOV
 
-#ifdef __KERNEL__
 #include <libcfs/libcfs.h>
-#else
-#include <liblustre.h>
-#endif
 
 #include <obd.h>
 #include "lov_internal.h"
@@ -106,43 +102,44 @@ static __u32 pool_hashfn(cfs_hash_t *hash_body, const void *key, unsigned mask)
         return (result % mask);
 }
 
-static void *pool_key(cfs_hlist_node_t *hnode)
+static void *pool_key(struct hlist_node *hnode)
 {
         struct pool_desc *pool;
 
-        pool = cfs_hlist_entry(hnode, struct pool_desc, pool_hash);
+       pool = hlist_entry(hnode, struct pool_desc, pool_hash);
         return (pool->pool_name);
 }
 
-static int pool_hashkey_keycmp(const void *key, cfs_hlist_node_t *compared_hnode)
+static int
+pool_hashkey_keycmp(const void *key, struct hlist_node *compared_hnode)
 {
         char *pool_name;
         struct pool_desc *pool;
 
         pool_name = (char *)key;
-        pool = cfs_hlist_entry(compared_hnode, struct pool_desc, pool_hash);
+       pool = hlist_entry(compared_hnode, struct pool_desc, pool_hash);
         return !strncmp(pool_name, pool->pool_name, LOV_MAXPOOLNAME);
 }
 
-static void *pool_hashobject(cfs_hlist_node_t *hnode)
+static void *pool_hashobject(struct hlist_node *hnode)
 {
-        return cfs_hlist_entry(hnode, struct pool_desc, pool_hash);
+       return hlist_entry(hnode, struct pool_desc, pool_hash);
 }
 
-static void pool_hashrefcount_get(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
+static void pool_hashrefcount_get(cfs_hash_t *hs, struct hlist_node *hnode)
 {
         struct pool_desc *pool;
 
-        pool = cfs_hlist_entry(hnode, struct pool_desc, pool_hash);
+       pool = hlist_entry(hnode, struct pool_desc, pool_hash);
         lov_pool_getref(pool);
 }
 
 static void pool_hashrefcount_put_locked(cfs_hash_t *hs,
-                                         cfs_hlist_node_t *hnode)
+                                        struct hlist_node *hnode)
 {
         struct pool_desc *pool;
 
-        pool = cfs_hlist_entry(hnode, struct pool_desc, pool_hash);
+       pool = hlist_entry(hnode, struct pool_desc, pool_hash);
         lov_pool_putref_locked(pool);
 }
 
@@ -179,7 +176,7 @@ static void *pool_proc_next(struct seq_file *s, void *v, loff_t *pos)
         struct pool_iterator *iter = (struct pool_iterator *)s->private;
         int prev_idx;
 
-        LASSERTF(iter->magic == POOL_IT_MAGIC, "%08X", iter->magic);
+       LASSERTF(iter->magic == POOL_IT_MAGIC, "%08X\n", iter->magic);
 
         /* test if end of file */
         if (*pos >= pool_tgt_count(iter->pool))
@@ -260,9 +257,9 @@ static int pool_proc_show(struct seq_file *s, void *v)
         struct pool_iterator *iter = (struct pool_iterator *)v;
         struct lov_tgt_desc *tgt;
 
-        LASSERTF(iter->magic == POOL_IT_MAGIC, "%08X", iter->magic);
-        LASSERT(iter->pool != NULL);
-        LASSERT(iter->idx <= pool_tgt_count(iter->pool));
+       LASSERTF(iter->magic == POOL_IT_MAGIC, "%08X\n", iter->magic);
+       LASSERT(iter->pool != NULL);
+       LASSERT(iter->idx <= pool_tgt_count(iter->pool));
 
        down_read(&pool_tgt_rw_sem(iter->pool));
         tgt = pool_tgt(iter->pool, iter->idx);
@@ -448,8 +445,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname)
         if (new_pool == NULL)
                 RETURN(-ENOMEM);
 
-       strncpy(new_pool->pool_name, poolname, LOV_MAXPOOLNAME);
-       new_pool->pool_name[LOV_MAXPOOLNAME] = '\0';
+       strlcpy(new_pool->pool_name, poolname, sizeof(new_pool->pool_name));
        new_pool->pool_lobd = obd;
        /* ref count init to 1 because when created a pool is always used
         * up to deletion
@@ -459,18 +455,14 @@ int lov_pool_new(struct obd_device *obd, char *poolname)
        if (rc)
                GOTO(out_err, rc);
 
-        CFS_INIT_HLIST_NODE(&new_pool->pool_hash);
+       INIT_HLIST_NODE(&new_pool->pool_hash);
 
 #ifdef LPROCFS
         /* we need this assert seq_file is not implementated for liblustre */
         /* get ref for /proc file */
         lov_pool_getref(new_pool);
         new_pool->pool_proc_entry = lprocfs_add_simple(lov->lov_pool_proc_entry,
-                                                       poolname,
-#ifndef HAVE_ONLY_PROCFS_SEQ
-                                                       NULL, NULL,
-#endif
-                                                       new_pool,
+                                                       poolname, new_pool,
                                                        &pool_proc_operations);
         if (IS_ERR(new_pool->pool_proc_entry)) {
                 CWARN("Cannot add proc pool entry "LOV_POOLNAMEF"\n", poolname);
@@ -481,7 +473,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname)
 #endif
 
        spin_lock(&obd->obd_dev_lock);
-       cfs_list_add_tail(&new_pool->pool_list, &lov->lov_pool_list);
+       list_add_tail(&new_pool->pool_list, &lov->lov_pool_list);
        lov->lov_pool_count++;
        spin_unlock(&obd->obd_dev_lock);
 
@@ -498,7 +490,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname)
 
 out_err:
        spin_lock(&obd->obd_dev_lock);
-       cfs_list_del_init(&new_pool->pool_list);
+       list_del_init(&new_pool->pool_list);
        lov->lov_pool_count--;
        spin_unlock(&obd->obd_dev_lock);
         lprocfs_remove(&new_pool->pool_proc_entry);
@@ -528,7 +520,7 @@ int lov_pool_del(struct obd_device *obd, char *poolname)
         }
 
        spin_lock(&obd->obd_dev_lock);
-       cfs_list_del_init(&pool->pool_list);
+       list_del_init(&pool->pool_list);
        lov->lov_pool_count--;
        spin_unlock(&obd->obd_dev_lock);