Whamcloud - gitweb
b=18043
authorzhanghc <zhanghc>
Wed, 24 Dec 2008 11:36:14 +0000 (11:36 +0000)
committerzhanghc <zhanghc>
Wed, 24 Dec 2008 11:36:14 +0000 (11:36 +0000)
fix a bug in lov_ost_pool_extend, which
use "min" instead of "max" incorrectly

i=nathan.rutman
i=jc.lafoucriere

lustre/lov/lov_internal.h
lustre/lov/lov_pool.c

index b7e49c9..c6c3a69 100644 (file)
@@ -307,8 +307,8 @@ extern struct lu_device_type lov_device_type;
 extern lustre_hash_ops_t pool_hash_operations;
 /* ost_pool methods */
 int lov_ost_pool_init(struct ost_pool *op, unsigned int count);
-int lov_ost_pool_extend(struct ost_pool *op, unsigned int max_count);
-int lov_ost_pool_add(struct ost_pool *op, __u32 idx, unsigned int max_count);
+int lov_ost_pool_extend(struct ost_pool *op, unsigned int min_count);
+int lov_ost_pool_add(struct ost_pool *op, __u32 idx, unsigned int min_count);
 int lov_ost_pool_remove(struct ost_pool *op, __u32 idx);
 int lov_ost_pool_free(struct ost_pool *op);
 
index 1836691..764a494 100644 (file)
@@ -317,17 +317,17 @@ int lov_ost_pool_init(struct ost_pool *op, unsigned int count)
 }
 
 /* Caller must hold write op_rwlock */
-int lov_ost_pool_extend(struct ost_pool *op, unsigned int max_count)
+int lov_ost_pool_extend(struct ost_pool *op, unsigned int min_count)
 {
         __u32 *new;
         int new_size;
 
-        LASSERT(max_count != 0);
+        LASSERT(min_count != 0);
 
         if (op->op_count < op->op_size)
                 return 0;
 
-        new_size = min(max_count, 2 * op->op_size);
+        new_size = max(min_count, 2 * op->op_size);
         OBD_ALLOC(new, new_size * sizeof(op->op_array[0]));
         if (new == NULL)
                 return -ENOMEM;
@@ -340,14 +340,14 @@ int lov_ost_pool_extend(struct ost_pool *op, unsigned int max_count)
         return 0;
 }
 
-int lov_ost_pool_add(struct ost_pool *op, __u32 idx, unsigned int max_count)
+int lov_ost_pool_add(struct ost_pool *op, __u32 idx, unsigned int min_count)
 {
         int rc = 0, i;
         ENTRY;
 
         down_write(&op->op_rw_sem);
 
-        rc = lov_ost_pool_extend(op, max_count);
+        rc = lov_ost_pool_extend(op, min_count);
         if (rc)
                 GOTO(out, rc);