* usage: sscanf(fidstr, SFID, RFID(&fid)); */
#define SFID "0x%llx:0x%x:0x%x"
#define RFID(fid) (unsigned long long *)&((fid)->f_seq), &((fid)->f_oid), &((fid)->f_ver)
+#define PLOGID(logid) (unsigned long long)(logid)->lgl_oi.oi.oi_seq, (__u32)(logid)->lgl_oi.oi.oi_id, 0
/********* Quotas **********/
llog_update_record_size((struct llog_update_record *)rec)) {
CERROR("%s: broken update record! index %u "DFID".%u: rc = %d\n",
lod2obd(lrd->lrd_lod)->obd_name, index,
- PFID(&llh->lgh_id.lgl_oi.oi_fid), rec->lrh_index, -EIO);
+ PLOGID(&llh->lgh_id), rec->lrh_index, -EIO);
return -EINVAL;
}
CDEBUG(D_HA, "%s: process recovery updates "DFID".%u\n",
lod2obd(lrd->lrd_lod)->obd_name,
- PFID(&llh->lgh_id.lgl_oi.oi_fid), rec->lrh_index);
+ PLOGID(&llh->lgh_id), rec->lrh_index);
lut = lod2lu_dev(lrd->lrd_lod)->ld_site->ls_tgt;
if (lod_recovery_abort(lut->lut_obd))
ctxt->loc_handle = lgh;
- CDEBUG(D_INFO, "%s: init llog for index %d - catid "DFID":%x\n",
- obd->obd_name, index, PFID(&cid->lci_logid.lgl_oi.oi_fid),
- cid->lci_logid.lgl_ogen);
+ CDEBUG(D_INFO, "%s: init llog for index %d - catid "DFID"\n",
+ obd->obd_name, index, PLOGID(&cid->lci_logid));
out_close:
if (rc != 0)
llog_cat_close(env, lgh);
"seeing record at index %d/%d/%llu t=%x %.*s in log"
DFID"\n", hdr->lrh_index, rec->cr_hdr.lrh_index,
rec->cr.cr_index, rec->cr.cr_type, rec->cr.cr_namelen,
- changelog_rec_name(&rec->cr), PFID(&llh->lgh_id.lgl_oi.oi_fid));
+ changelog_rec_name(&rec->cr), PLOGID(&llh->lgh_id));
spin_lock(&mdd->mdd_cl.mc_lock);
mdd->mdd_cl.mc_index = rec->cr.cr_index;
spin_unlock(&mdd->mdd_cl.mc_lock);
rec->cur_hdr.lrh_type != CHANGELOG_USER_REC2) {
CWARN("%s: unknown user type %x at index %u in log "DFID"\n",
mdd2obd_dev(mdd)->obd_name, hdr->lrh_index,
- rec->cur_hdr.lrh_type, PFID(&llh->lgh_id.lgl_oi.oi_fid));
+ rec->cur_hdr.lrh_type, PLOGID(&llh->lgh_id));
return 0;
}
mdd2obd_dev(mdd)->obd_name, mdd_chlg_username(rec, user_name,
sizeof(user_name)),
hdr->lrh_index, rec->cur_hdr.lrh_index, rec->cur_endrec,
- PFID(&llh->lgh_id.lgl_oi.oi_fid));
+ PLOGID(&llh->lgh_id));
spin_lock(&mdd->mdd_cl.mc_user_lock);
mdd->mdd_cl.mc_lastuser = rec->cur_id;
if (rec->cr_hdr.lrh_type != CHANGELOG_REC) {
CWARN("%s: invalid record at index %d in log "DFID"\n",
mdd2obd_dev(mdd)->obd_name, hdr->lrh_index,
- PFID(&llh->lgh_id.lgl_oi.oi_fid));
+ PLOGID(&llh->lgh_id));
/* try to find some next valid record and thus allow to recover
* from a corrupted LLOG, instead to assert and force a crash
*/
mdd2obd_dev(mdd)->obd_name, hdr->lrh_index,
rec->cr_hdr.lrh_index, rec->cr.cr_index, rec->cr.cr_type,
rec->cr.cr_namelen, changelog_rec_name(&rec->cr),
- PFID(&llh->lgh_id.lgl_oi.oi_fid));
+ PLOGID(&llh->lgh_id));
clod->clod_index = rec->cr.cr_index;
rec->cur_hdr.lrh_type != CHANGELOG_USER_REC2) {
CWARN("%s: unknown user type %u at index %u in log "DFID"\n",
mdd2obd_dev(mdd)->obd_name, hdr->lrh_index,
- rec->cur_hdr.lrh_type, PFID(&llh->lgh_id.lgl_oi.oi_fid));
+ rec->cur_hdr.lrh_type, PLOGID(&llh->lgh_id));
/* try to find some next valid record and thus allow to recover
* from a corrupted LLOG, instead to assert and force a crash
*/
mdd2obd_dev(mdd)->obd_name, mdd_chlg_username(rec, user_name,
sizeof(user_name)),
hdr->lrh_index, rec->cur_hdr.lrh_index,
- rec->cur_endrec, PFID(&llh->lgh_id.lgl_oi.oi_fid));
+ rec->cur_endrec, PLOGID(&llh->lgh_id));
clod->clod_index = min_t(__u64, clod->clod_index, rec->cur_endrec);
rc = llog_destroy(env, llh);
if (!rc) {
CDEBUG(D_HA, "Changelog destroyed plain "DFID"\n",
- PFID(&llh->lgh_id.lgl_oi.oi_fid));
+ PLOGID(&llh->lgh_id));
RETURN(LLOG_DEL_PLAIN);
}
}
else
CERROR("%s: cancel idx %u of catalog "DFID": rc = %d\n",
ctxt->loc_obd->obd_name, cathandle->lgh_last_idx,
- PFID(&cathandle->lgh_id.lgl_oi.oi_fid), rc);
+ PLOGID(&cathandle->lgh_id), rc);
RETURN(rc);
}
llh = loghandle->lgh_hdr;
CDEBUG(D_RPCTRACE, "Canceling %d records, first %d in log "DFID"\n",
- num, index[0], PFID(&loghandle->lgh_id.lgl_oi.oi_fid));
+ num, index[0], PLOGID(&loghandle->lgh_id));
dt = lu2dt_dev(loghandle->lgh_obj->do_lu.lo_dev);
* the orphan will be handled by LFSCK. */
CERROR("%s: can't destroy empty llog "DFID": rc = %d\n",
loghandle2name(loghandle),
- PFID(&loghandle->lgh_id.lgl_oi.oi_fid), rc);
+ PLOGID(&loghandle->lgh_id), rc);
GOTO(out_unlock, rc = 0);
}
rc = LLOG_DEL_PLAIN;
CERROR("%s: invalid record in llog "DFID
" record for index %d/%d: rc = %d\n",
loghandle2name(loghandle),
- PFID(&loghandle->lgh_id.lgl_oi.oi_fid),
+ PLOGID(&loghandle->lgh_id),
rec->lrh_index, index, rc);
/*
* the block seem to be corrupted, let's try
* keep going */
CERROR("%s: "DFID" index %u, expected %u\n",
loghandle2name(loghandle),
- PFID(&loghandle->lgh_id.lgl_oi.oi_fid),
+ PLOGID(&loghandle->lgh_id),
rec->lrh_index, index);
index = rec->lrh_index;
}
}
out:
- CDEBUG(D_HA, "stop processing %s "DOSTID":%x index %d count %d\n",
+ CDEBUG(D_HA, "stop processing %s "DFID" index %d count %d\n",
((llh->llh_flags & LLOG_F_IS_CAT) ? "catalog" : "plain"),
- POSTID(&loghandle->lgh_id.lgl_oi), loghandle->lgh_id.lgl_ogen,
- index, llh->llh_count);
+ PLOGID(&loghandle->lgh_id), index, llh->llh_count);
if (cd != NULL)
cd->lpcd_last_idx = last_called_index;
* llog file, probably I/O error or the log got
* corrupted to be able to finally release the log we
* discard any remaining bits in the header */
- CERROR("%s: Local llog found corrupted #"DOSTID":%x"
- " %s index %d count %d\n",
+ CERROR("%s: local llog is corrupted "DFID" %s index %d count %d\n",
loghandle2name(loghandle),
- POSTID(&loghandle->lgh_id.lgl_oi),
- loghandle->lgh_id.lgl_ogen,
+ PLOGID(&loghandle->lgh_id),
((llh->llh_flags & LLOG_F_IS_CAT) ? "catalog" :
- "plain"), index, llh->llh_count);
+ "plain"), index, llh->llh_count);
while (index <= last_index) {
if (test_bit_le(index,
lpi->lpi_catdata = catdata;
CDEBUG(D_OTHER, "Processing "DFID" flags 0x%03x startcat %d startidx %d first_idx %d last_idx %d read_mode %d\n",
- PFID(&loghandle->lgh_id.lgl_oi.oi_fid), flags,
+ PLOGID(&loghandle->lgh_id), flags,
(flags & LLOG_F_IS_CAT) && d ? d->lpd_startcat : -1,
(flags & LLOG_F_IS_CAT) && d ? d->lpd_startidx : -1,
cd ? cd->lpcd_first_idx : -1, cd ? cd->lpcd_last_idx : -1,
rc = llh->lgh_obj->do_ops->do_attr_get(env, llh->lgh_obj, &la);
if (rc) {
CERROR("%s: attr_get failed for "DFID": rc = %d\n",
- loghandle2name(llh), PFID(&llh->lgh_id.lgl_oi.oi_fid),
- rc);
+ loghandle2name(llh), PLOGID(&llh->lgh_id), rc);
return 0;
}
if ((index == llh->llh_cat_idx + 1 && llh->llh_count > 1) ||
(index == 0 && llh->llh_cat_idx == 0)) {
if (cathandle->lgh_name == NULL) {
- CWARN("%s: there are no more free slots in catalog "
- DFID":%x\n",
+ CWARN("%s: there are no more free slots in catalog "DFID"\n",
loghandle2name(loghandle),
- PFID(&cathandle->lgh_id.lgl_oi.oi_fid),
- cathandle->lgh_id.lgl_ogen);
+ PLOGID(&cathandle->lgh_id));
} else {
- CWARN("%s: there are no more free slots in "
- "catalog %s\n", loghandle2name(loghandle),
- cathandle->lgh_name);
+ CWARN("%s: there are no more free slots in catalog %s\n",
+ loghandle2name(loghandle), cathandle->lgh_name);
}
RETURN(-ENOSPC);
}
GOTO(out_destroy, rc);
CDEBUG(D_OTHER, "new plain log "DFID".%u of catalog "DFID"\n",
- PFID(&loghandle->lgh_id.lgl_oi.oi_fid), rec->lid_hdr.lrh_index,
- PFID(&cathandle->lgh_id.lgl_oi.oi_fid));
+ PLOGID(&loghandle->lgh_id), rec->lid_hdr.lrh_index,
+ PLOGID(&cathandle->lgh_id));
loghandle->lgh_hdr->llh_cat_idx = rec->lid_hdr.lrh_index;
if (ostid_id(&cgl->lgl_oi) == ostid_id(&logid->lgl_oi) &&
ostid_seq(&cgl->lgl_oi) == ostid_seq(&logid->lgl_oi)) {
- if (cgl->lgl_ogen != logid->lgl_ogen) {
- CWARN("%s: log "DFID" generation %x != %x\n",
- loghandle2name(loghandle),
- PFID(&logid->lgl_oi.oi_fid),
- cgl->lgl_ogen, logid->lgl_ogen);
- continue;
- }
*res = llog_handle_get(loghandle);
if (!*res) {
CERROR("%s: log "DFID" refcount is zero!\n",
loghandle2name(loghandle),
- PFID(&logid->lgl_oi.oi_fid));
+ PLOGID(logid));
continue;
}
loghandle->u.phd.phd_cat_handle = cathandle;
rc = llog_open(env, cathandle->lgh_ctxt, &loghandle, logid, NULL,
LLOG_OPEN_EXISTS);
if (rc < 0) {
- CERROR("%s: error opening log id "DFID":%x: rc = %d\n",
- loghandle2name(cathandle), PFID(&logid->lgl_oi.oi_fid),
- logid->lgl_ogen, rc);
+ CERROR("%s: error opening log id "DFID": rc = %d\n",
+ loghandle2name(cathandle), PLOGID(logid), rc);
RETURN(rc);
}
ENTRY;
rc = llog_cat_id2handle(env, cathandle, &loghandle, lgl);
if (rc) {
- CDEBUG(D_HA, "%s: cannot find llog for handle "DFID":%x"
- ": rc = %d\n", loghandle2name(cathandle),
- PFID(&lgl->lgl_oi.oi_fid), lgl->lgl_ogen, rc);
+ CDEBUG(D_HA, "%s: can't find llog handle for "DFID": rc = %d\n",
+ loghandle2name(cathandle), PLOGID(lgl), rc);
RETURN(rc);
}
* for these non-exist llogs.
*/
rc = -ENOENT;
- CDEBUG(D_HA, "%s: llog "DFID":%x does not exist"
- ": rc = %d\n", loghandle2name(cathandle),
- PFID(&lgl->lgl_oi.oi_fid), lgl->lgl_ogen, rc);
-
+ CDEBUG(D_HA, "%s: llog "DFID" does not exist: rc = %d\n",
+ loghandle2name(cathandle), PLOGID(lgl), rc);
llog_handle_put(env, loghandle);
RETURN(rc);
}
ENTRY;
if (rec->lrh_type != le32_to_cpu(LLOG_LOGID_MAGIC)) {
rc = -EINVAL;
- CWARN("%s: invalid record in catalog "DFID":%x: rc = %d\n",
- loghandle2name(cat_llh),
- PFID(&cat_llh->lgh_id.lgl_oi.oi_fid),
- cat_llh->lgh_id.lgl_ogen, rc);
+ CWARN("%s: invalid record in catalog "DFID": rc = %d\n",
+ loghandle2name(cat_llh), PLOGID(&cat_llh->lgh_id), rc);
RETURN(rc);
}
- CDEBUG(D_HA, "processing log "DFID":%x at index %u of catalog "DFID"\n",
- PFID(&lir->lid_id.lgl_oi.oi_fid), lir->lid_id.lgl_ogen,
- le32_to_cpu(rec->lrh_index),
- PFID(&cat_llh->lgh_id.lgl_oi.oi_fid));
+ CDEBUG(D_HA, "processing log "DFID" at index %u of catalog "DFID"\n",
+ PLOGID(&lir->lid_id), le32_to_cpu(rec->lrh_index),
+ PLOGID(&cat_llh->lgh_id));
rc = llog_cat_id2handle(env, cat_llh, llhp, &lir->lid_id);
if (rc) {
if (rc == -ENOENT || rc == -ESTALE)
rc = LLOG_DEL_RECORD;
else if (rc)
- CWARN("%s: can't find llog handle "DFID":%x: rc = %d\n",
- loghandle2name(cat_llh),
- PFID(&lir->lid_id.lgl_oi.oi_fid),
- lir->lid_id.lgl_ogen, rc);
+ CWARN("%s: can't find llog handle "DFID": rc = %d\n",
+ loghandle2name(cat_llh), PLOGID(&lir->lid_id),
+ rc);
RETURN(rc);
}
rc = llog_destroy(env, *llhp);
if (rc)
CWARN("%s: can't destroy empty log "DFID": rc = %d\n",
- loghandle2name((*llhp)),
- PFID(&lir->lid_id.lgl_oi.oi_fid), rc);
+ loghandle2name((*llhp)), PLOGID(&lir->lid_id),
+ rc);
rc = LLOG_DEL_PLAIN;
}
* it if the caller is fine with that.
*/
CERROR("%s: remove corrupted/missing llog "DFID"\n",
- loghandle2name(cat_llh),
- PFID(&llh->lgh_id.lgl_oi.oi_fid));
+ loghandle2name(cat_llh), PLOGID(&llh->lgh_id));
rc = LLOG_DEL_PLAIN;
}
};
CWARN("%s: catlog "DFID" crosses index zero\n",
- loghandle2name(cat_llh),
- PFID(&cat_llh->lgh_id.lgl_oi.oi_fid));
+ loghandle2name(cat_llh), PLOGID(&cat_llh->lgh_id));
/*startcat = 0 is default value for general processing */
if ((startcat != LLOG_CAT_FIRST &&
startcat >= llh->llh_cat_idx) || !startcat) {
*cum_size += size;
CDEBUG(D_INFO, "Add llog entry "DFID" size=%llu, tot=%llu\n",
- PFID(&llh->lgh_id.lgl_oi.oi_fid), size, *cum_size);
+ PLOGID(&llh->lgh_id), size, *cum_size);
}
if (llh != NULL)
llh->llh_count > 1) {
CWARN("%s: catalog "DFID" crosses index zero\n",
loghandle2name(cat_llh),
- PFID(&cat_llh->lgh_id.lgl_oi.oi_fid));
+ PLOGID(&cat_llh->lgh_id));
cd.lpcd_first_idx = 0;
cd.lpcd_last_idx = cat_llh->lgh_last_idx;
}
CDEBUG(D_HA, "catlog "DFID" first idx %u, last_idx %u\n",
- PFID(&cathandle->lgh_id.lgl_oi.oi_fid),
- llh->llh_cat_idx, cathandle->lgh_last_idx);
+ PLOGID(&cathandle->lgh_id), llh->llh_cat_idx,
+ cathandle->lgh_last_idx);
}
RETURN(0);
struct llog_handle *loghandle, int index)
{
int rc;
- struct lu_fid fid = {.f_seq = 0, .f_oid = 0, .f_ver = 0};
LASSERT(index);
if (loghandle != NULL) {
/* remove destroyed llog from catalog list and
* chd_current_log variable */
- fid = loghandle->lgh_id.lgl_oi.oi_fid;
down_write(&cathandle->lgh_lock);
if (cathandle->u.chd.chd_current_log == loghandle)
cathandle->u.chd.chd_current_log = NULL;
/* remove plain llog entry from catalog by index */
llog_cat_set_first_idx(cathandle, index);
rc = llog_cancel_rec(env, cathandle, index);
- if (rc == 0)
+ if (!rc && loghandle)
CDEBUG(D_HA,
"cancel plain log "DFID" at index %u of catalog "DFID"\n",
- PFID(&fid), index,
- PFID(&cathandle->lgh_id.lgl_oi.oi_fid));
+ PLOGID(&loghandle->lgh_id), index,
+ PLOGID(&cathandle->lgh_id));
return rc;
}
ENTRY;
start = str;
if (start[0] == '[') {
- struct lu_fid *fid = &logid->lgl_oi.oi_fid;
- struct lu_fid sfid;
+ struct lu_fid fid;
int num;
- fid_zero(fid);
- logid->lgl_ogen = 0;
- num = sscanf(start + 1, SFID, RFID(fid));
- CDEBUG(D_INFO, DFID":%x\n", PFID(fid), logid->lgl_ogen);
- logid_to_fid(logid, &sfid);
- RETURN(num == 3 && fid_is_sane(&sfid) ? 0 : -EINVAL);
+ fid_zero(&fid);
+ num = sscanf(start + 1, SFID, RFID(&fid));
+ CDEBUG(D_INFO, "get FID "DFID"\n", PFID(&fid));
+ fid_to_logid(&fid, logid);
+ RETURN(num == 3 && fid_is_sane(&fid) ? 0 : -EINVAL);
}
#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 1, 53, 0)
RETURN(-EOPNOTSUPP);
rc = llog_cat_id2handle(env, handle, &loghandle, &lir->lid_id);
if (rc) {
- CDEBUG(D_IOCTL, "cannot find log "DFID":%x\n",
- PFID(&lir->lid_id.lgl_oi.oi_fid),
- lir->lid_id.lgl_ogen);
+ CDEBUG(D_IOCTL, "cannot find log "DFID"\n",
+ PLOGID(&lir->lid_id));
RETURN(rc);
}
rc = llog_process(env, loghandle, llog_check_cb, NULL, NULL);
RETURN(-EINVAL);
}
- l = snprintf(out, remains,
- "[index]: %05d [logid]: "DFID":%x\n",
- cur_index, PFID(&lir->lid_id.lgl_oi.oi_fid),
- lir->lid_id.lgl_ogen);
+ l = snprintf(out, remains, "[index]: %05d [logid]: "DFID"\n",
+ cur_index, PLOGID(&lir->lid_id));
} else if (rec->lrh_type == OBD_CFG_REC) {
int rc;
rc = llog_cat_id2handle(env, cat, &log, logid);
if (rc) {
- CDEBUG(D_IOCTL, "cannot find log "DFID":%x\n",
- PFID(&logid->lgl_oi.oi_fid), logid->lgl_ogen);
+ CDEBUG(D_IOCTL, "cannot find log "DFID"\n", PLOGID(logid));
RETURN(-ENOENT);
}
rc = llog_destroy(env, log);
if (rc) {
- CDEBUG(D_IOCTL, "cannot destroy log "DFID":%x\n",
- PFID(&logid->lgl_oi.oi_fid), logid->lgl_ogen);
+ CDEBUG(D_IOCTL, "cannot destroy log "DFID"\n", PLOGID(logid));
GOTO(out, rc);
}
llog_cat_cleanup(env, cat, log, log->u.phd.phd_cookie.lgc_index);
char *out = data->ioc_bulk;
l = snprintf(out, remains,
- "logid: "DFID":%x\n"
+ "logid: "DFID"\n"
"flags: %x (%s)\n"
"records_count: %d\n"
"last_index: %d\n",
- PFID(&handle->lgh_id.lgl_oi.oi_fid),
- handle->lgh_id.lgl_ogen,
+ PLOGID(&handle->lgh_id),
handle->lgh_hdr->llh_flags,
handle->lgh_hdr->llh_flags &
LLOG_F_IS_CAT ? "cat" : "plain",
data->ioc_count = cfs_fail_val - 1;
for (i = data->ioc_count; i < count; i++) {
id = &idarray[i].lci_logid;
- l = snprintf(out, remains, "catalog_log: "DFID":%x\n",
- PFID(&id->lgl_oi.oi_fid), id->lgl_ogen);
+ l = snprintf(out, remains, "catalog_log: "DFID"\n",
+ PLOGID(id));
out += l;
remains -= l;
if (remains <= 0) {
lgi->lgi_off = reccookie->lgc_offset;
CDEBUG(D_OTHER, "modify record "DFID": idx:%u, "
"len:%u offset %llu\n",
- PFID(&loghandle->lgh_id.lgl_oi.oi_fid), idx,
+ PLOGID(&loghandle->lgh_id), idx,
rec->lrh_len, (long long)lgi->lgi_off);
} else {
/* This can be result of lgh_cur_idx is not set during
CDEBUG(D_OTHER, "llog is getting too large (%u > %u) at %u "
DFID"\n", (unsigned)lgi->lgi_off,
loghandle->lgh_max_size, (int)loghandle->lgh_last_idx,
- PFID(&loghandle->lgh_id.lgl_oi.oi_fid));
+ PLOGID(&loghandle->lgh_id));
/* this is to signal that this llog is full */
loghandle->lgh_last_idx = LLOG_HDR_BITMAP_SIZE(llh) - 1;
RETURN(-ENOSPC);
if (!force_mini_rec)
goto retry;
- CERROR("%s: invalid llog block at log id "DFID":%x "
- "offset %llu\n",
+ CERROR("%s: invalid llog block at log id "DFID" offset %llu\n",
o->do_lu.lo_dev->ld_obd->obd_name,
- PFID(&loghandle->lgh_id.lgl_oi.oi_fid),
- loghandle->lgh_id.lgl_ogen, *cur_offset);
+ PLOGID(&loghandle->lgh_id), *cur_offset);
GOTO(out, rc = -EINVAL);
}
lustre_swab_llog_rec(last_rec);
if (last_rec->lrh_index != tail->lrt_index) {
- CERROR("%s: invalid llog tail at log id "DFID":%x offset %llu last_rec idx %u tail idx %u lrt len %u read_size %d\n",
+ CERROR("%s: invalid llog tail at log id "DFID" offset %llu last_rec idx %u tail idx %u lrt len %u read_size %d\n",
o->do_lu.lo_dev->ld_obd->obd_name,
- PFID(&loghandle->lgh_id.lgl_oi.oi_fid),
- loghandle->lgh_id.lgl_ogen, *cur_offset,
+ PLOGID(&loghandle->lgh_id), *cur_offset,
last_rec->lrh_index, tail->lrt_index,
tail->lrt_len, rc);
GOTO(out, rc = -EINVAL);
/* this shouldn't happen */
if (tail->lrt_index == 0) {
- CERROR("%s: invalid llog tail at log id "DFID":%x "
- "offset %llu bytes %d\n",
+ CERROR("%s: invalid llog tail at log id "DFID"offset %llu bytes %d\n",
o->do_lu.lo_dev->ld_obd->obd_name,
- PFID(&loghandle->lgh_id.lgl_oi.oi_fid),
- loghandle->lgh_id.lgl_ogen, *cur_offset, rc);
+ PLOGID(&loghandle->lgh_id), *cur_offset, rc);
GOTO(out, rc = -EINVAL);
}
if (tail->lrt_index < next_idx) {
GOTO(out, rc);
if (rc < sizeof(*tail)) {
- CERROR("%s: invalid llog block at log id "DFID":%x "
- "offset %llu\n",
+ CERROR("%s: invalid llog block at log id "DFID" offset %llu\n",
o->do_lu.lo_dev->ld_obd->obd_name,
- PFID(&loghandle->lgh_id.lgl_oi.oi_fid),
- loghandle->lgh_id.lgl_ogen, cur_offset);
+ PLOGID(&loghandle->lgh_id), cur_offset);
GOTO(out, rc = -EINVAL);
}
/* this shouldn't happen */
if (tail->lrt_index == 0) {
- CERROR("%s: invalid llog tail at log id "DFID":%x "
- "offset %llu\n",
+ CERROR("%s: invalid llog tail at log id "DFID" offset %llu\n",
o->do_lu.lo_dev->ld_obd->obd_name,
- PFID(&loghandle->lgh_id.lgl_oi.oi_fid),
- loghandle->lgh_id.lgl_ogen, cur_offset);
+ PLOGID(&loghandle->lgh_id), cur_offset);
GOTO(out, rc = -EINVAL);
}
if (tail->lrt_index < prev_idx)
{
CDEBUG(D_OTHER, "llogd body: %p\n", d);
CDEBUG(D_OTHER, "\tlgd_logid.lgl_oi.oi_fid: "DFID"\n",
- PFID(&d->lgd_logid.lgl_oi.oi_fid));
+ PLOGID(&d->lgd_logid));
CDEBUG(D_OTHER, "\tlgd_logid.lgl_ogen: %#x\n", d->lgd_logid.lgl_ogen);
CDEBUG(D_OTHER, "\tlgd_ctxt_idx: %#x\n", d->lgd_ctxt_idx);
CDEBUG(D_OTHER, "\tlgd_llh_flags: %#x\n", d->lgd_llh_flags);
llog_ctxt_put(ctxt);
if (likely(rc >= 0)) {
- CDEBUG(D_OTHER, "%s: new record "DFID":%x.%u: rc = %d\n",
+ CDEBUG(D_OTHER, "%s: new record "DFID".%u: rc = %d\n",
d->opd_obd->obd_name,
- PFID(&osi->osi_cookie.lgc_lgl.lgl_oi.oi_fid),
- osi->osi_cookie.lgc_lgl.lgl_ogen,
+ PLOGID(&osi->osi_cookie.lgc_lgl),
osi->osi_cookie.lgc_index, rc);
atomic_inc(&d->opd_sync_changes);
}
obd->obd_name, i, rc);
else
CDEBUG(D_OTHER, "%s: massive records cancel id "DFID" num %d\n",
- obd->obd_name, PFID(&lgid.lgl_oi.oi_fid),
- i);
+ obd->obd_name, PLOGID(&lgid), i);
i = 0;
}
rc = 0;
}
- CDEBUG(D_INFO, "%s: Init llog for %d - catid "DFID":%x\n",
- obd->obd_name, d->opd_index,
- PFID(&osi->osi_cid.lci_logid.lgl_oi.oi_fid),
- osi->osi_cid.lci_logid.lgl_ogen);
+ CDEBUG(D_INFO, "%s: init llog for %d - catid "DFID"\n",
+ obd->obd_name, d->opd_index, PLOGID(&osi->osi_cid.lci_logid));
rc = llog_setup(env, obd, &obd->obd_olg, LLOG_MDS_OST_ORIG_CTXT,
d->opd_storage->dd_lu_dev.ld_obd,
list_for_each_entry(stc, &st->st_cookie_list, stc_list) {
CDEBUG(mask, " cookie "DFID".%u\n",
- PFID(&stc->stc_cookie.lgc_lgl.lgl_oi.oi_fid),
+ PLOGID(&stc->stc_cookie.lgc_lgl),
stc->stc_cookie.lgc_index);
}
}
CDEBUG(D_INFO, "%s: Add update log "DFID".%u: rc = %d\n",
dt->dd_lu_dev.ld_obd->obd_name,
- PFID(&stc->stc_cookie.lgc_lgl.lgl_oi.oi_fid),
+ PLOGID(&stc->stc_cookie.lgc_lgl),
stc->stc_cookie.lgc_index, rc);
if (rc > 0) {
CDEBUG(D_INFO, "%s: Add update log "DFID".%u: rc = %d\n",
dt->dd_lu_dev.ld_obd->obd_name,
- PFID(&stc->stc_cookie.lgc_lgl.lgl_oi.oi_fid),
+ PLOGID(&stc->stc_cookie.lgc_lgl),
stc->stc_cookie.lgc_index, rc);
if (rc > 0) {
cookie);
CDEBUG(D_HA, "%s: batchid %llu cancel update log "
DFID".%u: rc = %d\n", obd->obd_name,
- tmt->tmt_batchid,
- PFID(&cookie->lgc_lgl.lgl_oi.oi_fid),
+ tmt->tmt_batchid, PLOGID(&cookie->lgc_lgl),
cookie->lgc_index, rc);
}
logid_to_fid(&lid->lid_id, &fid_from_logid);
- if (is_ext)
+ /**
+ * Llogs with regular llog SEQ such as FID_SEQ_LLOG and
+ * FID_SEQ_LLOG_NAME are stored under O/ directory but
+ * update llogs are using normal FIDs and stored under
+ * 'update_log_dir' directory with FID format name
+ * Distinguish them by FID sequence
+ */
+ if (fid_from_logid.f_seq != FID_SEQ_LLOG &&
+ fid_from_logid.f_seq != FID_SEQ_LLOG_NAME)
+ snprintf(object_path, sizeof(object_path),
+ "update_log_dir/"DFID, PFID(&fid_from_logid));
+ else if (is_ext)
snprintf(object_path, sizeof(object_path),
"O/%ju/d%u/%u", (uintmax_t)fid_from_logid.f_seq,
fid_from_logid.f_oid % 32,
(OSD_OI_FID_NR - 1)),
PFID(&fid_from_logid));
- printf("id="DFID":%x path=%s\n",
- PFID(&lid->lid_id.lgl_oi.oi_fid), lid->lid_id.lgl_ogen,
+ printf("fid="DFID" path=%s\n", PFID(&fid_from_logid),
object_path);
}
/* the llog header not countable here.*/
recs_num = count - 1;
if (recs_num == 0)
- goto clear_file_buf;
+ return 0;
recs_buf = calloc(recs_num, sizeof(**recs_pr));
if (!recs_buf) {
__le32_to_cpu(llog_buf->llh_count)-1,
__le32_to_cpu(llog_buf->llh_cat_idx),
__le32_to_cpu(tail->lrt_index));
-
+ printf("Flags: %#x\n", __le32_to_cpu(llog_buf->llh_flags));
printf("Target uuid : %s\n",
(char *)(&llog_buf->llh_tgtuuid));