- rc2 = llog_close(loghandle);
- if (!rc)
- rc = rc2;
-
-out_pop:
- pop_ctxt(&saved, &disk_obd->obd_ctxt, NULL);
- OBD_FREE(buf, LLOG_CHUNK_SIZE);
-
-out:
- RETURN(rc);
-}
-
-int llog_origin_handle_close(struct ptlrpc_request *req)
-{
- int rc;
-
- rc = 0;
-
- RETURN(rc);
-}
-
-int llog_origin_handle_cancel(struct ptlrpc_request *req)
-{
- struct obd_device *obd = req->rq_export->exp_obd;
- struct obd_device *disk_obd;
- struct llog_cookie *logcookies;
- struct llog_ctxt *ctxt;
- int num_cookies, rc = 0, err, i;
- struct obd_run_ctxt saved;
- struct llog_handle *cathandle;
- struct inode *inode;
- void *handle;
- ENTRY;
-
- logcookies = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*logcookies));
- num_cookies = req->rq_reqmsg->buflens[0]/sizeof(*logcookies);
- if (logcookies == NULL || num_cookies == 0) {
- DEBUG_REQ(D_HA, req, "no cookies sent");
- RETURN(-EFAULT);
- }
-
- ctxt = llog_get_context(obd, logcookies->lgc_subsys);
- if (ctxt == NULL) {
- CWARN("llog subsys not setup or already cleanup\n");
- RETURN(-ENOENT);
- }
-
- disk_obd = ctxt->loc_exp->exp_obd;
- push_ctxt(&saved, &disk_obd->obd_ctxt, NULL);
- for (i = 0; i < num_cookies; i++, logcookies++) {
- cathandle = ctxt->loc_handle;
- LASSERT(cathandle != NULL);
- inode = cathandle->lgh_file->f_dentry->d_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);
- if (err) {
- CERROR("error committing transaction: %d\n", err);
- if (!rc)
- rc = err;
- GOTO(pop_ctxt, rc);
- }
- }
-pop_ctxt:
- pop_ctxt(&saved, &disk_obd->obd_ctxt, NULL);
- if (rc)
- CERROR("cancel %d llog-records failed: %d\n", num_cookies, rc);
- else
- 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,
- char *client)
-{
- struct mds_obd *mds = &obd->u.mds;
- struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
- struct obd_run_ctxt saved;
- struct llog_handle *handle = NULL;
- 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]);
- if (rc)
- GOTO(out_pop, rc);
- rc = llog_init_handle(handle, 0, NULL);
- if (rc) {
- 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: %llu\n"
- "Last Index: %d\nUncanceled Records: %d\n\n",
- name[i],
- handle->lgh_file->f_dentry->d_inode->i_size,
- handle->lgh_last_idx, uncanceled);
- out += l;
- remains -= l;
-
- llog_close(handle);
- if (remains <= 0)
- break;
- }
-out_pop:
- pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL);
- RETURN(rc);