struct llog_rec_hdr *llh_hdr;
struct dt_object *o;
struct llog_thread_info *lgi;
+ enum llog_flag flags;
int rc;
ENTRY;
RETURN(LLOG_EEMPTY);
}
+ flags = handle->lgh_hdr->llh_flags;
+
lgi->lgi_off = 0;
lgi->lgi_buf.lb_buf = handle->lgh_hdr;
lgi->lgi_buf.lb_len = LLOG_CHUNK_SIZE;
RETURN(-EIO);
}
+ handle->lgh_hdr->llh_flags |= (flags & LLOG_F_EXT_MASK);
handle->lgh_last_idx = handle->lgh_hdr->llh_tail.lrt_index;
RETURN(0);
}
/**
+ * Remove optional fields that the client doesn't expect.
+ * This is typically in order to ensure compatibility with older clients.
+ * It is assumed that since we exclusively remove fields, the block will be
+ * big enough to handle the remapped records. It is also assumed that records
+ * of a block have the same format (i.e.: the same features enabled).
+ *
+ * \param[in,out] hdr Header of the block of records to remap.
+ * \param[in,out] last_hdr Last header, don't read past this point.
+ * \param[in] flags Flags describing the fields to keep.
+ */
+static void changelog_block_trim_ext(struct llog_rec_hdr *hdr,
+ struct llog_rec_hdr *last_hdr,
+ enum changelog_rec_flags flags)
+{
+ if (hdr->lrh_type != CHANGELOG_REC)
+ return;
+
+ do {
+ struct changelog_rec *rec = (struct changelog_rec *)(hdr + 1);
+
+ changelog_remap_rec(rec, rec->cr_flags & flags);
+ hdr = llog_rec_hdr_next(hdr);
+ } while ((char *)hdr <= (char *)last_hdr);
+}
+
+/**
* Implementation of the llog_operations::lop_next_block
*
* This function finds the the next llog block to return which contains
rec->lrh_index, next_idx);
GOTO(out, rc = -ENOENT);
}
+
+ /* Trim unsupported extensions for compat w/ older clients */
+ if (!(loghandle->lgh_hdr->llh_flags & LLOG_F_EXT_JOBID))
+ changelog_block_trim_ext(rec, last_rec,
+ CLF_VERSION | CLF_RENAME);
+
GOTO(out, rc = 0);
}
GOTO(out, rc = -EIO);
rec->lrh_index, prev_idx);
GOTO(out, rc = -ENOENT);
}
+
+ /* Trim unsupported extensions for compat w/ older clients */
+ if (!(loghandle->lgh_hdr->llh_flags & LLOG_F_EXT_JOBID))
+ changelog_block_trim_ext(rec, last_rec,
+ CLF_VERSION | CLF_RENAME);
+
GOTO(out, rc = 0);
}
GOTO(out, rc = -EIO);