Whamcloud - gitweb
LU-1996 lustre: Flexible changelog format.
[fs/lustre-release.git] / lustre / obdclass / llog.c
index 932b384..a4fbc25 100644 (file)
@@ -204,6 +204,7 @@ int llog_init_handle(const struct lu_env *env, struct llog_handle *handle,
                     int flags, struct obd_uuid *uuid)
 {
        struct llog_log_hdr     *llh;
+       enum llog_flag           fmt = flags & LLOG_F_EXT_MASK;
        int                      rc;
 
        ENTRY;
@@ -258,6 +259,7 @@ int llog_init_handle(const struct lu_env *env, struct llog_handle *handle,
                       flags, LLOG_F_IS_CAT, LLOG_F_IS_PLAIN);
                rc = -EINVAL;
        }
+       llh->llh_flags |= fmt;
 out:
        if (rc) {
                OBD_FREE_PTR(llh);
@@ -322,15 +324,15 @@ repeat:
                 if (rc)
                         GOTO(out, rc);
 
-                /* NB: when rec->lrh_len is accessed it is already swabbed
-                 * since it is used at the "end" of the loop and the rec
-                 * swabbing is done at the beginning of the loop. */
-                for (rec = (struct llog_rec_hdr *)buf;
-                     (char *)rec < buf + LLOG_CHUNK_SIZE;
-                     rec = (struct llog_rec_hdr *)((char *)rec + rec->lrh_len)){
+               /* NB: when rec->lrh_len is accessed it is already swabbed
+                * since it is used at the "end" of the loop and the rec
+                * swabbing is done at the beginning of the loop. */
+               for (rec = (struct llog_rec_hdr *)buf;
+                    (char *)rec < buf + LLOG_CHUNK_SIZE;
+                    rec = llog_rec_hdr_next(rec)) {
 
-                        CDEBUG(D_OTHER, "processing rec 0x%p type %#x\n",
-                               rec, rec->lrh_type);
+                       CDEBUG(D_OTHER, "processing rec 0x%p type %#x\n",
+                              rec, rec->lrh_type);
 
                         if (LLOG_REC_HDR_NEEDS_SWABBING(rec))
                                lustre_swab_llog_rec(rec);