X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fobdclass%2Fgenops.c;h=0a840c999c068c4a62629a754bbe921ca575b3f8;hp=a7d816e3822afe5d637fd2b9c941efefde774721;hb=6601661f96325b4971d0d1cb0be0fa01cc2ddc97;hpb=48df66be72c948ab5428a073e52a45ac4252d612 diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index a7d816e..0a840c9 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -239,7 +239,7 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, if (enable_proc) { type->typ_procroot = lprocfs_register(type->typ_name, proc_lustre_root, - vars, type); + NULL, type); if (IS_ERR(type->typ_procroot)) { rc = PTR_ERR(type->typ_procroot); type->typ_procroot = NULL; @@ -262,7 +262,7 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, type->typ_debugfs_entry = ldebugfs_register(type->typ_name, debugfs_lustre_root, - NULL, type); + vars, type); if (IS_ERR_OR_NULL(type->typ_debugfs_entry)) { rc = type->typ_debugfs_entry ? PTR_ERR(type->typ_debugfs_entry) : -ENOMEM; @@ -445,7 +445,7 @@ struct obd_device *class_newdev(const char *type_name, const char *name, newdev->obd_conn_inprogress = 0; - strncpy(newdev->obd_uuid.uuid, uuid, strlen(uuid)); + strncpy(newdev->obd_uuid.uuid, uuid, UUID_MAX); CDEBUG(D_IOCTL, "Allocate new device %s (%p)\n", newdev->obd_name, newdev); @@ -952,18 +952,6 @@ struct obd_device *class_exp2obd(struct obd_export *exp) } EXPORT_SYMBOL(class_exp2obd); -struct obd_device *class_conn2obd(struct lustre_handle *conn) -{ - struct obd_export *export; - export = class_conn2export(conn); - if (export) { - struct obd_device *obd = export->exp_obd; - class_export_put(export); - return obd; - } - return NULL; -} - struct obd_import *class_exp2cliimp(struct obd_export *exp) { struct obd_device *obd = exp->exp_obd; @@ -973,14 +961,6 @@ struct obd_import *class_exp2cliimp(struct obd_export *exp) } EXPORT_SYMBOL(class_exp2cliimp); -struct obd_import *class_conn2cliimp(struct lustre_handle *conn) -{ - struct obd_device *obd = class_conn2obd(conn); - if (obd == NULL) - return NULL; - return obd->u.cli.cl_import; -} - /* Export management functions */ static void class_export_destroy(struct obd_export *exp) { @@ -1106,7 +1086,7 @@ struct obd_export *__class_new_export(struct obd_device *obd, spin_lock_init(&export->exp_uncommitted_replies_lock); INIT_LIST_HEAD(&export->exp_uncommitted_replies); INIT_LIST_HEAD(&export->exp_req_replay_queue); - INIT_LIST_HEAD(&export->exp_handle.h_link); + INIT_LIST_HEAD_RCU(&export->exp_handle.h_link); INIT_LIST_HEAD(&export->exp_hp_rpcs); INIT_LIST_HEAD(&export->exp_reg_rpcs); class_handle_hash(&export->exp_handle, &export_handle_ops); @@ -1236,7 +1216,7 @@ void class_unlink_export(struct obd_export *exp) EXPORT_SYMBOL(class_unlink_export); /* Import management functions */ -static void class_import_destroy(struct obd_import *imp) +static void obd_zombie_import_free(struct obd_import *imp) { ENTRY; @@ -1259,20 +1239,10 @@ static void class_import_destroy(struct obd_import *imp) LASSERT(imp->imp_sec == NULL); class_decref(imp->imp_obd, "import", imp); - OBD_FREE_RCU(imp, sizeof(*imp), &imp->imp_handle); - EXIT; -} - -static void import_handle_addref(void *import) -{ - class_import_get(import); + OBD_FREE_PTR(imp); + EXIT; } -static struct portals_handle_ops import_handle_ops = { - .hop_addref = import_handle_addref, - .hop_free = NULL, -}; - struct obd_import *class_import_get(struct obd_import *import) { atomic_inc(&import->imp_refcount); @@ -1321,7 +1291,7 @@ static void obd_zombie_imp_cull(struct work_struct *ws) struct obd_import *import; import = container_of(ws, struct obd_import, imp_zombie_work); - class_import_destroy(import); + obd_zombie_import_free(import); } struct obd_import *class_new_import(struct obd_device *obd) @@ -1360,8 +1330,6 @@ struct obd_import *class_new_import(struct obd_device *obd) atomic_set(&imp->imp_replay_inflight, 0); atomic_set(&imp->imp_inval_count, 0); INIT_LIST_HEAD(&imp->imp_conn_list); - INIT_LIST_HEAD(&imp->imp_handle.h_link); - class_handle_hash(&imp->imp_handle, &import_handle_ops); init_imp_at(&imp->imp_at); /* the default magic is V2, will be used in connect RPC, and @@ -1377,8 +1345,6 @@ void class_destroy_import(struct obd_import *import) LASSERT(import != NULL); LASSERT(import != LP_POISON); - class_handle_unhash(&import->imp_handle); - spin_lock(&import->imp_lock); import->imp_generation++; spin_unlock(&import->imp_lock); @@ -2259,8 +2225,6 @@ int obd_set_max_mod_rpcs_in_flight(struct client_obd *cli, __u16 max) } EXPORT_SYMBOL(obd_set_max_mod_rpcs_in_flight); - -#define pct(a, b) (b ? a * 100 / b : 0) int obd_mod_rpc_stats_seq_show(struct client_obd *cli, struct seq_file *seq) { @@ -2286,7 +2250,7 @@ int obd_mod_rpc_stats_seq_show(struct client_obd *cli, for (i = 0; i < OBD_HIST_MAX; i++) { unsigned long mod = cli->cl_mod_rpcs_hist.oh_buckets[i]; mod_cum += mod; - seq_printf(seq, "%d:\t\t%10lu %3lu %3lu\n", + seq_printf(seq, "%d:\t\t%10lu %3u %3u\n", i, mod, pct(mod, mod_tot), pct(mod_cum, mod_tot)); if (mod_cum == mod_tot) @@ -2298,8 +2262,6 @@ int obd_mod_rpc_stats_seq_show(struct client_obd *cli, return 0; } EXPORT_SYMBOL(obd_mod_rpc_stats_seq_show); -#undef pct - /* The number of modify RPCs sent in parallel is limited * because the server has a finite number of slots per client to @@ -2395,8 +2357,9 @@ __u16 obd_get_mod_rpc_slot(struct client_obd *cli, __u32 opc, "opc %u, max %hu\n", cli->cl_import->imp_obd->obd_name, opc, max); - l_wait_event(cli->cl_mod_rpcs_waitq, - obd_mod_rpc_slot_avail(cli, close_req), &lwi); + l_wait_event_exclusive(cli->cl_mod_rpcs_waitq, + obd_mod_rpc_slot_avail(cli, close_req), + &lwi); } while (true); } EXPORT_SYMBOL(obd_get_mod_rpc_slot);