From f0b71d83c89623c644f6c881e6e46dcf8f563cf9 Mon Sep 17 00:00:00 2001 From: yury Date: Mon, 3 Jul 2006 16:19:31 +0000 Subject: [PATCH] - some fixes after DLDINSP. --- lustre/fld/fld_cache.c | 6 ++++-- lustre/fld/fld_handler.c | 4 ++-- lustre/fld/fld_request.c | 9 ++++++--- lustre/include/lustre_fld.h | 4 ++-- lustre/mdt/mdt_handler.c | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lustre/fld/fld_cache.c b/lustre/fld/fld_cache.c index 6d5105d..372fb92 100644 --- a/lustre/fld/fld_cache.c +++ b/lustre/fld/fld_cache.c @@ -53,7 +53,8 @@ #include "fld_internal.h" #ifdef __KERNEL__ -struct fld_cache_info *fld_cache_init(int size) +struct fld_cache_info * +fld_cache_init(int size) { struct fld_cache_info *cache; int i; @@ -85,7 +86,8 @@ struct fld_cache_info *fld_cache_init(int size) } EXPORT_SYMBOL(fld_cache_init); -void fld_cache_fini(struct fld_cache_info *cache) +void +fld_cache_fini(struct fld_cache_info *cache) { struct fld_cache_entry *flde; struct hlist_head *bucket; diff --git a/lustre/fld/fld_handler.c b/lustre/fld/fld_handler.c index c809e68..e734802 100644 --- a/lustre/fld/fld_handler.c +++ b/lustre/fld/fld_handler.c @@ -293,8 +293,8 @@ fld_server_proc_fini(struct lu_server_fld *fld) int fld_server_init(struct lu_server_fld *fld, const struct lu_context *ctx, - const char *uuid, - struct dt_device *dt) + struct dt_device *dt, + const char *uuid) { int rc; struct ptlrpc_service_conf fld_conf = { diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index 852b2a8..0b1f781 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -93,9 +93,7 @@ fld_client_get_target(struct lu_client_fld *fld, seqno_t seq) spin_lock(&fld->fld_lock); hash = fld->fld_hash->fh_func(fld, seq); - spin_unlock(&fld->fld_lock); - spin_lock(&fld->fld_lock); list_for_each_entry(target, &fld->fld_targets, fldt_chain) { if (target->fldt_idx == hash) { @@ -220,6 +218,11 @@ fld_client_proc_fini(struct lu_client_fld *fld) } #endif +static inline int hash_is_sane(int hash) +{ + return (hash >= 0 && hash < LUSTRE_CLI_FLD_HASH_LAST); +} + int fld_client_init(struct lu_client_fld *fld, const char *uuid, int hash) @@ -229,7 +232,7 @@ fld_client_init(struct lu_client_fld *fld, LASSERT(fld != NULL); - if (hash < 0 || hash >= LUSTRE_CLI_FLD_HASH_LAST) { + if (!hash_is_sane(hash)) { CERROR("wrong hash function 0x%x\n", hash); RETURN(-EINVAL); } diff --git a/lustre/include/lustre_fld.h b/lustre/include/lustre_fld.h index e505dc8..757b4a4 100644 --- a/lustre/include/lustre_fld.h +++ b/lustre/include/lustre_fld.h @@ -104,8 +104,8 @@ struct lu_client_fld { /* server methods */ int fld_server_init(struct lu_server_fld *fld, const struct lu_context *ctx, - const char *uuid, - struct dt_device *dt); + struct dt_device *dt, + const char *uuid); void fld_server_fini(struct lu_server_fld *fld, const struct lu_context *ctx); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 2cd7c39..b9a9bab 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1855,7 +1855,7 @@ static int mdt_fld_init(const struct lu_context *ctx, if (ls->ls_server_fld != NULL) { rc = fld_server_init(ls->ls_server_fld, ctx, - uuid, m->mdt_bottom); + m->mdt_bottom, uuid); if (rc) { OBD_FREE_PTR(ls->ls_server_fld); ls->ls_server_fld = NULL; -- 1.8.3.1