static void fld_server_proc_fini(struct lu_server_fld *fld) { ENTRY; if (fld->lsf_proc_dir != NULL) { if (!IS_ERR(fld->lsf_proc_dir)) lprocfs_remove(&fld->lsf_proc_dir); fld->lsf_proc_dir = NULL; } EXIT; }
static void seq_client_proc_fini(struct lu_client_seq *seq) { #ifdef LPROCFS if (seq->lcs_proc_dir) { if (!IS_ERR(seq->lcs_proc_dir)) lprocfs_remove(&seq->lcs_proc_dir); seq->lcs_proc_dir = NULL; } #endif /* LPROCFS */ }
static void seq_client_proc_fini(struct lu_client_seq *seq) { ENTRY; if (seq->lcs_proc_dir) { if (!IS_ERR(seq->lcs_proc_dir)) lprocfs_remove(&seq->lcs_proc_dir); seq->lcs_proc_dir = NULL; } EXIT; }
static void seq_server_proc_fini(struct lu_server_seq *seq) { ENTRY; if (seq->lss_proc_dir != NULL) { if (!IS_ERR(seq->lss_proc_dir)) lprocfs_remove(&seq->lss_proc_dir); seq->lss_proc_dir = NULL; } EXIT; }
static void seq_client_proc_fini(struct lu_client_seq *seq) { #if defined (CONFIG_PROC_FS) if (seq->lcs_proc_dir) { if (!IS_ERR(seq->lcs_proc_dir)) lprocfs_remove(&seq->lcs_proc_dir); seq->lcs_proc_dir = NULL; } #endif /* CONFIG_PROC_FS */ }
int lquota_proc_cleanup(struct lustre_quota_ctxt *qctxt) { if (!qctxt || !qctxt->lqc_proc_dir) return -EINVAL; if (qctxt->lqc_stats != NULL) lprocfs_free_stats(&qctxt->lqc_stats); lprocfs_remove(&qctxt->lqc_proc_dir); return 0; }
static void __exit fid_exit(void) { # ifdef HAVE_SERVER_SUPPORT fid_server_mod_exit(); # endif if (seq_type_proc_dir != NULL && !IS_ERR(seq_type_proc_dir)) { lprocfs_remove(&seq_type_proc_dir); seq_type_proc_dir = NULL; } }
int osd_procfs_fini(struct osd_device *osd) { if (osd->od_stats) lu_time_fini(&osd->od_stats); if (osd->od_proc_entry) { lprocfs_remove(&osd->od_proc_entry); osd->od_proc_entry = NULL; } RETURN(0); }
void ldlm_namespace_proc_unregister(struct ldlm_namespace *ns) { if (ns->ns_proc_dir_entry == NULL) CERROR("dlm namespace %s has no procfs dir?\n", ldlm_ns_name(ns)); else lprocfs_remove(&ns->ns_proc_dir_entry); if (ns->ns_stats != NULL) lprocfs_free_stats(&ns->ns_stats); }
static void __exit fid_mod_exit(void) { llo_local_obj_unregister(&llod_seq_srv); llo_local_obj_unregister(&llod_seq_ctl); lu_context_key_degister(&seq_thread_key); if (seq_type_proc_dir != NULL && !IS_ERR(seq_type_proc_dir)) { lprocfs_remove(&seq_type_proc_dir); seq_type_proc_dir = NULL; } }
static void seq_server_proc_fini(struct lu_server_seq *seq) { #ifdef CONFIG_PROC_FS ENTRY; if (seq->lss_proc_dir != NULL) { if (!IS_ERR(seq->lss_proc_dir)) lprocfs_remove(&seq->lss_proc_dir); seq->lss_proc_dir = NULL; } EXIT; #endif /* CONFIG_PROC_FS */ }
int osd_procfs_fini(struct osd_device *osd) { ENTRY; if (osd->od_stats) lprocfs_free_stats(&osd->od_stats); if (osd->od_proc_entry) { lprocfs_remove(&osd->od_proc_entry); osd->od_proc_entry = NULL; } RETURN(0); }
static void __exit lustre_exit(void) { lustre_register_client_fill_super(NULL); lustre_register_kill_super_cb(NULL); lustre_register_client_process_config(NULL); lprocfs_remove(&proc_lustre_fs_root); ll_xattr_fini(); cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck); vvp_global_fini(); kmem_cache_destroy(ll_inode_cachep); kmem_cache_destroy(ll_file_data_slab); }
void ldlm_namespace_proc_unregister(struct ldlm_namespace *ns) { struct proc_dir_entry *dir; dir = lprocfs_srch(ldlm_ns_proc_dir, ldlm_ns_name(ns)); if (dir == NULL) { CERROR("dlm namespace %s has no procfs dir?\n", ldlm_ns_name(ns)); } else { lprocfs_remove(&dir); } if (ns->ns_stats != NULL) lprocfs_free_stats(&ns->ns_stats); }
static int fld_server_proc_init(struct lu_server_fld *fld) { int rc = 0; ENTRY; fld->lsf_proc_dir = lprocfs_register(fld->lsf_name, fld_type_proc_dir, fld_server_proc_list, fld); if (IS_ERR(fld->lsf_proc_dir)) { rc = PTR_ERR(fld->lsf_proc_dir); RETURN(rc); } rc = lprocfs_seq_create(fld->lsf_proc_dir, "fldb", 0444, &fld_proc_seq_fops, fld); if (rc) { lprocfs_remove(&fld->lsf_proc_dir); fld->lsf_proc_dir = NULL; } RETURN(rc); }
static void lprocfs_free_client_stats(struct nid_stat *client_stat) { CDEBUG(D_CONFIG, "stat %p - data %p/%p\n", client_stat, client_stat->nid_proc, client_stat->nid_stats); LASSERTF(atomic_read(&client_stat->nid_exp_ref_count) == 0, "nid %s:count %d\n", libcfs_nid2str(client_stat->nid), atomic_read(&client_stat->nid_exp_ref_count)); if (client_stat->nid_proc) lprocfs_remove(&client_stat->nid_proc); if (client_stat->nid_stats) lprocfs_free_stats(&client_stat->nid_stats); if (client_stat->nid_ldlm_stats) lprocfs_free_stats(&client_stat->nid_ldlm_stats); OBD_FREE_PTR(client_stat); return; }
/* * Release quota master target and all data structure associated with this * target. * Called on MDT0 cleanup. * * \param env - is the environment passed by the caller * \param ld - is the lu_device associated with the qmt device to be released * * \retval - NULL on success (backend OSD device is managed by the main stack), * appropriate error on failure */ static struct lu_device *qmt_device_fini(const struct lu_env *env, struct lu_device *ld) { struct qmt_device *qmt = lu2qmt_dev(ld); ENTRY; LASSERT(qmt != NULL); CDEBUG(D_QUOTA, "%s: initiating QMT shutdown\n", qmt->qmt_svname); qmt->qmt_stopping = true; /* kill pool instances, if any */ qmt_pool_fini(env, qmt); /* remove qmt proc entry */ if (qmt->qmt_proc != NULL && !IS_ERR(qmt->qmt_proc)) { lprocfs_remove(&qmt->qmt_proc); qmt->qmt_proc = NULL; } /* stop rebalance thread */ qmt_stop_reba_thread(qmt); /* disconnect from OSD */ if (qmt->qmt_child_exp != NULL) { obd_disconnect(qmt->qmt_child_exp); qmt->qmt_child_exp = NULL; qmt->qmt_child = NULL; } /* clear references to MDT namespace */ ld->ld_obd->obd_namespace = NULL; qmt->qmt_ns = NULL; RETURN(NULL); }
/* * Release a qsd_instance. Companion of qsd_init(). This releases all data * structures associated with the quota slave (on-disk objects, lquota entry * tables, ...). * This function should be called when the OSD is shutting down. * * \param env - is the environment passed by the caller * \param qsd - is the qsd instance to shutdown */ void qsd_fini(const struct lu_env *env, struct qsd_instance *qsd) { int qtype; ENTRY; if (unlikely(qsd == NULL)) RETURN_EXIT; CDEBUG(D_QUOTA, "%s: initiating QSD shutdown\n", qsd->qsd_svname); write_lock(&qsd->qsd_lock); qsd->qsd_stopping = true; write_unlock(&qsd->qsd_lock); /* remove qsd proc entry */ if (qsd->qsd_proc != NULL) { lprocfs_remove(&qsd->qsd_proc); qsd->qsd_proc = NULL; } /* stop the writeback thread */ qsd_stop_upd_thread(qsd); /* shutdown the reintegration threads */ for (qtype = USRQUOTA; qtype < MAXQUOTAS; qtype++) { if (qsd->qsd_type_array[qtype] == NULL) continue; qsd_stop_reint_thread(qsd->qsd_type_array[qtype]); } if (qsd->qsd_ns != NULL) { qsd->qsd_ns = NULL; } /* free per-quota type data */ for (qtype = USRQUOTA; qtype < MAXQUOTAS; qtype++) qsd_qtype_fini(env, qsd, qtype); /* deregister connection to the quota master */ qsd->qsd_exp_valid = false; lustre_deregister_lwp_item(&qsd->qsd_exp); /* release per-filesystem information */ if (qsd->qsd_fsinfo != NULL) { mutex_lock(&qsd->qsd_fsinfo->qfs_mutex); /* remove from the list of fsinfo */ cfs_list_del_init(&qsd->qsd_link); mutex_unlock(&qsd->qsd_fsinfo->qfs_mutex); qsd_put_fsinfo(qsd->qsd_fsinfo); qsd->qsd_fsinfo = NULL; } /* release quota root directory */ if (qsd->qsd_root != NULL) { lu_object_put(env, &qsd->qsd_root->do_lu); qsd->qsd_root = NULL; } /* release reference on dt_device */ if (qsd->qsd_dev != NULL) { lu_ref_del(&qsd->qsd_dev->dd_lu_dev.ld_reference, "qsd", qsd); lu_device_put(&qsd->qsd_dev->dd_lu_dev); qsd->qsd_dev = NULL; } CDEBUG(D_QUOTA, "%s: QSD shutdown completed\n", qsd->qsd_svname); OBD_FREE_PTR(qsd); EXIT; }
int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid) { struct nid_stat *new_stat, *old_stat; struct obd_device *obd = NULL; struct proc_dir_entry *entry; char *buffer = NULL; int rc = 0; ENTRY; *newnid = 0; if (!exp || !exp->exp_obd || !exp->exp_obd->obd_proc_exports_entry || !exp->exp_obd->obd_nid_stats_hash) RETURN(-EINVAL); /* not test against zero because eric say: * You may only test nid against another nid, or LNET_NID_ANY. * Anything else is nonsense.*/ if (!nid || *nid == LNET_NID_ANY) RETURN(0); spin_lock(&exp->exp_lock); if (exp->exp_nid_stats != NULL) { spin_unlock(&exp->exp_lock); RETURN(-EALREADY); } spin_unlock(&exp->exp_lock); obd = exp->exp_obd; CDEBUG(D_CONFIG, "using hash %p\n", obd->obd_nid_stats_hash); OBD_ALLOC_PTR(new_stat); if (new_stat == NULL) RETURN(-ENOMEM); new_stat->nid = *nid; new_stat->nid_obd = exp->exp_obd; /* we need set default refcount to 1 to balance obd_disconnect */ atomic_set(&new_stat->nid_exp_ref_count, 1); old_stat = cfs_hash_findadd_unique(obd->obd_nid_stats_hash, nid, &new_stat->nid_hash); CDEBUG(D_INFO, "Found stats %p for nid %s - ref %d\n", old_stat, libcfs_nid2str(*nid), atomic_read(&new_stat->nid_exp_ref_count)); /* Return -EALREADY here so that we know that the /proc * entry already has been created */ if (old_stat != new_stat) { spin_lock(&exp->exp_lock); if (exp->exp_nid_stats) { LASSERT(exp->exp_nid_stats == old_stat); nidstat_putref(exp->exp_nid_stats); } exp->exp_nid_stats = old_stat; spin_unlock(&exp->exp_lock); GOTO(destroy_new, rc = -EALREADY); } /* not found - create */ OBD_ALLOC(buffer, LNET_NIDSTR_SIZE); if (buffer == NULL) GOTO(destroy_new, rc = -ENOMEM); memcpy(buffer, libcfs_nid2str(*nid), LNET_NIDSTR_SIZE); #ifndef HAVE_ONLY_PROCFS_SEQ new_stat->nid_proc = lprocfs_register(buffer, obd->obd_proc_exports_entry, NULL, NULL); #else new_stat->nid_proc = lprocfs_seq_register(buffer, obd->obd_proc_exports_entry, NULL, NULL); #endif OBD_FREE(buffer, LNET_NIDSTR_SIZE); if (IS_ERR(new_stat->nid_proc)) { rc = PTR_ERR(new_stat->nid_proc); new_stat->nid_proc = NULL; CERROR("%s: cannot create proc entry for export %s: rc = %d\n", obd->obd_name, libcfs_nid2str(*nid), rc); GOTO(destroy_new_ns, rc); } entry = lprocfs_add_simple(new_stat->nid_proc, "uuid", new_stat, &lprocfs_exp_uuid_fops); if (IS_ERR(entry)) { CWARN("Error adding the NID stats file\n"); rc = PTR_ERR(entry); GOTO(destroy_new_ns, rc); } entry = lprocfs_add_simple(new_stat->nid_proc, "hash", new_stat, &lprocfs_exp_hash_fops); if (IS_ERR(entry)) { CWARN("Error adding the hash file\n"); rc = PTR_ERR(entry); GOTO(destroy_new_ns, rc); } spin_lock(&exp->exp_lock); exp->exp_nid_stats = new_stat; spin_unlock(&exp->exp_lock); *newnid = 1; /* protect competitive add to list, not need locking on destroy */ spin_lock(&obd->obd_nid_lock); list_add(&new_stat->nid_list, &obd->obd_nid_stats); spin_unlock(&obd->obd_nid_lock); RETURN(rc); destroy_new_ns: if (new_stat->nid_proc != NULL) lprocfs_remove(&new_stat->nid_proc); cfs_hash_del(obd->obd_nid_stats_hash, nid, &new_stat->nid_hash); destroy_new: nidstat_putref(new_stat); OBD_FREE_PTR(new_stat); RETURN(rc); }
static int __init lustre_init(void) { struct proc_dir_entry *entry; lnet_process_id_t lnet_id; struct timeval tv; int i, rc, seed[2]; CLASSERT(sizeof(LUSTRE_VOLATILE_HDR) == LUSTRE_VOLATILE_HDR_LEN + 1); /* print an address of _any_ initialized kernel symbol from this * module, to allow debugging with gdb that doesn't support data * symbols from modules.*/ CDEBUG(D_INFO, "Lustre client module (%p).\n", &lustre_super_operations); ll_inode_cachep = kmem_cache_create("lustre_inode_cache", sizeof(struct ll_inode_info), 0, SLAB_HWCACHE_ALIGN, NULL); if (ll_inode_cachep == NULL) GOTO(out_cache, rc = -ENOMEM); ll_file_data_slab = kmem_cache_create("ll_file_data", sizeof(struct ll_file_data), 0, SLAB_HWCACHE_ALIGN, NULL); if (ll_file_data_slab == NULL) GOTO(out_cache, rc = -ENOMEM); ll_remote_perm_cachep = kmem_cache_create("ll_remote_perm_cache", sizeof(struct ll_remote_perm), 0, 0, NULL); if (ll_remote_perm_cachep == NULL) GOTO(out_cache, rc = -ENOMEM); ll_rmtperm_hash_cachep = kmem_cache_create("ll_rmtperm_hash_cache", REMOTE_PERM_HASHSIZE * sizeof(struct hlist_head), 0, 0, NULL); if (ll_rmtperm_hash_cachep == NULL) GOTO(out_cache, rc = -ENOMEM); entry = lprocfs_register("llite", proc_lustre_root, NULL, NULL); if (IS_ERR(entry)) { rc = PTR_ERR(entry); CERROR("cannot register '/proc/fs/lustre/llite': rc = %d\n", rc); GOTO(out_cache, rc); } proc_lustre_fs_root = entry; cfs_get_random_bytes(seed, sizeof(seed)); /* Nodes with small feet have little entropy. The NID for this * node gives the most entropy in the low bits. */ for (i = 0;; i++) { if (LNetGetId(i, &lnet_id) == -ENOENT) break; if (LNET_NETTYP(LNET_NIDNET(lnet_id.nid)) != LOLND) seed[0] ^= LNET_NIDADDR(lnet_id.nid); } do_gettimeofday(&tv); cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]); rc = vvp_global_init(); if (rc != 0) GOTO(out_proc, rc); cl_inode_fini_env = cl_env_alloc(&cl_inode_fini_refcheck, LCT_REMEMBER | LCT_NOREF); if (IS_ERR(cl_inode_fini_env)) GOTO(out_vvp, rc = PTR_ERR(cl_inode_fini_env)); cl_inode_fini_env->le_ctx.lc_cookie = 0x4; rc = ll_xattr_init(); if (rc != 0) GOTO(out_inode_fini_env, rc); lustre_register_client_fill_super(ll_fill_super); lustre_register_kill_super_cb(ll_kill_super); lustre_register_client_process_config(ll_process_config); RETURN(0); out_inode_fini_env: cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck); out_vvp: vvp_global_fini(); out_proc: lprocfs_remove(&proc_lustre_fs_root); out_cache: if (ll_inode_cachep != NULL) kmem_cache_destroy(ll_inode_cachep); if (ll_file_data_slab != NULL) kmem_cache_destroy(ll_file_data_slab); if (ll_remote_perm_cachep != NULL) kmem_cache_destroy(ll_remote_perm_cachep); if (ll_rmtperm_hash_cachep != NULL) kmem_cache_destroy(ll_rmtperm_hash_cachep); return rc; }
int lquota_proc_setup(struct obd_device *obd, int is_master) { struct lustre_quota_ctxt *qctxt = &obd->u.obt.obt_qctxt; int rc = 0; ENTRY; LASSERT(lquota_type_proc_dir && obd); qctxt->lqc_proc_dir = lprocfs_register(obd->obd_name, lquota_type_proc_dir, lprocfs_quota_common_vars, obd); if (IS_ERR(qctxt->lqc_proc_dir)) { rc = PTR_ERR(qctxt->lqc_proc_dir); CERROR("%s: error %d setting up lprocfs\n", obd->obd_name, rc); qctxt->lqc_proc_dir = NULL; GOTO(out, rc); } if (is_master) { rc = lprocfs_add_vars(qctxt->lqc_proc_dir, lprocfs_quota_master_vars, obd); if (rc) { CERROR("%s: error %d setting up lprocfs for " "quota master\n", obd->obd_name, rc); GOTO(out_free_proc, rc); } } qctxt->lqc_stats = lprocfs_alloc_stats(LQUOTA_LAST_STAT - LQUOTA_FIRST_STAT, 0); if (!qctxt->lqc_stats) GOTO(out_free_proc, rc = -ENOMEM); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_SYNC_ACQ, LPROCFS_CNTR_AVGMINMAX, "sync_acq_req", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_SYNC_REL, LPROCFS_CNTR_AVGMINMAX, "sync_rel_req", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_ASYNC_ACQ, LPROCFS_CNTR_AVGMINMAX, "async_acq_req", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_ASYNC_REL, LPROCFS_CNTR_AVGMINMAX, "async_rel_req", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_WAIT_FOR_CHK_BLK, LPROCFS_CNTR_AVGMINMAX, "wait_for_blk_quota(lquota_chkquota)", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_WAIT_FOR_CHK_INO, LPROCFS_CNTR_AVGMINMAX, "wait_for_ino_quota(lquota_chkquota)", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_WAIT_FOR_COMMIT_BLK, LPROCFS_CNTR_AVGMINMAX, "wait_for_blk_quota(lquota_pending_commit)", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_WAIT_FOR_COMMIT_INO, LPROCFS_CNTR_AVGMINMAX, "wait_for_ino_quota(lquota_pending_commit)", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_WAIT_PENDING_BLK_QUOTA, LPROCFS_CNTR_AVGMINMAX, "wait_for_pending_blk_quota_req" "(qctxt_wait_pending_dqacq)", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_WAIT_PENDING_INO_QUOTA, LPROCFS_CNTR_AVGMINMAX, "wait_for_pending_ino_quota_req" "(qctxt_wait_pending_dqacq)", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_NOWAIT_PENDING_BLK_QUOTA, LPROCFS_CNTR_AVGMINMAX, "nowait_for_pending_blk_quota_req" "(qctxt_wait_pending_dqacq)", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_NOWAIT_PENDING_INO_QUOTA, LPROCFS_CNTR_AVGMINMAX, "nowait_for_pending_ino_quota_req" "(qctxt_wait_pending_dqacq)", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_QUOTA_CTL, LPROCFS_CNTR_AVGMINMAX, "quota_ctl", "us"); lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_ADJUST_QUNIT, LPROCFS_CNTR_AVGMINMAX, "adjust_qunit", "us"); lprocfs_register_stats(qctxt->lqc_proc_dir, "stats", qctxt->lqc_stats); RETURN(rc); out_free_proc: lprocfs_remove(&qctxt->lqc_proc_dir); out: RETURN(rc); }
void mdd_procfs_fini(struct mdd_device *mdd) { if (mdd->mdd_proc_entry) lprocfs_remove(&mdd->mdd_proc_entry); }