From 4eaeb4bc421647ee2867712308d19fc2b6b213ef Mon Sep 17 00:00:00 2001 From: Andrew Perepechko Date: Fri, 18 Dec 2009 23:38:59 +0300 Subject: [PATCH] b=16890 CERROR cleanups a whole lot of CERROR/CDEBUG cleanups --- lustre/quota/lproc_quota.c | 18 ++++++++------- lustre/quota/quota_adjust_qunit.c | 6 ++--- lustre/quota/quota_context.c | 32 +++++++++++++-------------- lustre/quota/quota_ctl.c | 8 +++++-- lustre/quota/quota_interface.c | 46 ++++++++++++++++++--------------------- lustre/quota/quota_master.c | 30 +++++++++++++------------ 6 files changed, 72 insertions(+), 68 deletions(-) diff --git a/lustre/quota/lproc_quota.c b/lustre/quota/lproc_quota.c index a64d7a9..17e0e67 100644 --- a/lustre/quota/lproc_quota.c +++ b/lustre/quota/lproc_quota.c @@ -243,8 +243,9 @@ static int auto_quota_on(struct obd_device *obd, int type, /* turn on cluster wide quota */ rc1 = mds_admin_quota_on(obd, oqctl); if (rc1 && rc1 != -EALREADY) { - CDEBUG(rc1 == -ENOENT ? D_QUOTA : D_ERROR, - "auto-enable admin quota failed. rc=%d\n", rc1); + CDEBUG_LIMIT(rc1 == -ENOENT ? D_QUOTA : D_ERROR, + "%s: auto-enable admin quota failed with " + "rc=%d\n", obd->obd_name, rc1); GOTO(out_ctxt, rc1); } } @@ -259,8 +260,9 @@ static int auto_quota_on(struct obd_device *obd, int type, obd->obd_name, oqctl->qc_type); rc = -EALREADY; } else { - CDEBUG(rc == -ENOENT ? D_QUOTA : D_ERROR, - "auto-enable local quota failed. rc=%d\n", rc); + CDEBUG_LIMIT(rc == -ENOENT ? D_QUOTA : D_ERROR, + "%s: auto-enable local quota failed with rc=%d\n", + obd->obd_name, rc); if (rc1 == -EALREADY) { oqctl->qc_cmd = Q_QUOTAOFF; mds_admin_quota_off(obd, oqctl); @@ -598,8 +600,8 @@ int lquota_proc_setup(struct obd_device *obd, int is_master) lprocfs_quota_common_vars, obd); if (IS_ERR(qctxt->lqc_proc_dir)) { rc = PTR_ERR(qctxt->lqc_proc_dir); - CERROR("error %d setting up lprocfs for %s\n", rc, - obd->obd_name); + CERROR("%s: error %d setting up lprocfs\n", + obd->obd_name, rc); qctxt->lqc_proc_dir = NULL; GOTO(out, rc); } @@ -608,8 +610,8 @@ int lquota_proc_setup(struct obd_device *obd, int is_master) rc = lprocfs_add_vars(qctxt->lqc_proc_dir, lprocfs_quota_master_vars, obd); if (rc) { - CERROR("error %d setting up lprocfs for %s" - "(quota master)\n", rc, obd->obd_name); + CERROR("%s: error %d setting up lprocfs for " + "quota master\n", obd->obd_name, rc); GOTO(out_free_proc, rc); } } diff --git a/lustre/quota/quota_adjust_qunit.c b/lustre/quota/quota_adjust_qunit.c index 4467117..9b1fcdb 100644 --- a/lustre/quota/quota_adjust_qunit.c +++ b/lustre/quota/quota_adjust_qunit.c @@ -176,7 +176,7 @@ struct lustre_qunit_size *quota_search_lqs(unsigned long long lqs_key, if (rc == 0) { return lqs; } else { - CDEBUG(D_ERROR, "get lqs error(rc: %d)\n", rc); + CERROR("get lqs error(rc: %d)\n", rc); return ERR_PTR(rc); } } @@ -195,8 +195,8 @@ int quota_adjust_slave_lqs(struct quota_adjust_qunit *oqaq, lqs = quota_search_lqs(LQS_KEY(QAQ_IS_GRP(oqaq), oqaq->qaq_id), qctxt, QAQ_IS_CREATE_LQS(oqaq) ? 1 : 0); if (lqs == NULL || IS_ERR(lqs)){ - CDEBUG(D_ERROR, "fail to find a lqs(%s id: %u)!\n", - QAQ_IS_GRP(oqaq) ? "group" : "user", oqaq->qaq_id); + CERROR("fail to find a lqs for %sid %u!\n", + QAQ_IS_GRP(oqaq) ? "g" : "u", oqaq->qaq_id); RETURN(PTR_ERR(lqs)); } diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index 588a579..acfe3e5 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -289,8 +289,8 @@ check_cur_qunit(struct obd_device *obd, lqs = quota_search_lqs(LQS_KEY(QDATA_IS_GRP(qdata), qdata->qd_id), qctxt, 0); if (IS_ERR(lqs) || lqs == NULL) { - CDEBUG(D_ERROR, "fail to find a lqs(%s id: %u)!\n", - QDATA_IS_GRP(qdata) ? "group" : "user", qdata->qd_id); + CERROR("fail to find a lqs for %sid: %u)!\n", + QDATA_IS_GRP(qdata) ? "g" : "u", qdata->qd_id); GOTO (out, ret = 0); } spin_lock(&lqs->lqs_lock); @@ -519,8 +519,9 @@ void* quota_barrier(struct lustre_quota_ctxt *qctxt, OBD_SLAB_ALLOC(qunit, qunit_cachep, CFS_ALLOC_IO, sizeof(*qunit)); if (qunit == NULL) { - CERROR("locating qunit failed.(id=%u isblk=%d %s)\n", - oqctl->qc_id, isblk, oqctl->qc_type ? "grp" : "usr"); + CERROR("locating %sunit failed for %sid %u\n", + isblk ? "b" : "i", oqctl->qc_type ? "g" : "u", + oqctl->qc_id); qctxt_wait_pending_dqacq(qctxt, oqctl->qc_id, oqctl->qc_type, isblk); return NULL; @@ -807,14 +808,14 @@ static int dqacq_interpret(const struct lu_env *env, if (qdata->qd_id != qunit->lq_data.qd_id || OBD_FAIL_CHECK(OBD_FAIL_QUOTA_RET_QDATA)) { - CDEBUG(D_ERROR, "the returned qd_id isn't expected!" + CERROR("the returned qd_id isn't expected!" "(qdata: %u, lq_data: %u)\n", qdata->qd_id, qunit->lq_data.qd_id); qdata->qd_id = qunit->lq_data.qd_id; rc = -EPROTO; } if (QDATA_IS_GRP(qdata) != QDATA_IS_GRP(&qunit->lq_data)) { - CDEBUG(D_ERROR, "the returned grp/usr isn't expected!" + CERROR("the returned grp/usr isn't expected!" "(qdata: %u, lq_data: %u)\n", qdata->qd_flags, qunit->lq_data.qd_flags); if (QDATA_IS_GRP(&qunit->lq_data)) @@ -824,7 +825,7 @@ static int dqacq_interpret(const struct lu_env *env, rc = -EPROTO; } if (qdata->qd_count > qunit->lq_data.qd_count) { - CDEBUG(D_ERROR, "the returned qd_count isn't expected!" + CERROR("the returned qd_count isn't expected!" "(qdata: "LPU64", lq_data: "LPU64")\n", qdata->qd_count, qunit->lq_data.qd_count); rc = -EPROTO; @@ -958,7 +959,7 @@ schedule_dqacq(struct obd_device *obd, struct lustre_quota_ctxt *qctxt, /* this is for quota_search_lqs */ lqs_putref(lqs); } else { - CDEBUG(D_ERROR, "Can't find the lustre qunit size!\n"); + CERROR("Can't find the lustre qunit size!\n"); } QDATA_DEBUG(qdata, "obd(%s): send %s quota req\n", @@ -1035,7 +1036,7 @@ schedule_dqacq(struct obd_device *obd, struct lustre_quota_ctxt *qctxt, LUSTRE_MDS_VERSION, opc); class_import_put(imp); if (req == NULL) { - CDEBUG(D_ERROR, "Can't alloc request\n"); + CERROR("Can't alloc request\n"); dqacq_completion(obd, qctxt, qdata, -ENOMEM, opc); /* this is for qunit_get() */ qunit_put(qunit); @@ -1046,7 +1047,7 @@ schedule_dqacq(struct obd_device *obd, struct lustre_quota_ctxt *qctxt, req->rq_no_resend = req->rq_no_delay = 1; rc = quota_copy_qdata(req, qdata, QUOTA_REQUEST, QUOTA_IMPORT); if (rc < 0) { - CDEBUG(D_ERROR, "Can't pack qunit_data(rc: %d)\n", rc); + CERROR("Can't pack qunit_data(rc: %d)\n", rc); ptlrpc_req_finished(req); dqacq_completion(obd, qctxt, qdata, -EPROTO, opc); /* this is for qunit_get() */ @@ -1415,9 +1416,8 @@ static int qslave_recovery_main(void *arg) rc = 0; } - if (rc) - CDEBUG(rc == -EBUSY ? D_QUOTA : D_ERROR, - "qslave recovery failed! (id:%d type:%d " + if (rc && rc != -EBUSY) + CERROR("qslave recovery failed! (id:%d type:%d " " rc:%d)\n", dqid->di_id, type, rc); free: OBD_FREE_PTR(dqid); @@ -1511,7 +1511,7 @@ void build_lqs(struct obd_device *obd) i, &id_list); #endif if (rc) { - CDEBUG(D_ERROR, "fail to get %s qids!\n", + CERROR("%s: failed to get %s qids!\n", obd->obd_name, i ? "group" : "user"); continue; } @@ -1527,8 +1527,8 @@ void build_lqs(struct obd_device *obd) lqs->lqs_flags |= dqid->di_flag; lqs_putref(lqs); } else { - CDEBUG(D_ERROR, "fail to create a lqs" - "(%s id: %u)!\n", i ? "group" : "user", + CERROR("%s: failed to create a lqs for %sid %u" + "\n", obd->obd_name, i ? "g" : "u", dqid->di_id); } diff --git a/lustre/quota/quota_ctl.c b/lustre/quota/quota_ctl.c index 8891c9d..a622e47 100644 --- a/lustre/quota/quota_ctl.c +++ b/lustre/quota/quota_ctl.c @@ -214,7 +214,9 @@ int filter_quota_ctl(struct obd_device *unused, struct obd_export *exp, lqs = quota_search_lqs(LQS_KEY(oqctl->qc_type, oqctl->qc_id), qctxt, 0); if (lqs == NULL || IS_ERR(lqs)){ - CDEBUG(D_ERROR, "fail to create lqs when setquota\n"); + CERROR("fail to create lqs during setquota operation " + "for %sid %u\n", oqctl->qc_type ? "g" : "u", + oqctl->qc_id); } else { lqs->lqs_flags &= ~QB_SET; lqs_putref(lqs); @@ -256,7 +258,9 @@ adjust: lqs = quota_search_lqs(LQS_KEY(oqctl->qc_type, oqctl->qc_id), qctxt, 1); if (lqs == NULL || IS_ERR(lqs)){ - CDEBUG(D_ERROR, "fail to create lqs when setquota\n"); + CERROR("fail to create lqs during setquota operation " + "for %sid %u\n", oqctl->qc_type ? "g" : "u", + oqctl->qc_id); break; } else { lqs->lqs_flags |= QB_SET; diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c index cc103d1..1ecb63c 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -110,7 +110,7 @@ static int filter_quota_setinfo(struct obd_device *obd, void *data) CDEBUG(D_WARNING, "%s: lqc_import(%p) of obd(%p) was " "activated already.\n", obd->obd_name, imp, obd); else - CDEBUG(D_ERROR, "%s: lqc_import(%p:%p) of obd(%p) was " + CERROR("%s: lqc_import(%p:%p) of obd(%p) was " "activated by others.\n", obd->obd_name, qctxt->lqc_import, imp, obd); } else { @@ -190,10 +190,8 @@ static int filter_quota_getflag(struct obd_device *obd, struct obdo *oa) RETURN(0); OBD_ALLOC_PTR(oqctl); - if (!oqctl) { - CERROR("Not enough memory!"); + if (!oqctl) RETURN(-ENOMEM); - } /* set over quota flags for a uid/gid */ oa->o_valid |= OBD_MD_FLUSRQUOTA | OBD_MD_FLGRPQUOTA; @@ -309,9 +307,9 @@ static int quota_check_common(struct obd_device *obd, const unsigned int id[], rc = fsfilt_get_mblk(obd, qctxt->lqc_sb, &mb, inode,frags); if (rc) - CDEBUG(D_ERROR, - "can't get extra " - "meta blocks.\n"); + CERROR("%s: can't get extra " + "meta blocks\n", + obd->obd_name); else pending[i] += mb; } @@ -645,7 +643,8 @@ static int mds_quota_setup(struct obd_device *obd) sema_init(&mds->mds_qonoff_sem, 1); rc = qctxt_init(obd, dqacq_handler); if (rc) { - CERROR("initialize quota context failed! (rc:%d)\n", rc); + CERROR("%s: initialize quota context failed! (rc:%d)\n", + obd->obd_name, rc); RETURN(rc); } mds->mds_quota = 1; @@ -833,26 +832,23 @@ int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[], (flags & OBD_FL_NO_USRQUOTA) : (flags & OBD_FL_NO_GRPQUOTA); oqi = alloc_qinfo(cli, id, cnt); - if (oqi) { - spin_lock(&qinfo_list_lock); - - old = find_qinfo(cli, id, cnt); - if (old && !noquota) - remove_qinfo_hash(old); - else if (!old && noquota) - insert_qinfo_hash(oqi); - - spin_unlock(&qinfo_list_lock); - - if (old || !noquota) - free_qinfo(oqi); - if (old && !noquota) - free_qinfo(old); - } else { - CERROR("not enough mem!\n"); + if (!oqi) { rc = -ENOMEM; break; } + + spin_lock(&qinfo_list_lock); + old = find_qinfo(cli, id, cnt); + if (old && !noquota) + remove_qinfo_hash(old); + else if (!old && noquota) + insert_qinfo_hash(oqi); + spin_unlock(&qinfo_list_lock); + + if (old || !noquota) + free_qinfo(oqi); + if (old && !noquota) + free_qinfo(old); } RETURN(rc); diff --git a/lustre/quota/quota_master.c b/lustre/quota/quota_master.c index 790fd83..f0ccb99 100644 --- a/lustre/quota/quota_master.c +++ b/lustre/quota/quota_master.c @@ -281,7 +281,7 @@ int dqacq_adjust_qunit_sz(struct obd_device *obd, qid_t id, int type, LQUOTA_FLAGS_ADJINO, oqaq); if (rc < 0) { - CDEBUG(D_ERROR, "create oqaq failed! (rc:%d)\n", rc); + CERROR("create oqaq failed! (rc:%d)\n", rc); GOTO(out_sem, rc); } QAQ_DEBUG(oqaq, "show oqaq.\n") @@ -294,8 +294,8 @@ int dqacq_adjust_qunit_sz(struct obd_device *obd, qid_t id, int type, if (adjust_res <= 0) { if (adjust_res < 0) { rc = adjust_res; - CDEBUG(D_ERROR, "adjust mds slave's qunit size failed! \ - (rc:%d)\n", rc); + CERROR("adjust mds slave's qunit size failed! " + "(rc:%d)\n", rc); } else { CDEBUG(D_QUOTA, "qunit doesn't need to be adjusted.\n"); } @@ -315,8 +315,8 @@ int dqacq_adjust_qunit_sz(struct obd_device *obd, qid_t id, int type, rc = 0; } if (rc) { - CDEBUG(D_ERROR, "mds fail to adjust file quota! \ - (rc:%d)\n", rc); + CERROR("%s: mds fail to adjust file quota! (rc:%d)\n", + obd->obd_name, rc); GOTO(out, rc); } @@ -618,8 +618,8 @@ int mds_quota_invalidate(struct obd_device *obd, struct obd_quotactl *oqctl) fp = filp_open(name, O_CREAT | O_TRUNC | O_RDWR, 0644); if (IS_ERR(fp)) { rc = PTR_ERR(fp); - CERROR("error invalidating admin quotafile %s (rc:%d)\n", - name, rc); + CERROR("%s: error invalidating admin quotafile %s (rc:%d)\n", + obd->obd_name, name, rc); } else filp_close(fp, 0); @@ -715,8 +715,8 @@ int init_admin_quotafiles(struct obd_device *obd, struct obd_quotactl *oqctl) /* -EINVAL may be returned by quotainfo for bad quota file */ if (rc != -ENOENT && rc != -EINVAL) { - CERROR("error opening old quota file %s (%d)\n", - name, rc); + CERROR("%s: error opening old quota file %s (%d)\n", + obd->obd_name, name, rc); break; } @@ -727,8 +727,8 @@ int init_admin_quotafiles(struct obd_device *obd, struct obd_quotactl *oqctl) fp = filp_open(name, O_CREAT | O_TRUNC | O_RDWR, 0644); if (IS_ERR(fp)) { rc = PTR_ERR(fp); - CERROR("error creating admin quotafile %s (rc:%d)\n", - name, rc); + CERROR("%s: error creating admin quotafile %s (rc:%d)\n", + obd->obd_name, name, rc); break; } @@ -1723,8 +1723,9 @@ static int qmaster_recovery_main(void *arg) rc = dquot_recovery(obd, dqid->di_id, type); if (rc) - CERROR("qmaster recovery failed! (id:%d type:%d" - " rc:%d)\n", dqid->di_id, type, rc); + CERROR("%s: qmaster recovery failed for %sid %d" + " rc:%d)\n", obd->obd_name, + type ? "g" : "u", dqid->di_id, rc); free: OBD_FREE_PTR(dqid); } @@ -1759,7 +1760,8 @@ int mds_quota_recovery(struct obd_device *obd) rc = kernel_thread(qmaster_recovery_main, &data, CLONE_VM|CLONE_FILES); if (rc < 0) - CERROR("Cannot start quota recovery thread: rc %d\n", rc); + CERROR("%s: cannot start quota recovery thread: rc %d\n", + obd->obd_name, rc); wait_for_completion(&data.comp); RETURN(rc); -- 1.8.3.1