Whamcloud - gitweb
LU-10337 mdt: Allow open of open orphans
[fs/lustre-release.git] / lustre / obdclass / llog_swab.c
index aab189d..4ba4cea 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2015, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 
 static void print_llogd_body(struct llogd_body *d)
 {
-        CDEBUG(D_OTHER, "llogd body: %p\n", d);
-        CDEBUG(D_OTHER, "\tlgd_logid.lgl_oi: "DOSTID"\n",
-              POSTID(&d->lgd_logid.lgl_oi));
-        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);
-        CDEBUG(D_OTHER, "\tlgd_index: %#x\n", d->lgd_index);
-        CDEBUG(D_OTHER, "\tlgd_saved_index: %#x\n", d->lgd_saved_index);
-        CDEBUG(D_OTHER, "\tlgd_len: %#x\n", d->lgd_len);
+       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));
+       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);
+       CDEBUG(D_OTHER, "\tlgd_index: %#x\n", d->lgd_index);
+       CDEBUG(D_OTHER, "\tlgd_saved_index: %#x\n", d->lgd_saved_index);
+       CDEBUG(D_OTHER, "\tlgd_len: %#x\n", d->lgd_len);
        CDEBUG(D_OTHER, "\tlgd_cur_offset: %#llx\n", d->lgd_cur_offset);
 }
 
@@ -214,6 +214,7 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec)
 
                 __swab32s(&cur->cur_id);
                 __swab64s(&cur->cur_endrec);
+               __swab32s(&cur->cur_time);
                tail = &cur->cur_tail;
                 break;
         }
@@ -246,7 +247,17 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec)
                __swab32s(&lsr->lsr_gid);
                __swab32s(&lsr->lsr_gid_h);
                __swab64s(&lsr->lsr_valid);
-               tail = &lsr->lsr_tail;
+
+               if (rec->lrh_len > sizeof(struct llog_setattr64_rec)) {
+                       struct llog_setattr64_rec_v2 *lsr2 =
+                               (struct llog_setattr64_rec_v2 *)rec;
+
+                       __swab32s(&lsr2->lsr_projid);
+                       __swab32s(&lsr2->lsr_layout_version);
+                       tail = &lsr2->lsr_tail;
+               } else {
+                       tail = &lsr->lsr_tail;
+               }
                break;
        }
        case OBD_CFG_REC:
@@ -344,13 +355,14 @@ void lustre_swab_llog_hdr (struct llog_log_hdr *h)
 }
 EXPORT_SYMBOL(lustre_swab_llog_hdr);
 
-static void print_lustre_cfg(struct lustre_cfg *lcfg)
+void print_lustre_cfg(struct lustre_cfg *lcfg)
 {
         int i;
         ENTRY;
 
         if (!(libcfs_debug & D_OTHER)) /* don't loop on nothing */
                 return;
+
         CDEBUG(D_OTHER, "lustre_cfg: %p\n", lcfg);
         CDEBUG(D_OTHER, "\tlcfg->lcfg_version: %#x\n", lcfg->lcfg_version);
 
@@ -359,13 +371,17 @@ static void print_lustre_cfg(struct lustre_cfg *lcfg)
         CDEBUG(D_OTHER, "\tlcfg->lcfg_flags: %#x\n", lcfg->lcfg_flags);
         CDEBUG(D_OTHER, "\tlcfg->lcfg_nid: %s\n", libcfs_nid2str(lcfg->lcfg_nid));
 
-        CDEBUG(D_OTHER, "\tlcfg->lcfg_bufcount: %d\n", lcfg->lcfg_bufcount);
-        if (lcfg->lcfg_bufcount < LUSTRE_CFG_MAX_BUFCOUNT)
-                for (i = 0; i < lcfg->lcfg_bufcount; i++)
-                        CDEBUG(D_OTHER, "\tlcfg->lcfg_buflens[%d]: %d\n",
-                               i, lcfg->lcfg_buflens[i]);
+       CDEBUG(D_OTHER, "\tlcfg->lcfg_bufcount: %d\n", lcfg->lcfg_bufcount);
+       if (lcfg->lcfg_bufcount < LUSTRE_CFG_MAX_BUFCOUNT)
+               for (i = 0; i < lcfg->lcfg_bufcount; i++) {
+                       CDEBUG(D_OTHER, "\tlcfg->lcfg_buflens[%d]: %d %s\n",
+                              i, lcfg->lcfg_buflens[i],
+                              lustre_cfg_string(lcfg, i));
+               }
+
         EXIT;
 }
+EXPORT_SYMBOL(print_lustre_cfg);
 
 void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg)
 {