From ad5c8ce3c3b561c3913cfe28703652329ec6c4dc Mon Sep 17 00:00:00 2001 From: zhanghc Date: Wed, 24 Dec 2008 11:36:14 +0000 Subject: [PATCH] b=18043 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 | 4 ++-- lustre/lov/lov_pool.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lustre/lov/lov_internal.h b/lustre/lov/lov_internal.h index b7e49c9..c6c3a69 100644 --- a/lustre/lov/lov_internal.h +++ b/lustre/lov/lov_internal.h @@ -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); diff --git a/lustre/lov/lov_pool.c b/lustre/lov/lov_pool.c index 1836691..764a494 100644 --- a/lustre/lov/lov_pool.c +++ b/lustre/lov/lov_pool.c @@ -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); -- 1.8.3.1