diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/fld/fld_request.c')
-rw-r--r-- | drivers/staging/lustre/lustre/fld/fld_request.c | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index d92c01b74865..a3d122d85c8d 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -58,7 +58,8 @@ #include "fld_internal.h" /* TODO: these 3 functions are copies of flow-control code from mdc_lib.c - * It should be common thing. The same about mdc RPC lock */ + * It should be common thing. The same about mdc RPC lock + */ static int fld_req_avail(struct client_obd *cli, struct mdc_cache_waiter *mcw) { int rc; @@ -124,7 +125,8 @@ fld_rrb_scan(struct lu_client_fld *fld, u64 seq) * it should go to index 0 directly, instead of calculating * hash again, and also if other MDTs is not being connected, * the fld lookup requests(for seq on MDT0) should not be - * blocked because of other MDTs */ + * blocked because of other MDTs + */ if (fid_seq_is_norm(seq)) hash = fld_rrb_hash(fld, seq); else @@ -139,18 +141,19 @@ again: if (hash != 0) { /* It is possible the remote target(MDT) are not connected to * with client yet, so we will refer this to MDT0, which should - * be connected during mount */ + * be connected during mount + */ hash = 0; goto again; } CERROR("%s: Can't find target by hash %d (seq %#llx). Targets (%d):\n", - fld->lcf_name, hash, seq, fld->lcf_count); + fld->lcf_name, hash, seq, fld->lcf_count); list_for_each_entry(target, &fld->lcf_targets, ft_chain) { - const char *srv_name = target->ft_srv != NULL ? + const char *srv_name = target->ft_srv ? target->ft_srv->lsf_name : "<null>"; - const char *exp_name = target->ft_exp != NULL ? + const char *exp_name = target->ft_exp ? (char *)target->ft_exp->exp_obd->obd_uuid.uuid : "<null>"; @@ -183,13 +186,13 @@ fld_client_get_target(struct lu_client_fld *fld, u64 seq) { struct lu_fld_target *target; - LASSERT(fld->lcf_hash != NULL); + LASSERT(fld->lcf_hash); spin_lock(&fld->lcf_lock); target = fld->lcf_hash->fh_scan_func(fld, seq); spin_unlock(&fld->lcf_lock); - if (target != NULL) { + if (target) { CDEBUG(D_INFO, "%s: Found target (idx %llu) by seq %#llx\n", fld->lcf_name, target->ft_idx, seq); } @@ -207,18 +210,18 @@ int fld_client_add_target(struct lu_client_fld *fld, const char *name; struct lu_fld_target *target, *tmp; - LASSERT(tar != NULL); + LASSERT(tar); name = fld_target_name(tar); - LASSERT(name != NULL); - LASSERT(tar->ft_srv != NULL || tar->ft_exp != NULL); + LASSERT(name); + LASSERT(tar->ft_srv || tar->ft_exp); if (fld->lcf_flags != LUSTRE_FLD_INIT) { CERROR("%s: Attempt to add target %s (idx %llu) on fly - skip it\n", - fld->lcf_name, name, tar->ft_idx); + fld->lcf_name, name, tar->ft_idx); return 0; } CDEBUG(D_INFO, "%s: Adding target %s (idx %llu)\n", - fld->lcf_name, name, tar->ft_idx); + fld->lcf_name, name, tar->ft_idx); target = kzalloc(sizeof(*target), GFP_NOFS); if (!target) @@ -236,13 +239,12 @@ int fld_client_add_target(struct lu_client_fld *fld, } target->ft_exp = tar->ft_exp; - if (target->ft_exp != NULL) + if (target->ft_exp) class_export_get(target->ft_exp); target->ft_srv = tar->ft_srv; target->ft_idx = tar->ft_idx; - list_add_tail(&target->ft_chain, - &fld->lcf_targets); + list_add_tail(&target->ft_chain, &fld->lcf_targets); fld->lcf_count++; spin_unlock(&fld->lcf_lock); @@ -257,14 +259,13 @@ int fld_client_del_target(struct lu_client_fld *fld, __u64 idx) struct lu_fld_target *target, *tmp; spin_lock(&fld->lcf_lock); - list_for_each_entry_safe(target, tmp, - &fld->lcf_targets, ft_chain) { + list_for_each_entry_safe(target, tmp, &fld->lcf_targets, ft_chain) { if (target->ft_idx == idx) { fld->lcf_count--; list_del(&target->ft_chain); spin_unlock(&fld->lcf_lock); - if (target->ft_exp != NULL) + if (target->ft_exp) class_export_put(target->ft_exp); kfree(target); @@ -326,8 +327,6 @@ int fld_client_init(struct lu_client_fld *fld, int cache_size, cache_threshold; int rc; - LASSERT(fld != NULL); - snprintf(fld->lcf_name, sizeof(fld->lcf_name), "cli-%s", prefix); @@ -375,17 +374,16 @@ void fld_client_fini(struct lu_client_fld *fld) struct lu_fld_target *target, *tmp; spin_lock(&fld->lcf_lock); - list_for_each_entry_safe(target, tmp, - &fld->lcf_targets, ft_chain) { + list_for_each_entry_safe(target, tmp, &fld->lcf_targets, ft_chain) { fld->lcf_count--; list_del(&target->ft_chain); - if (target->ft_exp != NULL) + if (target->ft_exp) class_export_put(target->ft_exp); kfree(target); } spin_unlock(&fld->lcf_lock); - if (fld->lcf_cache != NULL) { + if (fld->lcf_cache) { if (!IS_ERR(fld->lcf_cache)) fld_cache_fini(fld->lcf_cache); fld->lcf_cache = NULL; @@ -402,12 +400,12 @@ int fld_client_rpc(struct obd_export *exp, int rc; struct obd_import *imp; - LASSERT(exp != NULL); + LASSERT(exp); imp = class_exp2cliimp(exp); req = ptlrpc_request_alloc_pack(imp, &RQF_FLD_QUERY, LUSTRE_MDS_VERSION, FLD_QUERY); - if (req == NULL) + if (!req) return -ENOMEM; op = req_capsule_client_get(&req->rq_pill, &RMF_FLD_OPC); @@ -436,7 +434,7 @@ int fld_client_rpc(struct obd_export *exp, goto out_req; prange = req_capsule_server_get(&req->rq_pill, &RMF_FLD_MDFLD); - if (prange == NULL) { + if (!prange) { rc = -EFAULT; goto out_req; } @@ -463,10 +461,10 @@ int fld_client_lookup(struct lu_client_fld *fld, u64 seq, u32 *mds, /* Can not find it in the cache */ target = fld_client_get_target(fld, seq); - LASSERT(target != NULL); + LASSERT(target); CDEBUG(D_INFO, "%s: Lookup fld entry (seq: %#llx) on target %s (idx %llu)\n", - fld->lcf_name, seq, fld_target_name(target), target->ft_idx); + fld->lcf_name, seq, fld_target_name(target), target->ft_idx); res.lsr_start = seq; fld_range_set_type(&res, flags); @@ -487,7 +485,7 @@ void fld_client_flush(struct lu_client_fld *fld) } EXPORT_SYMBOL(fld_client_flush); -static int __init fld_mod_init(void) +static int __init fld_init(void) { fld_debugfs_dir = ldebugfs_register(LUSTRE_FLD_NAME, debugfs_lustre_root, @@ -495,15 +493,16 @@ static int __init fld_mod_init(void) return PTR_ERR_OR_ZERO(fld_debugfs_dir); } -static void __exit fld_mod_exit(void) +static void __exit fld_exit(void) { if (!IS_ERR_OR_NULL(fld_debugfs_dir)) ldebugfs_remove(&fld_debugfs_dir); } MODULE_AUTHOR("OpenSFS, Inc. <http://www.lustre.org/>"); -MODULE_DESCRIPTION("Lustre FLD"); +MODULE_DESCRIPTION("Lustre FID Location Database"); +MODULE_VERSION(LUSTRE_VERSION_STRING); MODULE_LICENSE("GPL"); -module_init(fld_mod_init) -module_exit(fld_mod_exit) +module_init(fld_init) +module_exit(fld_exit) |