[lustre-devel] [PATCH 08/12] lustre: obdclass: cosmetic changes in pool handling
James Simmons
jsimmons at infradead.org
Sun Dec 12 07:07:59 PST 2021
From: Sergey Cheremencev <sergey.cheremencev at hpe.com>
cosmetic changes in pool handling:
- make tgt_pool_free void
- set default rc value in lu_tgt_check_index.
HPE-bug-id: LUS-9547
WC-bug-id: https://jira.whamcloud.com/browse/LU-15110
Lustre-commit: d01cae3ec8758fc27 ("LU-15110 quota: cosmetic changes in PQ")
Signed-off-by: Sergey Cheremencev <sergey.cheremencev at hpe.com>
Reviewed-on: https://review.whamcloud.com/45258
Reviewed-by: Petros Koutoupis <petros.koutoupis at hpe.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff at hpe.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
fs/lustre/include/lu_object.h | 2 +-
fs/lustre/obdclass/lu_tgt_pool.c | 15 +++++++--------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/fs/lustre/include/lu_object.h b/fs/lustre/include/lu_object.h
index 146398a..3fb40c6 100644
--- a/fs/lustre/include/lu_object.h
+++ b/fs/lustre/include/lu_object.h
@@ -1423,7 +1423,7 @@ struct lu_tgt_pool {
int lu_tgt_pool_init(struct lu_tgt_pool *op, unsigned int count);
int lu_tgt_pool_add(struct lu_tgt_pool *op, u32 idx, unsigned int min_count);
int lu_tgt_pool_remove(struct lu_tgt_pool *op, u32 idx);
-int lu_tgt_pool_free(struct lu_tgt_pool *op);
+void lu_tgt_pool_free(struct lu_tgt_pool *op);
int lu_tgt_check_index(int idx, struct lu_tgt_pool *osts);
int lu_tgt_pool_extend(struct lu_tgt_pool *op, unsigned int min_count);
diff --git a/fs/lustre/obdclass/lu_tgt_pool.c b/fs/lustre/obdclass/lu_tgt_pool.c
index 17bae54..38ab83d 100644
--- a/fs/lustre/obdclass/lu_tgt_pool.c
+++ b/fs/lustre/obdclass/lu_tgt_pool.c
@@ -197,14 +197,15 @@ int lu_tgt_pool_remove(struct lu_tgt_pool *op, u32 idx)
int lu_tgt_check_index(int idx, struct lu_tgt_pool *osts)
{
- int rc = 0, i;
+ int i, rc = -ENOENT;
down_read(&osts->op_rw_sem);
for (i = 0; i < osts->op_count; i++) {
- if (osts->op_array[i] == idx)
+ if (osts->op_array[i] == idx) {
+ rc = 0;
goto out;
+ }
}
- rc = -ENOENT;
out:
up_read(&osts->op_rw_sem);
return rc;
@@ -219,13 +220,11 @@ int lu_tgt_check_index(int idx, struct lu_tgt_pool *osts)
* deleted from memory.
*
* @op pool to be freed.
- *
- * Return: 0 on success or if pool was already freed
*/
-int lu_tgt_pool_free(struct lu_tgt_pool *op)
+void lu_tgt_pool_free(struct lu_tgt_pool *op)
{
if (op->op_size == 0)
- return 0;
+ return;
down_write(&op->op_rw_sem);
@@ -235,6 +234,6 @@ int lu_tgt_pool_free(struct lu_tgt_pool *op)
op->op_size = 0;
up_write(&op->op_rw_sem);
- return 0;
+ return;
}
EXPORT_SYMBOL(lu_tgt_pool_free);
--
1.8.3.1
More information about the lustre-devel
mailing list