From: nikita Date: Wed, 12 Apr 2006 12:40:23 +0000 (+0000) Subject: fix module initialization X-Git-Tag: v1_8_0_110~486^2~2037 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=d637db5a318588d53b69db47c8ac74e5fe33edde;p=fs%2Flustre-release.git fix module initialization --- diff --git a/lustre/cmm/cmm_device.c b/lustre/cmm/cmm_device.c index c3b2300..ff1e9da 100644 --- a/lustre/cmm/cmm_device.c +++ b/lustre/cmm/cmm_device.c @@ -189,21 +189,10 @@ LPROCFS_INIT_VARS(cmm, lprocfs_cmm_module_vars, lprocfs_cmm_obd_vars); static int __init cmm_mod_init(void) { struct lprocfs_static_vars lvars; - struct obd_type *type; - int result; lprocfs_init_vars(cmm, &lvars); - result = class_register_type(&cmm_obd_device_ops, - lvars.module_vars, LUSTRE_CMM0_NAME); - if (result == 0) { - type = class_get_type(LUSTRE_CMM0_NAME); - LASSERT(type != NULL); - type->typ_lu = &cmm_device_type; - result = type->typ_lu->ldt_ops->ldto_init(type->typ_lu); - if (result != 0) - class_unregister_type(LUSTRE_CMM0_NAME); - } - return result; + return class_register_type(&cmm_obd_device_ops, lvars.module_vars, + LUSTRE_CMM0_NAME, &cmm_device_type); } static void __exit cmm_mod_exit(void) diff --git a/lustre/ldiskfs/quotafmt_test.c b/lustre/ldiskfs/quotafmt_test.c index 57b4546..0ceec62 100644 --- a/lustre/ldiskfs/quotafmt_test.c +++ b/lustre/ldiskfs/quotafmt_test.c @@ -487,7 +487,7 @@ static int __init quotfmt_test_init(void) lprocfs_init_vars(quotfmt_test, &lvars); return class_register_type("fmt_obd_ops, lvars.module_vars, - "quotfmt_test"); + "quotfmt_test", NULL); } static void __exit quotfmt_test_exit(void) diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 8b9a3e5..03b94ef 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -740,7 +740,7 @@ static int lov_cleanup(struct obd_device *obd) if (!obd_uuid_empty(&tgt->uuid)) { CERROR("lov tgt %d not cleaned!" " deathrow=%d, lovrc=%d\n", - i, lov->death_row, + i, lov->death_row, atomic_read(&lov->refcount)); lov_del_target(obd, &tgt->uuid, i, 0); } @@ -789,7 +789,7 @@ static int lov_process_config(struct obd_device *obd, obd_count len, void *buf) if (!desc) GOTO(out, rc = -EINVAL); /* see jt_obd_lov_getconfig for variable names */ - /* setparam 0:lov_mdsA 1:default_stripe_size=1048576 + /* setparam 0:lov_mdsA 1:default_stripe_size=1048576 2:default_stripe_pattern=0 3:default_stripe_offset=0 */ for (i = 1; i < lcfg->lcfg_bufcount; i++) { char *key, *sval; @@ -1528,11 +1528,11 @@ int lov_prep_async_page(struct obd_export *exp, struct lov_stripe_md *lsm, if (!page) { int i = 0; /* Find an existing osc so we can get it's stupid sizeof(*oap). - Only because of this layering limitation will a client + Only because of this layering limitation will a client mount with no osts fail */ while (!lov->tgts[i].ltd_exp) { i++; - if (i >= lov->desc.ld_tgt_count) + if (i >= lov->desc.ld_tgt_count) RETURN(-ENOTBLK); } rc = size_round(sizeof(*lap)) + @@ -2191,7 +2191,7 @@ static int lov_get_info(struct obd_export *exp, __u32 keylen, GOTO(out, rc); } GOTO(out, rc = 0); - } else if (keylen >= strlen(KEY_LOVDESC) && + } else if (keylen >= strlen(KEY_LOVDESC) && strcmp(key, KEY_LOVDESC) == 0) { struct lov_desc *desc_ret = val; *desc_ret = lov->desc; @@ -2289,7 +2289,7 @@ static int lov_checkmd(struct obd_export *exp, struct obd_export *md_exp, LASSERT(md_exp); LASSERT(lsm_op_find(lsm->lsm_magic) != NULL); rc = lsm_op_find(lsm->lsm_magic)->lsm_revalidate(lsm, md_exp->exp_obd); - + RETURN(rc); } @@ -2474,7 +2474,7 @@ int __init lov_init(void) init_obd_quota_ops(quota_interface, &lov_obd_ops); rc = class_register_type(&lov_obd_ops, lvars.module_vars, - OBD_LOV_DEVICENAME); + OBD_LOV_DEVICENAME, NULL); if (rc && quota_interface) PORTAL_SYMBOL_PUT(osc_quota_interface); diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index bb75303..b23349c 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -1243,7 +1243,7 @@ int __init mdc_init(void) init_obd_quota_ops(quota_interface, &mdc_obd_ops); rc = class_register_type(&mdc_obd_ops, lvars.module_vars, - LUSTRE_MDC_NAME); + LUSTRE_MDC_NAME, NULL); if (rc && quota_interface) PORTAL_SYMBOL_PUT(mdc_quota_interface); diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index 45b526e..1488ae1 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -744,21 +744,10 @@ LPROCFS_INIT_VARS(mdd, lprocfs_mdd_module_vars, lprocfs_mdd_obd_vars); static int __init mdd_mod_init(void) { struct lprocfs_static_vars lvars; - struct obd_type *type; - int result; lprocfs_init_vars(mdd, &lvars); - result = class_register_type(&mdd_obd_device_ops, - lvars.module_vars, LUSTRE_MDD0_NAME); - if (result == 0) { - type = class_get_type(LUSTRE_MDD0_NAME); - LASSERT(type != NULL); - type->typ_lu = &mdd_device_type; - result = type->typ_lu->ldt_ops->ldto_init(type->typ_lu); - if (result != 0) - class_unregister_type(LUSTRE_MDD0_NAME); - } - return result; + return class_register_type(&mdd_obd_device_ops, lvars.module_vars, + LUSTRE_MDD0_NAME, &mdd_device_type); } static void __exit mdd_mod_exit(void) diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 7ed8c41..713b98a 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -2625,9 +2625,11 @@ static int __init mds_init(void) init_obd_quota_ops(quota_interface, &mds_obd_ops); lprocfs_init_vars(mds, &lvars); - class_register_type(&mds_obd_ops, lvars.module_vars, LUSTRE_MDS_NAME); + class_register_type(&mds_obd_ops, + lvars.module_vars, LUSTRE_MDS_NAME, NULL); lprocfs_init_vars(mdt, &lvars); - class_register_type(&mdt_obd_ops, lvars.module_vars, LUSTRE_MDT_NAME); + class_register_type(&mdt_obd_ops, + lvars.module_vars, LUSTRE_MDT_NAME, NULL); return 0; } @@ -2675,7 +2677,7 @@ static int __init mds_cmd_init(void) lprocfs_init_vars(mds, &lvars); class_register_type(&mds_cmd_obd_ops, lvars.module_vars, - LUSTRE_MDS_NAME); + LUSTRE_MDS_NAME, NULL); return 0; } diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index e082c06..b033b16 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1359,22 +1359,11 @@ LPROCFS_INIT_VARS(mdt, lprocfs_mdt_module_vars, lprocfs_mdt_obd_vars); static int __init mdt_mod_init(void) { struct lprocfs_static_vars lvars; - struct obd_type *type; - int result; mdt_num_threads = MDT_NUM_THREADS; lprocfs_init_vars(mdt, &lvars); - result = class_register_type(&mdt_obd_device_ops, - lvars.module_vars, LUSTRE_MDT0_NAME); - if (result == 0) { - type = class_get_type(LUSTRE_MDT0_NAME); - LASSERT(type != NULL); - type->typ_lu = &mdt_device_type; - result = type->typ_lu->ldt_ops->ldto_init(type->typ_lu); - if (result != 0) - class_unregister_type(LUSTRE_MDT0_NAME); - } - return result; + return class_register_type(&mdt_obd_device_ops, lvars.module_vars, + LUSTRE_MDT0_NAME, &mdt_device_type); } static void __exit mdt_mod_exit(void) diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 05e73cc..9c6b1d2 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -1073,7 +1073,7 @@ struct obd_ops mgc_obd_ops = { int __init mgc_init(void) { - return class_register_type(&mgc_obd_ops, NULL, LUSTRE_MGC_NAME); + return class_register_type(&mgc_obd_ops, NULL, LUSTRE_MGC_NAME, NULL); } #ifdef __KERNEL__ diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index d4c5aef..9f89bb4 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -672,7 +672,8 @@ static int __init mgs_init(void) struct lprocfs_static_vars lvars; lprocfs_init_vars(mgs, &lvars); - class_register_type(&mgs_obd_ops, lvars.module_vars, LUSTRE_MGS_NAME); + class_register_type(&mgs_obd_ops, + lvars.module_vars, LUSTRE_MGS_NAME, NULL); return 0; } diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c index 53e4469..471db4d 100644 --- a/lustre/obdclass/llog_test.c +++ b/lustre/obdclass/llog_test.c @@ -686,7 +686,8 @@ static int __init llog_test_init(void) struct lprocfs_static_vars lvars; lprocfs_init_vars(llog_test, &lvars); - return class_register_type(&llog_obd_ops,lvars.module_vars,"llog_test"); + return class_register_type(&llog_obd_ops, + lvars.module_vars,"llog_test", NULL); } static void __exit llog_test_exit(void) diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index 5be0f8b..9b61175 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -598,7 +598,7 @@ static int __init obdecho_init(void) goto failed_0; rc = class_register_type(&echo_obd_ops, lvars.module_vars, - OBD_ECHO_DEVICENAME); + OBD_ECHO_DEVICENAME, NULL); if (rc != 0) goto failed_1; diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 5c90203..06796e6 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -1469,7 +1469,7 @@ int echo_client_init(void) lprocfs_init_vars(echo, &lvars); return class_register_type(&echo_obd_ops, lvars.module_vars, - OBD_ECHO_CLIENT_DEVICENAME); + OBD_ECHO_CLIENT_DEVICENAME, NULL); } void echo_client_exit(void) diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 8d773c3..ab7e3f0 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -3142,12 +3142,12 @@ static int __init obdfilter_init(void) init_obd_quota_ops(quota_interface, &filter_sanobd_ops); rc = class_register_type(&filter_obd_ops, lvars.module_vars, - LUSTRE_OST_NAME); + LUSTRE_OST_NAME, NULL); if (rc) GOTO(out, rc); rc = class_register_type(&filter_sanobd_ops, lvars.module_vars, - LUSTRE_OSTSAN_NAME); + LUSTRE_OSTSAN_NAME, NULL); if (rc) { class_unregister_type(LUSTRE_OST_NAME); out: diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 5aecb18..06e376d 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -3482,7 +3482,7 @@ int __init osc_init(void) init_obd_quota_ops(quota_interface, &osc_obd_ops); rc = class_register_type(&osc_obd_ops, lvars.module_vars, - LUSTRE_OSC_NAME); + LUSTRE_OSC_NAME, NULL); if (rc) { if (quota_interface) PORTAL_SYMBOL_PUT(osc_quota_interface); @@ -3491,7 +3491,7 @@ int __init osc_init(void) #if defined(__KERNEL__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) rc = class_register_type(&sanosc_obd_ops, sanlvars.module_vars, - LUSTRE_SANOSC_NAME); + LUSTRE_SANOSC_NAME, NULL); if (rc) { class_unregister_type(LUSTRE_OSC_NAME); if (quota_interface) diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index 9d19465..d516071 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -51,6 +51,7 @@ #include "osd_internal.h" static int osd_root_get (struct dt_device *dev, struct lu_fid *f); +static int osd_statfs (struct dt_device *dev, struct kstatfs *sfs); static int lu_device_is_osd (const struct lu_device *d); static void osd_mod_exit (void) __exit; @@ -216,7 +217,7 @@ static int osd_statfs(struct dt_device *d, struct kstatfs *sfs) { struct osd_device *osd = dt2osd_dev(d); struct super_block *sb = osd->od_dt_dev.dd_lmi->lmi_sb; - int result = -EOPNOTSUPP; + int result; ENTRY; @@ -386,21 +387,10 @@ LPROCFS_INIT_VARS(osd, lprocfs_osd_module_vars, lprocfs_osd_obd_vars); static int __init osd_mod_init(void) { struct lprocfs_static_vars lvars; - struct obd_type *type; - int result; lprocfs_init_vars(osd, &lvars); - result = class_register_type(&osd_obd_device_ops, - lvars.module_vars, LUSTRE_OSD0_NAME); - if (result == 0) { - type = class_get_type(LUSTRE_OSD0_NAME); - LASSERT(type != NULL); - type->typ_lu = &osd_device_type; - result = type->typ_lu->ldt_ops->ldto_init(type->typ_lu); - if (result != 0) - class_unregister_type(LUSTRE_OSD0_NAME); - } - return result; + return class_register_type(&osd_obd_device_ops, lvars.module_vars, + LUSTRE_OSD0_NAME, &osd_device_type); } static void __exit osd_mod_exit(void) diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 95efaef..a7ae978 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -1765,7 +1765,7 @@ static int __init ost_init(void) lprocfs_init_vars(ost, &lvars); rc = class_register_type(&ost_obd_ops, lvars.module_vars, - LUSTRE_OSS_NAME); + LUSTRE_OSS_NAME, NULL); RETURN(rc); } diff --git a/lustre/quota/quotacheck_test.c b/lustre/quota/quotacheck_test.c index fb9618e..ba3778c 100644 --- a/lustre/quota/quotacheck_test.c +++ b/lustre/quota/quotacheck_test.c @@ -200,7 +200,7 @@ static int __init quotacheck_test_init(void) lprocfs_init_vars(quotacheck_test, &lvars); return class_register_type("acheck_obd_ops, lvars.module_vars, - "quotacheck_test"); + "quotacheck_test", NULL); } static void __exit quotacheck_test_exit(void) diff --git a/lustre/quota/quotactl_test.c b/lustre/quota/quotactl_test.c index 31c08e0..f352ea3 100644 --- a/lustre/quota/quotactl_test.c +++ b/lustre/quota/quotactl_test.c @@ -341,7 +341,7 @@ static int __init quotactl_test_init(void) lprocfs_init_vars(quotactl_test, &lvars); return class_register_type("actl_obd_ops, lvars.module_vars, - "quotactl_test"); + "quotactl_test", NULL); } static void __exit quotactl_test_exit(void)