struct obd_uuid *uuid_buf);
extern int llapi_ping(char *obd_type, char *obd_name);
extern int llapi_target_check(int num_types, char **obd_types, char *dir);
-extern int llapi_catinfo(char *dir, char *keyword, char *node_name);
extern int llapi_file_get_lov_uuid(const char *path, struct obd_uuid *lov_uuid);
extern int llapi_file_fget_lov_uuid(int fd, struct obd_uuid *lov_uuid);
extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count);
LLOG_ORIGIN_HANDLE_WRITE_REC = 504,
LLOG_ORIGIN_HANDLE_CLOSE = 505,
LLOG_ORIGIN_CONNECT = 506,
- LLOG_CATINFO = 507, /* for lfs catinfo */
+ LLOG_CATINFO = 507, /* deprecated */
LLOG_ORIGIN_HANDLE_PREV_BLOCK = 508,
LLOG_ORIGIN_HANDLE_DESTROY = 509, /* for destroy llog object*/
LLOG_LAST_OPC,
#define OBD_IOC_LLOG_CANCEL _IOWR('f', 193, OBD_IOC_DATA_TYPE)
#define OBD_IOC_LLOG_REMOVE _IOWR('f', 194, OBD_IOC_DATA_TYPE)
#define OBD_IOC_LLOG_CHECK _IOWR('f', 195, OBD_IOC_DATA_TYPE)
+/* OBD_IOC_LLOG_CATINFO is deprecated */
#define OBD_IOC_LLOG_CATINFO _IOWR('f', 196, OBD_IOC_DATA_TYPE)
#define ECHO_IOC_GET_STRIPE _IOWR('f', 200, OBD_IOC_DATA_TYPE)
int llog_origin_handle_read_header(struct ptlrpc_request *req);
int llog_origin_handle_close(struct ptlrpc_request *req);
int llog_origin_handle_cancel(struct ptlrpc_request *req);
-int llog_catinfo(struct ptlrpc_request *req);
/* ptlrpc/llog_client.c */
extern struct llog_operations llog_client_ops;
extern struct req_format RQF_LDLM_GL_CALLBACK;
/* LOG req_format */
extern struct req_format RQF_LOG_CANCEL;
-extern struct req_format RQF_LLOG_CATINFO;
extern struct req_format RQF_LLOG_ORIGIN_HANDLE_CREATE;
extern struct req_format RQF_LLOG_ORIGIN_HANDLE_DESTROY;
extern struct req_format RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK;
return rc;
}
case OBD_IOC_LLOG_CATINFO: {
- struct ptlrpc_request *req = NULL;
- char *buf = NULL;
- char *str;
- int len = 0;
-
- rc = obd_ioctl_getdata(&buf, &len, (void *)arg);
- if (rc)
- RETURN(rc);
- data = (void *)buf;
-
- if (!data->ioc_inlbuf1) {
- obd_ioctl_freedata(buf, len);
- RETURN(-EINVAL);
- }
-
- req = ptlrpc_request_alloc(sbi2mdc(sbi)->cl_import,
- &RQF_LLOG_CATINFO);
- if (req == NULL)
- GOTO(out_catinfo, rc = -ENOMEM);
-
- req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
- data->ioc_inllen1);
- req_capsule_set_size(&req->rq_pill, &RMF_STRING, RCL_CLIENT,
- data->ioc_inllen2);
-
- rc = ptlrpc_request_pack(req, LUSTRE_LOG_VERSION, LLOG_CATINFO);
- if (rc) {
- ptlrpc_request_free(req);
- GOTO(out_catinfo, rc);
- }
-
- str = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
- memcpy(str, data->ioc_inlbuf1, data->ioc_inllen1);
- if (data->ioc_inllen2) {
- str = req_capsule_client_get(&req->rq_pill,
- &RMF_STRING);
- memcpy(str, data->ioc_inlbuf2, data->ioc_inllen2);
- }
-
- req_capsule_set_size(&req->rq_pill, &RMF_STRING, RCL_SERVER,
- data->ioc_plen1);
- ptlrpc_request_set_replen(req);
-
- rc = ptlrpc_queue_wait(req);
- if (!rc) {
- str = req_capsule_server_get(&req->rq_pill,
- &RMF_STRING);
- if (cfs_copy_to_user(data->ioc_pbuf1, str,
- data->ioc_plen1))
- rc = -EFAULT;
- }
- ptlrpc_req_finished(req);
- out_catinfo:
- obd_ioctl_freedata(buf, len);
- RETURN(rc);
+ RETURN(-EOPNOTSUPP);
}
case OBD_IOC_QUOTACHECK: {
struct obd_quotactl *oqctl;
rc = llog_origin_handle_close(req);
break;
case LLOG_CATINFO:
- DEBUG_REQ(D_MGS, req, "llog catinfo");
- req_capsule_set(&req->rq_pill, &RQF_LLOG_CATINFO);
- rc = llog_catinfo(req);
- break;
+ DEBUG_REQ(D_MGS, req, "llog catinfo");
+ rc = -EOPNOTSUPP;
+ break;
default:
req->rq_status = -ENOTSUPP;
rc = ptlrpc_error(req);
&RMF_CAPA2
};
-static const struct req_msg_field *llog_catinfo_client[] = {
- &RMF_PTLRPC_BODY,
- &RMF_NAME,
- &RMF_STRING
-};
-
-static const struct req_msg_field *llog_catinfo_server[] = {
- &RMF_PTLRPC_BODY,
- &RMF_STRING
-};
-
static const struct req_msg_field *llog_origin_handle_create_client[] = {
&RMF_PTLRPC_BODY,
&RMF_LLOGD_BODY,
&RQF_LDLM_INTENT_CREATE,
&RQF_LDLM_INTENT_UNLINK,
&RQF_LOG_CANCEL,
- &RQF_LLOG_CATINFO,
&RQF_LLOG_ORIGIN_HANDLE_CREATE,
&RQF_LLOG_ORIGIN_HANDLE_DESTROY,
&RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK,
mdt_body_only, mdt_body_only);
EXPORT_SYMBOL(RQF_MDS_IS_SUBDIR);
-struct req_format RQF_LLOG_CATINFO =
- DEFINE_REQ_FMT0("LLOG_CATINFO",
- llog_catinfo_client, llog_catinfo_server);
-EXPORT_SYMBOL(RQF_LLOG_CATINFO);
-
struct req_format RQF_LLOG_ORIGIN_HANDLE_CREATE =
DEFINE_REQ_FMT0("LLOG_ORIGIN_HANDLE_CREATE",
llog_origin_handle_create_client, llogd_body_only);
}
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 lvfs_run_ctxt saved;
- struct llog_handle *handle = NULL;
- char name[4][64];
- int rc, i, l, remains = buf_len;
- char *out = buf;
- ENTRY;
-
- if (ctxt == NULL || mds == NULL)
- GOTO(release_ctxt, rc = -ENODEV);
-
- push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_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],
- i_size_read(handle->lgh_file->f_dentry->d_inode),
- handle->lgh_last_idx, uncanceled);
- out += l;
- remains -= l;
-
- llog_close(handle);
- if (remains <= 0)
- break;
- }
- GOTO(out_pop, rc);
-out_pop:
- pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
-release_ctxt:
- llog_ctxt_put(ctxt);
- return rc;
-}
-
-struct cb_data {
- struct llog_ctxt *ctxt;
- char *out;
- int remains;
- int init;
-};
-
-static int llog_catinfo_cb(struct llog_handle *cat,
- struct llog_rec_hdr *rec, void *data)
-{
- static char *out = NULL;
- static int remains = 0;
- struct llog_ctxt *ctxt = NULL;
- struct llog_handle *handle = NULL;
- struct llog_logid *logid;
- struct llog_logid_rec *lir;
- int l, rc, index, count = 0;
- struct cb_data *cbd = (struct cb_data*)data;
- ENTRY;
-
- if (cbd->init) {
- out = cbd->out;
- remains = cbd->remains;
- cbd->init = 0;
- }
-
- if (!(cat->lgh_hdr->llh_flags & LLOG_F_IS_CAT))
- RETURN(-EINVAL);
-
- if (!cbd->ctxt)
- RETURN(-ENODEV);
-
- lir = (struct llog_logid_rec *)rec;
- logid = &lir->lid_id;
- rc = llog_create(ctxt, &handle, logid, NULL);
- if (rc)
- RETURN(-EINVAL);
- 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++;
- }
-
- l = snprintf(out, remains, "\t[Log ID]: #"LPX64"#"LPX64"#%08x\n"
- "\tLog Size: %llu\n\tLast Index: %d\n"
- "\tUncanceled Records: %d\n",
- logid->lgl_oid, logid->lgl_oseq, logid->lgl_ogen,
- i_size_read(handle->lgh_file->f_dentry->d_inode),
- handle->lgh_last_idx, count);
- out += l;
- remains -= l;
- cbd->out = out;
- cbd->remains = remains;
- if (remains <= 0) {
- CWARN("Not enough memory\n");
- rc = -ENOMEM;
- }
- EXIT;
-out_close:
- llog_close(handle);
- return rc;
-}
-
-static int llog_catinfo_deletions(struct obd_device *obd, char *buf,
- int buf_len)
-{
- struct mds_obd *mds = &obd->u.mds;
- struct llog_handle *handle;
- struct lvfs_run_ctxt saved;
- int size, i, count;
- struct llog_catid *idarray;
- char name[32] = CATLIST;
- struct cb_data data;
- struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
- int rc;
- ENTRY;
-
- if (ctxt == NULL || mds == NULL)
- GOTO(release_ctxt, rc = -ENODEV);
-
- count = mds->mds_lov_desc.ld_tgt_count;
- size = sizeof(*idarray) * count;
-
- OBD_ALLOC_LARGE(idarray, size);
- if (!idarray)
- GOTO(release_ctxt, rc = -ENOMEM);
-
- cfs_mutex_lock(&obd->obd_olg.olg_cat_processing);
- rc = llog_get_cat_list(obd, name, 0, count, idarray);
- if (rc)
- GOTO(out_free, rc);
-
- push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
-
- data.ctxt = ctxt;
- data.out = buf;
- data.remains = buf_len;
- for (i = 0; i < count; i++) {
- int l, index, uncanceled = 0;
-
- rc = llog_create(ctxt, &handle, &idarray[i].lci_logid, NULL);
- 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(data.out, data.remains,
- "\n[Catlog ID]: #"LPX64"#"LPX64"#%08x "
- "[Log Count]: %d\n",
- idarray[i].lci_logid.lgl_oid,
- idarray[i].lci_logid.lgl_oseq,
- idarray[i].lci_logid.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;
- }
- EXIT;
-out_pop:
- pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
-out_free:
- cfs_mutex_unlock(&obd->obd_olg.olg_cat_processing);
- OBD_FREE_LARGE(idarray, size);
-release_ctxt:
- llog_ctxt_put(ctxt);
- return rc;
-}
-
-int llog_catinfo(struct ptlrpc_request *req)
-{
- struct obd_export *exp = req->rq_export;
- struct obd_device *obd = exp->exp_obd;
- char *keyword;
- char *buf, *reply;
- int rc;
- ENTRY;
-
- OBD_ALLOC(buf, LLOG_CHUNK_SIZE);
- if (buf == NULL)
- RETURN(-ENOMEM);
-
- memset(buf, 0, LLOG_CHUNK_SIZE);
-
- keyword = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
- LASSERT(keyword);
-
- if (strcmp(keyword, "config") == 0) {
- char *client = req_capsule_client_get(&req->rq_pill,
- &RMF_STRING);
-
- LASSERT(client);
- rc = llog_catinfo_config(obd, buf, LLOG_CHUNK_SIZE, client);
- } else if (strcmp(keyword, "deletions") == 0) {
- rc = llog_catinfo_deletions(obd, buf, LLOG_CHUNK_SIZE);
- } else {
- rc = -EOPNOTSUPP;
- }
-
- req_capsule_set_size(&req->rq_pill, &RMF_STRING, RCL_SERVER,
- LLOG_CHUNK_SIZE);
- rc = req_capsule_server_pack(&req->rq_pill);
- if (rc)
- GOTO(out_free, rc = -ENOMEM);
-
- reply = req_capsule_server_get(&req->rq_pill, &RMF_STRING);
- if (strlen(buf) == 0)
- sprintf(buf, "%s", "No log informations\n");
- memcpy(reply, buf, LLOG_CHUNK_SIZE);
- EXIT;
-out_free:
- OBD_FREE(buf, LLOG_CHUNK_SIZE);
- return rc;
-}
-
#else /* !__KERNEL__ */
int llog_origin_handle_create(struct ptlrpc_request *req)
{
EXPORT_SYMBOL(llog_origin_handle_read_header);
EXPORT_SYMBOL(llog_origin_handle_close);
EXPORT_SYMBOL(llog_client_ops);
-EXPORT_SYMBOL(llog_catinfo);
MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
MODULE_DESCRIPTION("Lustre Request Processor and Lock Management");
static int lfs_df(int argc, char **argv);
static int lfs_getname(int argc, char **argv);
static int lfs_check(int argc, char **argv);
-static int lfs_catinfo(int argc, char **argv);
#ifdef HAVE_SYS_QUOTA_H
static int lfs_quotachown(int argc, char **argv);
static int lfs_quotacheck(int argc, char **argv);
"Display the status of MDS or OSTs (as specified in the command)\n"
"or all the servers (MDS and OSTs).\n"
"usage: check <osts|mds|servers>"},
- {"catinfo", lfs_catinfo, 0,
- "Show information of specified type logs.\n"
- "usage: catinfo {keyword} [node name]\n"
- "\tkeywords are one of followings: config, deletions.\n"
- "\tnode name must be provided when use keyword config."},
{"join", lfs_join, 0,
"join two lustre files into one.\n"
"obsolete, HEAD does not support it anymore.\n"},
}
-static int lfs_catinfo(int argc, char **argv)
-{
- char mntdir[PATH_MAX] = {'\0'};
- int rc;
-
- if (argc < 2 || (!strcmp(argv[1],"config") && argc < 3))
- return CMD_HELP;
-
- if (strcmp(argv[1], "config") && strcmp(argv[1], "deletions"))
- return CMD_HELP;
-
- rc = llapi_search_mounts(NULL, 0, mntdir, NULL);
- if (rc == 0 && mntdir[0] != '\0') {
- if (argc == 3)
- rc = llapi_catinfo(mntdir, argv[1], argv[2]);
- else
- rc = llapi_catinfo(mntdir, argv[1], NULL);
- } else {
- fprintf(stderr, "no lustre_lite mounted.\n");
- rc = -1;
- }
-
- return rc;
-}
-
static int lfs_join(int argc, char **argv)
{
fprintf(stderr, "join two lustre files into one.\n"
#undef MAX_STRING_SIZE
-int llapi_catinfo(char *dir, char *keyword, char *node_name)
-{
- char raw[OBD_MAX_IOCTL_BUFFER];
- char out[LLOG_CHUNK_SIZE];
- char *buf = raw;
- struct obd_ioctl_data data = { 0 };
- char key[30];
- DIR *root;
- int rc;
-
- sprintf(key, "%s", keyword);
- memset(raw, 0, sizeof(raw));
- memset(out, 0, sizeof(out));
- data.ioc_inlbuf1 = key;
- data.ioc_inllen1 = strlen(key) + 1;
- if (node_name) {
- data.ioc_inlbuf2 = node_name;
- data.ioc_inllen2 = strlen(node_name) + 1;
- }
- data.ioc_pbuf1 = out;
- data.ioc_plen1 = sizeof(out);
- rc = obd_ioctl_pack(&data, &buf, sizeof(raw));
- if (rc)
- return rc;
-
- root = opendir(dir);
- if (root == NULL) {
- rc = -errno;
- llapi_error(LLAPI_MSG_ERROR, rc, "open %s failed", dir);
- return rc;
- }
-
- rc = ioctl(dirfd(root), OBD_IOC_LLOG_CATINFO, buf);
- if (rc) {
- rc = -errno;
- llapi_error(LLAPI_MSG_ERROR, rc,
- "ioctl OBD_IOC_CATINFO failed");
- } else {
- llapi_printf(LLAPI_MSG_NORMAL, "%s", data.ioc_pbuf1);
- }
-
- closedir(root);
- return rc;
-}
-
/* Is this a lustre fs? */
int llapi_is_lustre_mnttype(const char *type)
{