- ENTRY;
- size = sizeof(*idarray) * count;
-
- OBD_ALLOC_LARGE(idarray, size);
- if (!idarray)
- RETURN(-ENOMEM);
-
- mutex_lock(&obd->obd_olg.olg_cat_processing);
- rc = llog_get_cat_list(obd, name, 0, count, idarray);
- if (rc)
- GOTO(out, rc);
-
- out = data->ioc_bulk;
- remains = data->ioc_inllen1;
- for (i = 0; i < count; i++) {
- id = &idarray[i].lci_logid;
- l = snprintf(out, remains,
- "catalog log: #"LPX64"#"LPX64"#%08x\n",
- id->lgl_oid, id->lgl_oseq, id->lgl_ogen);
- out += l;
- remains -= l;
- if (remains <= 0) {
- CWARN("not enough memory for catlog list\n");
- break;
- }
- }
-out:
- /* release semaphore */
- mutex_unlock(&obd->obd_olg.olg_cat_processing);
+ ENTRY;
+
+ if (count == 0) { /* get total number of logs */
+ rc = llog_osd_get_cat_list(env, d, 0, 0, NULL, fid);
+ if (rc < 0)
+ RETURN(rc);
+ count = rc;
+ }