Whamcloud - gitweb
LU-10499 pcc: introducing OBD_CONNECT2_PCCRO flag
[fs/lustre-release.git] / lustre / lod / lod_pool.c
index 55932d5..17b625d 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  */
 /*
  * lustre/lod/lod_pool.c
@@ -59,6 +58,7 @@
 
 #include <libcfs/libcfs.h>
 #include <libcfs/linux/linux-hash.h>
+#include <libcfs/linux/linux-fs.h>
 #include <obd.h>
 #include "lod_internal.h"
 
@@ -99,8 +99,8 @@ void lod_pool_putref(struct pool_desc *pool)
        if (atomic_dec_and_test(&pool->pool_refcount)) {
                LASSERT(list_empty(&pool->pool_list));
                LASSERT(pool->pool_proc_entry == NULL);
-               tgt_pool_free(&(pool->pool_rr.lqr_pool));
-               tgt_pool_free(&(pool->pool_obds));
+               lu_tgt_pool_free(&(pool->pool_rr.lqr_pool));
+               lu_tgt_pool_free(&(pool->pool_obds));
                kfree_rcu(pool, pool_rcu);
                EXIT;
        }
@@ -165,8 +165,9 @@ static void *pool_proc_next(struct seq_file *seq, void *v, loff_t *pos)
 
        LASSERTF(iter->lpi_magic == POOL_IT_MAGIC, "%08X\n", iter->lpi_magic);
 
+       (*pos)++;
        /* test if end of file */
-       if (*pos >= pool_tgt_count(iter->lpi_pool))
+       if (*pos > pool_tgt_count(iter->lpi_pool))
                return NULL;
 
        OBD_FAIL_TIMEOUT(OBD_FAIL_OST_LIST_ASSERT, cfs_fail_val);
@@ -178,7 +179,7 @@ static void *pool_proc_next(struct seq_file *seq, void *v, loff_t *pos)
                iter->lpi_idx = prev_idx; /* we stay on the last entry */
                return NULL;
        }
-       (*pos)++;
+
        /* return != NULL to continue */
        return iter;
 }
@@ -316,11 +317,11 @@ static int pool_proc_open(struct inode *inode, struct file *file)
        return rc;
 }
 
-static struct file_operations pool_proc_operations = {
-       .open           = pool_proc_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = seq_release,
+const static struct proc_ops pool_proc_operations = {
+       .proc_open      = pool_proc_open,
+       .proc_read      = seq_read,
+       .proc_lseek     = seq_lseek,
+       .proc_release   = seq_release,
 };
 
 /**
@@ -407,13 +408,13 @@ int lod_pool_new(struct obd_device *obd, char *poolname)
        strlcpy(new_pool->pool_name, poolname, sizeof(new_pool->pool_name));
        new_pool->pool_lobd = obd;
        atomic_set(&new_pool->pool_refcount, 1);
-       rc = tgt_pool_init(&new_pool->pool_obds, 0);
+       rc = lu_tgt_pool_init(&new_pool->pool_obds, 0);
        if (rc)
                GOTO(out_err, rc);
 
        lu_qos_rr_init(&new_pool->pool_rr);
 
-       rc = tgt_pool_init(&new_pool->pool_rr.lqr_pool, 0);
+       rc = lu_tgt_pool_init(&new_pool->pool_rr.lqr_pool, 0);
        if (rc)
                GOTO(out_free_pool_obds, rc);
 
@@ -464,9 +465,9 @@ out_err:
 
        lprocfs_remove(&new_pool->pool_proc_entry);
 
-       tgt_pool_free(&new_pool->pool_rr.lqr_pool);
+       lu_tgt_pool_free(&new_pool->pool_rr.lqr_pool);
 out_free_pool_obds:
-       tgt_pool_free(&new_pool->pool_obds);
+       lu_tgt_pool_free(&new_pool->pool_obds);
        OBD_FREE_PTR(new_pool);
        return rc;
 }
@@ -559,12 +560,12 @@ int lod_pool_add(struct obd_device *obd, char *poolname, char *ostname)
        if (rc)
                GOTO(out, rc);
 
-       rc = tgt_pool_add(&pool->pool_obds, tgt->ltd_index,
-                             lod->lod_ost_count);
+       rc = lu_tgt_pool_add(&pool->pool_obds, tgt->ltd_index,
+                            lod->lod_ost_count);
        if (rc)
                GOTO(out, rc);
 
-       pool->pool_rr.lqr_dirty = 1;
+       set_bit(LQ_DIRTY, &pool->pool_rr.lqr_flags);
 
        CDEBUG(D_CONFIG, "Added %s to "LOV_POOLNAMEF" as member %d\n",
                        ostname, poolname,  pool_tgt_count(pool));
@@ -623,8 +624,8 @@ int lod_pool_remove(struct obd_device *obd, char *poolname, char *ostname)
        if (rc)
                GOTO(out, rc);
 
-       tgt_pool_remove(&pool->pool_obds, ost->ltd_index);
-       pool->pool_rr.lqr_dirty = 1;
+       lu_tgt_pool_remove(&pool->pool_obds, ost->ltd_index);
+       set_bit(LQ_DIRTY, &pool->pool_rr.lqr_flags);
 
        CDEBUG(D_CONFIG, "%s removed from "LOV_POOLNAMEF"\n", ostname,
               poolname);
@@ -653,7 +654,7 @@ int lod_check_index_in_pool(__u32 idx, struct pool_desc *pool)
        int rc;
 
        pool_getref(pool);
-       rc = tgt_check_index(idx, &pool->pool_obds);
+       rc = lu_tgt_check_index(idx, &pool->pool_obds);
        lod_pool_putref(pool);
        return rc;
 }