From ac8de1d1695433d900d751293142d56cb16b4fa1 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 30 Jan 2004 18:17:30 +0000 Subject: [PATCH] Don't spam syslog with llog cancel messages. --- lustre/ptlrpc/llog_server.c | 56 ++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/lustre/ptlrpc/llog_server.c b/lustre/ptlrpc/llog_server.c index 404b3d8..b0d8d74 100644 --- a/lustre/ptlrpc/llog_server.c +++ b/lustre/ptlrpc/llog_server.c @@ -272,13 +272,13 @@ int llog_origin_handle_cancel(struct ptlrpc_request *req) LASSERT(cathandle != NULL); inode = cathandle->lgh_file->f_dentry->d_inode; - handle = fsfilt_start(disk_obd, inode, + handle = fsfilt_start(disk_obd, inode, FSFILT_OP_CANCEL_UNLINK_LOG, NULL); if (IS_ERR(handle)) { CERROR("fsfilt_start failed: %ld\n", PTR_ERR(handle)); GOTO(pop_ctxt, rc = PTR_ERR(handle)); } - + rc = llog_cat_cancel_records(cathandle, 1, logcookies); err = fsfilt_commit(disk_obd, inode, handle, 0); @@ -294,13 +294,13 @@ pop_ctxt: if (rc) CERROR("cancel %d llog-records failed: %d\n", num_cookies, rc); else - CWARN("cancel %d llog-records\n", num_cookies); + CDEBUG(D_HA, "cancel %d llog-records\n", num_cookies); RETURN(rc); } EXPORT_SYMBOL(llog_origin_handle_cancel); -static int llog_catinfo_config(struct obd_device *obd, char *buf, int buf_len, +static int llog_catinfo_config(struct obd_device *obd, char *buf, int buf_len, char *client) { struct mds_obd *mds = &obd->u.mds; @@ -310,17 +310,17 @@ static int llog_catinfo_config(struct obd_device *obd, char *buf, int buf_len, char name[4][64]; int rc, i, l, remains = buf_len; char *out = buf; - + if (ctxt == NULL || mds == NULL) RETURN(-EOPNOTSUPP); push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL); - + sprintf(name[0], "%s", mds->mds_profile); sprintf(name[1], "%s-clean", mds->mds_profile); sprintf(name[2], "%s", client); sprintf(name[3], "%s-clean", client); - + for (i = 0; i < 4; i++) { int index, uncanceled = 0; rc = llog_create(ctxt, &handle, NULL, name[i]); @@ -331,15 +331,15 @@ static int llog_catinfo_config(struct obd_device *obd, char *buf, int buf_len, llog_close(handle); GOTO(out_pop, rc = -ENOENT); } - + for (index = 1; index < (LLOG_BITMAP_BYTES * 8); index ++) { if (ext2_test_bit(index, handle->lgh_hdr->llh_bitmap)) uncanceled++; } - + l = snprintf(out, remains, "[Log Name]: %s\nLog Size: "LPD64"\n" "Last Index: %d\nUncanceled Records: %d\n\n", - name[i], + name[i], handle->lgh_file->f_dentry->d_inode->i_size, handle->lgh_last_idx, uncanceled); @@ -362,7 +362,7 @@ struct cb_data { int init; }; -static int llog_catinfo_cb(struct llog_handle *cat, +static int llog_catinfo_cb(struct llog_handle *cat, struct llog_rec_hdr *rec, void *data) { static char *out = NULL; @@ -383,7 +383,7 @@ static int llog_catinfo_cb(struct llog_handle *cat, if (!(cat->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT))) RETURN(-EINVAL); - + lir = (struct llog_logid_rec *)rec; logid = &lir->lid_id; rc = llog_create(ctxt, &handle, logid, NULL); @@ -392,7 +392,7 @@ static int llog_catinfo_cb(struct llog_handle *cat, rc = llog_init_handle(handle, 0, NULL); if (rc) GOTO(out_close, rc); - + for (index = 1; index < (LLOG_BITMAP_BYTES * 8); index++) { if (ext2_test_bit(index, handle->lgh_hdr->llh_bitmap)) count++; @@ -412,13 +412,13 @@ static int llog_catinfo_cb(struct llog_handle *cat, CWARN("Not enough memory\n"); rc = -ENOMEM; } - + out_close: llog_close(handle); RETURN(rc); } - -static int llog_catinfo_deletions(struct obd_device *obd, char *buf, + +static int llog_catinfo_deletions(struct obd_device *obd, char *buf, int buf_len) { struct mds_obd *mds = &obd->u.mds; @@ -430,24 +430,24 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf, int rc; struct cb_data data; struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT); - + if (ctxt == NULL || mds == NULL) RETURN(-EOPNOTSUPP); - + count = mds->mds_lov_desc.ld_tgt_count; size = sizeof(*idarray) * count; - + OBD_ALLOC(idarray, size); if (!idarray) RETURN(-ENOMEM); memset(idarray, 0, size); - + rc = llog_get_cat_list(obd, obd, name, count, idarray); - if (rc) + if (rc) GOTO(out_free, rc); push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL); - + id = idarray; data.ctxt = ctxt; data.out = buf; @@ -466,19 +466,19 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf, if (ext2_test_bit(index, handle->lgh_hdr->llh_bitmap)) uncanceled++; } - l = snprintf(data.out, data.remains, + l = snprintf(data.out, data.remains, "\n[Catlog ID]: #"LPX64"#"LPX64"#%08x " "[Log Count]: %d\n", id->lgl_oid, id->lgl_ogr, id->lgl_ogen, uncanceled); - + data.out += l; data.remains -= l; data.init = 1; - + llog_process(handle, llog_catinfo_cb, &data, NULL); llog_close(handle); - + if (data.remains <= 0) break; } @@ -488,7 +488,7 @@ out_free: OBD_FREE(idarray, size); RETURN(rc); } - + int llog_catinfo(struct ptlrpc_request *req) { struct obd_export *exp = req->rq_export; @@ -521,7 +521,7 @@ int llog_catinfo(struct ptlrpc_request *req) if (strlen(buf) == 0) sprintf(buf, "%s", "No log informations\n"); memcpy(reply, buf, buf_len); - + out_free: OBD_FREE(buf, buf_len); return rc; -- 1.8.3.1