Whamcloud - gitweb
LU-1302 llog: add env to llog_process functions
authorMikhail Pershin <tappro@whamcloud.com>
Wed, 15 Aug 2012 03:58:18 +0000 (07:58 +0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 4 Sep 2012 18:08:55 +0000 (14:08 -0400)
Add lu_env to llog processing function.
Remove using flags and mark fork is needed by parameter.

Signed-off-by: Mikhail Pershin <tappro@whamcloud.com>
Change-Id: Ie38b3da4090df35281e51ef196d91e3f96f95bdc
Reviewed-on: http://review.whamcloud.com/3644
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
24 files changed:
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_log.h
lustre/lov/lov_log.c
lustre/mdc/mdc_request.c
lustre/mdd/mdd_device.c
lustre/mdd/mdd_lproc.c
lustre/mds/mds_log.c
lustre/mgc/mgc_request.c
lustre/mgs/mgs_llog.c
lustre/obdclass/llog.c
lustre/obdclass/llog_cat.c
lustre/obdclass/llog_internal.h
lustre/obdclass/llog_ioctl.c
lustre/obdclass/llog_lvfs.c
lustre/obdclass/llog_obd.c
lustre/obdclass/llog_swab.c
lustre/obdclass/llog_test.c
lustre/obdclass/obd_config.c
lustre/obdfilter/filter_log.c
lustre/ptlrpc/sec_config.c
lustre/ptlrpc/wiretest.c
lustre/utils/llog_reader.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index f184b71..4d443e6 100644 (file)
@@ -2553,40 +2553,38 @@ struct llog_catid {
 #define LLOG_OP_MASK  0xfff00000
 
 typedef enum {
 #define LLOG_OP_MASK  0xfff00000
 
 typedef enum {
-        LLOG_PAD_MAGIC     = LLOG_OP_MAGIC | 0x00000,
-        OST_SZ_REC         = LLOG_OP_MAGIC | 0x00f00,
-        OST_RAID1_REC      = LLOG_OP_MAGIC | 0x01000,
-        MDS_UNLINK_REC     = LLOG_OP_MAGIC | 0x10000 | (MDS_REINT << 8) | REINT_UNLINK,
-        MDS_SETATTR_REC    = LLOG_OP_MAGIC | 0x10000 | (MDS_REINT << 8) | REINT_SETATTR,
-        MDS_SETATTR64_REC  = LLOG_OP_MAGIC | 0x90000 | (MDS_REINT << 8) | REINT_SETATTR,
-        OBD_CFG_REC        = LLOG_OP_MAGIC | 0x20000,
-        PTL_CFG_REC        = LLOG_OP_MAGIC | 0x30000, /* obsolete */
-        LLOG_GEN_REC       = LLOG_OP_MAGIC | 0x40000,
-        LLOG_JOIN_REC      = LLOG_OP_MAGIC | 0x50000, /* obsolete */
-        CHANGELOG_REC      = LLOG_OP_MAGIC | 0x60000,
-        CHANGELOG_USER_REC = LLOG_OP_MAGIC | 0x70000,
-        LLOG_HDR_MAGIC     = LLOG_OP_MAGIC | 0x45539,
-        LLOG_LOGID_MAGIC   = LLOG_OP_MAGIC | 0x4553b,
+       LLOG_PAD_MAGIC          = LLOG_OP_MAGIC | 0x00000,
+       OST_SZ_REC              = LLOG_OP_MAGIC | 0x00f00,
+       /* OST_RAID1_REC        = LLOG_OP_MAGIC | 0x01000, never used */
+       MDS_UNLINK_REC          = LLOG_OP_MAGIC | 0x10000 | (MDS_REINT << 8) |
+                                 REINT_UNLINK, /* obsolete after 2.5.0 */
+       MDS_UNLINK64_REC        = LLOG_OP_MAGIC | 0x90000 | (MDS_REINT << 8) |
+                                 REINT_UNLINK,
+       /* MDS_SETATTR_REC      = LLOG_OP_MAGIC | 0x12401, obsolete 1.8.0 */
+       MDS_SETATTR64_REC       = LLOG_OP_MAGIC | 0x90000 | (MDS_REINT << 8) |
+                                 REINT_SETATTR,
+       OBD_CFG_REC             = LLOG_OP_MAGIC | 0x20000,
+       /* PTL_CFG_REC          = LLOG_OP_MAGIC | 0x30000, obsolete 1.4.0 */
+       LLOG_GEN_REC            = LLOG_OP_MAGIC | 0x40000,
+       /* LLOG_JOIN_REC        = LLOG_OP_MAGIC | 0x50000, obsolete  1.8.0 */
+       CHANGELOG_REC           = LLOG_OP_MAGIC | 0x60000,
+       CHANGELOG_USER_REC      = LLOG_OP_MAGIC | 0x70000,
+       LLOG_HDR_MAGIC          = LLOG_OP_MAGIC | 0x45539,
+       LLOG_LOGID_MAGIC        = LLOG_OP_MAGIC | 0x4553b,
 } llog_op_type;
 
 } llog_op_type;
 
-/*
- * for now, continue to support old pad records which have 0 for their
- * type but still need to be swabbed for their length
- */
-#define LLOG_REC_HDR_NEEDS_SWABBING(r)                                  \
-        (((r)->lrh_type & __swab32(LLOG_OP_MASK)) ==                    \
-         __swab32(LLOG_OP_MAGIC) ||                                     \
-         (((r)->lrh_type == 0) && ((r)->lrh_len > LLOG_CHUNK_SIZE)))
+#define LLOG_REC_HDR_NEEDS_SWABBING(r) \
+       (((r)->lrh_type & __swab32(LLOG_OP_MASK)) == __swab32(LLOG_OP_MAGIC))
 
 /** Log record header - stored in little endian order.
  * Each record must start with this struct, end with a llog_rec_tail,
  * and be a multiple of 256 bits in size.
  */
 struct llog_rec_hdr {
 
 /** Log record header - stored in little endian order.
  * Each record must start with this struct, end with a llog_rec_tail,
  * and be a multiple of 256 bits in size.
  */
 struct llog_rec_hdr {
-        __u32                   lrh_len;
-        __u32                   lrh_index;
-        __u32                   lrh_type;
-        __u32                   lrh_padding;
+       __u32   lrh_len;
+       __u32   lrh_index;
+       __u32   lrh_type;
+       __u32   lrh_id;
 };
 
 struct llog_rec_tail {
 };
 
 struct llog_rec_tail {
@@ -2879,8 +2877,7 @@ extern void lustre_swab_lov_mds_md(struct lov_mds_md *lmm);
 extern void lustre_swab_llogd_body (struct llogd_body *d);
 extern void lustre_swab_llog_hdr (struct llog_log_hdr *h);
 extern void lustre_swab_llogd_conn_body (struct llogd_conn_body *d);
 extern void lustre_swab_llogd_body (struct llogd_body *d);
 extern void lustre_swab_llog_hdr (struct llog_log_hdr *h);
 extern void lustre_swab_llogd_conn_body (struct llogd_conn_body *d);
-extern void lustre_swab_llog_rec(struct llog_rec_hdr  *rec,
-                                 struct llog_rec_tail *tail);
+extern void lustre_swab_llog_rec(struct llog_rec_hdr  *rec);
 
 struct lustre_cfg;
 extern void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg);
 
 struct lustre_cfg;
 extern void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg);
index c3d2e67..c5055aa 100644 (file)
@@ -117,12 +117,11 @@ extern struct llog_handle *llog_alloc_handle(void);
 int llog_init_handle(struct llog_handle *handle, int flags,
                      struct obd_uuid *uuid);
 extern void llog_free_handle(struct llog_handle *handle);
 int llog_init_handle(struct llog_handle *handle, int flags,
                      struct obd_uuid *uuid);
 extern void llog_free_handle(struct llog_handle *handle);
-int llog_process(struct llog_handle *loghandle, llog_cb_t cb,
-                 void *data, void *catdata);
-int llog_process_flags(struct llog_handle *loghandle, llog_cb_t cb,
-                 void *data, void *catdata, int flags);
-int llog_reverse_process(struct llog_handle *loghandle, llog_cb_t cb,
-                         void *data, void *catdata);
+int llog_process(const struct lu_env *env, struct llog_handle *loghandle,
+                llog_cb_t cb, void *data, void *catdata);
+int llog_reverse_process(const struct lu_env *env,
+                        struct llog_handle *loghandle, llog_cb_t cb,
+                        void *data, void *catdata);
 extern int llog_cancel_rec(struct llog_handle *loghandle, int index);
 extern int llog_close(struct llog_handle *cathandle);
 extern int llog_get_size(struct llog_handle *loghandle);
 extern int llog_cancel_rec(struct llog_handle *loghandle, int index);
 extern int llog_close(struct llog_handle *cathandle);
 extern int llog_get_size(struct llog_handle *loghandle);
@@ -147,7 +146,6 @@ struct llog_process_data {
          */
         int                  lpd_startcat;
         int                  lpd_startidx;
          */
         int                  lpd_startcat;
         int                  lpd_startidx;
-        int                  lpd_flags;  /** llog_process flags */
 };
 
 struct llog_process_cat_data {
 };
 
 struct llog_process_cat_data {
@@ -181,12 +179,15 @@ int llog_cat_add_rec(struct llog_handle *cathandle, struct llog_rec_hdr *rec,
                      struct llog_cookie *reccookie, void *buf);
 int llog_cat_cancel_records(struct llog_handle *cathandle, int count,
                             struct llog_cookie *cookies);
                      struct llog_cookie *reccookie, void *buf);
 int llog_cat_cancel_records(struct llog_handle *cathandle, int count,
                             struct llog_cookie *cookies);
-int llog_cat_process(struct llog_handle *cat_llh, llog_cb_t cb, void *data,
-                     int startcat, int startidx);
-int llog_cat_process_flags(struct llog_handle *cat_llh, llog_cb_t cb, void *data,
-                     int flags, int startcat, int startidx);
+int __llog_cat_process(const struct lu_env *env, struct llog_handle *cat_llh,
+                      llog_cb_t cb, void *data, int startcat, int startidx,
+                      int fork);
+int llog_cat_process(const struct lu_env *env, struct llog_handle *cat_llh,
+                    llog_cb_t cb, void *data, int startcat, int startidx);
 int llog_cat_process_thread(void *data);
 int llog_cat_process_thread(void *data);
-int llog_cat_reverse_process(struct llog_handle *cat_llh, llog_cb_t cb, void *data);
+int llog_cat_reverse_process(const struct lu_env *env,
+                            struct llog_handle *cat_llh, llog_cb_t cb,
+                            void *data);
 int llog_cat_set_first_idx(struct llog_handle *cathandle, int index);
 
 /* llog_obd.c */
 int llog_cat_set_first_idx(struct llog_handle *cathandle, int index);
 
 /* llog_obd.c */
index 3f1dc8d..8359cd6 100644 (file)
@@ -90,12 +90,6 @@ static int lov_llog_origin_add(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
                         lur->lur_oseq = loi->loi_seq;
                         break;
                 }
                         lur->lur_oseq = loi->loi_seq;
                         break;
                 }
-                case MDS_SETATTR_REC: {
-                        struct llog_setattr_rec *lsr = (struct llog_setattr_rec *)rec;
-                        lsr->lsr_oid = loi->loi_id;
-                        lsr->lsr_oseq = loi->loi_seq;
-                        break;
-                }
                 case MDS_SETATTR64_REC: {
                         struct llog_setattr64_rec *lsr = (struct llog_setattr64_rec *)rec;
                         lsr->lsr_oid = loi->loi_id;
                 case MDS_SETATTR64_REC: {
                         struct llog_setattr64_rec *lsr = (struct llog_setattr64_rec *)rec;
                         lsr->lsr_oid = loi->loi_id;
index c869286..30ec407 100644 (file)
@@ -1300,7 +1300,7 @@ static int mdc_changelog_send_thread(void *csdata)
                 GOTO(out, rc);
         }
 
                 GOTO(out, rc);
         }
 
-        rc = llog_cat_process_flags(llh, changelog_show_cb, cs, 0, 0, 0);
+       rc = llog_cat_process(NULL, llh, changelog_show_cb, cs, 0, 0);
 
         /* Send EOF no matter what our result */
         if ((kuch = changelog_kuc_hdr(cs->cs_buf, sizeof(*kuch),
 
         /* Send EOF no matter what our result */
         if ((kuch = changelog_kuc_hdr(cs->cs_buf, sizeof(*kuch),
index 45ed842..6f1b14e 100644 (file)
@@ -191,7 +191,8 @@ static int mdd_changelog_llog_init(struct mdd_device *mdd)
                 return -EINVAL;
         }
 
                 return -EINVAL;
         }
 
-        rc = llog_cat_reverse_process(ctxt->loc_handle, changelog_init_cb, mdd);
+       rc = llog_cat_reverse_process(NULL, ctxt->loc_handle,
+                                     changelog_init_cb, mdd);
         llog_ctxt_put(ctxt);
 
         if (rc < 0) {
         llog_ctxt_put(ctxt);
 
         if (rc < 0) {
@@ -212,8 +213,8 @@ static int mdd_changelog_llog_init(struct mdd_device *mdd)
                 return -EINVAL;
         }
 
                 return -EINVAL;
         }
 
-        rc = llog_cat_reverse_process(ctxt->loc_handle, changelog_user_init_cb,
-                                      mdd);
+       rc = llog_cat_reverse_process(NULL, ctxt->loc_handle,
+                                     changelog_user_init_cb, mdd);
         llog_ctxt_put(ctxt);
 
         if (rc < 0) {
         llog_ctxt_put(ctxt);
 
         if (rc < 0) {
@@ -1545,8 +1546,9 @@ static int mdd_changelog_user_purge(const struct lu_env *env,
                 return -ENXIO;
         LASSERT(ctxt->loc_handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT);
 
                 return -ENXIO;
         LASSERT(ctxt->loc_handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT);
 
-        rc = llog_cat_process(ctxt->loc_handle, mdd_changelog_user_purge_cb,
-                              (void *)&data, 0, 0);
+       rc = llog_cat_process(env, ctxt->loc_handle,
+                             mdd_changelog_user_purge_cb, (void *)&data,
+                             0, 0);
         if ((rc >= 0) && (data.mcud_minrec > 0)) {
                 CDEBUG(D_IOCTL, "Purging changelog entries up to "LPD64
                        ", referenced by "CHANGELOG_USER_PREFIX"%d\n",
         if ((rc >= 0) && (data.mcud_minrec > 0)) {
                 CDEBUG(D_IOCTL, "Purging changelog entries up to "LPD64
                        ", referenced by "CHANGELOG_USER_PREFIX"%d\n",
index 7321d8e..48e2cd1 100644 (file)
@@ -246,8 +246,8 @@ static int lprocfs_rd_changelog_users(char *page, char **start, off_t off,
         cucb.idx += snprintf(cucb.page + cucb.idx, cucb.count - cucb.idx,
                               "%-5s %s\n", "ID", "index");
 
         cucb.idx += snprintf(cucb.page + cucb.idx, cucb.count - cucb.idx,
                               "%-5s %s\n", "ID", "index");
 
-        llog_cat_process(ctxt->loc_handle, lprocfs_changelog_users_cb,
-                         &cucb, 0, 0);
+       llog_cat_process(NULL, ctxt->loc_handle, lprocfs_changelog_users_cb,
+                        &cucb, 0, 0);
 
         llog_ctxt_put(ctxt);
         return cucb.idx;
 
         llog_ctxt_put(ctxt);
         return cucb.idx;
index 53cf411..9168fdd 100644 (file)
@@ -175,8 +175,8 @@ static int llog_changelog_cancel(struct llog_ctxt *ctxt,
         /* This should only be called with the catalog handle */
         LASSERT(cathandle->lgh_hdr->llh_flags & LLOG_F_IS_CAT);
 
         /* This should only be called with the catalog handle */
         LASSERT(cathandle->lgh_hdr->llh_flags & LLOG_F_IS_CAT);
 
-        rc = llog_cat_process(cathandle, llog_changelog_cancel_cb,
-                              (void *)cookies, 0, 0);
+       rc = llog_cat_process(NULL, cathandle, llog_changelog_cancel_cb,
+                             (void *)cookies, 0, 0);
         if (rc >= 0)
                 /* 0 or 1 means we're done */
                 rc = 0;
         if (rc >= 0)
                 /* 0 or 1 means we're done */
                 rc = 0;
index d489bc6..a24e48a 100644 (file)
@@ -1651,7 +1651,8 @@ static int mgc_copy_llog(struct obd_device *obd, struct llog_ctxt *rctxt,
                 GOTO(out_closer, rc);
 
         /* Copy remote log */
                 GOTO(out_closer, rc);
 
         /* Copy remote log */
-        rc = llog_process(remote_llh, mgc_copy_handler,(void *)local_llh, NULL);
+       rc = llog_process(NULL, remote_llh, mgc_copy_handler,
+                         (void *)local_llh, NULL);
 
 out_closer:
         rc2 = llog_close(remote_llh);
 
 out_closer:
         rc2 = llog_close(remote_llh);
index 00518d2..58d892e 100644 (file)
@@ -286,7 +286,8 @@ static int mgs_get_fsdb_from_llog(struct obd_device *obd, struct fs_db *fsdb)
         if (llog_get_size(loghandle) <= 1)
                 cfs_set_bit(FSDB_LOG_EMPTY, &fsdb->fsdb_flags);
 
         if (llog_get_size(loghandle) <= 1)
                 cfs_set_bit(FSDB_LOG_EMPTY, &fsdb->fsdb_flags);
 
-        rc = llog_process(loghandle, mgs_fsdb_handler, (void *) &d, NULL);
+       rc = llog_process(NULL, loghandle, mgs_fsdb_handler, (void *) &d,
+                         NULL);
         CDEBUG(D_INFO, "get_db = %d\n", rc);
 out_close:
         rc2 = llog_close(loghandle);
         CDEBUG(D_INFO, "get_db = %d\n", rc);
 out_close:
         rc2 = llog_close(loghandle);
@@ -703,7 +704,8 @@ static int mgs_modify(struct obd_device *obd, struct fs_db *fsdb,
         mml->mml_marker.cm_flags = flags;
         mml->mml_marker.cm_canceltime = flags ? cfs_time_current_sec() : 0;
         mml->mml_modified = 0;
         mml->mml_marker.cm_flags = flags;
         mml->mml_marker.cm_canceltime = flags ? cfs_time_current_sec() : 0;
         mml->mml_modified = 0;
-        rc = llog_process(loghandle, mgs_modify_handler, (void *)mml, NULL);
+       rc = llog_process(NULL, loghandle, mgs_modify_handler, (void *)mml,
+                         NULL);
         if (!rc && !mml->mml_modified)
                 rc = -ENODEV;
         OBD_FREE_PTR(mml);
         if (!rc && !mml->mml_modified)
                 rc = -ENODEV;
         OBD_FREE_PTR(mml);
@@ -1267,7 +1269,8 @@ static int mgs_steal_llog_for_mdt_from_client(struct obd_device *obd,
         if (rc)
                 GOTO(out_close, rc);
 
         if (rc)
                 GOTO(out_close, rc);
 
-        rc = llog_process(loghandle, mgs_steal_llog_handler, (void *)comp, NULL);
+       rc = llog_process(NULL, loghandle, mgs_steal_llog_handler,
+                         (void *)comp, NULL);
         CDEBUG(D_MGS, "steal llog re = %d\n", rc);
 out_close:
         rc2 = llog_close(loghandle);
         CDEBUG(D_MGS, "steal llog re = %d\n", rc);
 out_close:
         rc2 = llog_close(loghandle);
@@ -2394,7 +2397,8 @@ int mgs_get_fsdb_srpc_from_llog(struct obd_device *obd,
         msrd.msrd_fsdb = fsdb;
         msrd.msrd_skip = 0;
 
         msrd.msrd_fsdb = fsdb;
         msrd.msrd_skip = 0;
 
-        rc = llog_process(llh, mgs_srpc_read_handler, (void *) &msrd, NULL);
+       rc = llog_process(NULL, llh, mgs_srpc_read_handler, (void *) &msrd,
+                         NULL);
 
 out_close:
         llog_close(llh);
 
 out_close:
         llog_close(llh);
index 658dbee..fdd4a33 100644 (file)
@@ -233,30 +233,27 @@ EXPORT_SYMBOL(llog_close);
 
 static int llog_process_thread(void *arg)
 {
 
 static int llog_process_thread(void *arg)
 {
-        struct llog_process_info     *lpi = (struct llog_process_info *)arg;
-        struct llog_handle           *loghandle = lpi->lpi_loghandle;
-        struct llog_log_hdr          *llh = loghandle->lgh_hdr;
-        struct llog_process_cat_data *cd  = lpi->lpi_catdata;
-        char                         *buf;
-        __u64                         cur_offset = LLOG_CHUNK_SIZE;
-        __u64                         last_offset;
-        int                           rc = 0, index = 1, last_index;
-        int                           saved_index = 0, last_called_index = 0;
+       struct llog_process_info        *lpi = arg;
+       struct llog_handle              *loghandle = lpi->lpi_loghandle;
+       struct llog_log_hdr             *llh = loghandle->lgh_hdr;
+       struct llog_process_cat_data    *cd  = lpi->lpi_catdata;
+       char                            *buf;
+       __u64                            cur_offset = LLOG_CHUNK_SIZE;
+       __u64                            last_offset;
+       int                              rc = 0, index = 1, last_index;
+       int                              saved_index = 0;
+       int                              last_called_index = 0;
+
+       ENTRY;
 
         LASSERT(llh);
 
         OBD_ALLOC(buf, LLOG_CHUNK_SIZE);
         if (!buf) {
                 lpi->lpi_rc = -ENOMEM;
 
         LASSERT(llh);
 
         OBD_ALLOC(buf, LLOG_CHUNK_SIZE);
         if (!buf) {
                 lpi->lpi_rc = -ENOMEM;
-#ifdef __KERNEL__
-                cfs_complete(&lpi->lpi_completion);
-#endif
-                return 0;
+               RETURN(0);
         }
 
         }
 
-        if (!(lpi->lpi_flags & LLOG_FLAG_NODEAMON))
-                cfs_daemonize_ctxt("llog_process_thread");
-
         if (cd != NULL) {
                 last_called_index = cd->lpcd_first_idx;
                 index = cd->lpcd_first_idx + 1;
         if (cd != NULL) {
                 last_called_index = cd->lpcd_first_idx;
                 index = cd->lpcd_first_idx + 1;
@@ -277,7 +274,7 @@ static int llog_process_thread(void *arg)
                 LASSERT(index <= last_index + 1);
                 if (index == last_index + 1)
                         break;
                 LASSERT(index <= last_index + 1);
                 if (index == last_index + 1)
                         break;
-
+repeat:
                 CDEBUG(D_OTHER, "index: %d last_index %d\n",
                        index, last_index);
 
                 CDEBUG(D_OTHER, "index: %d last_index %d\n",
                        index, last_index);
 
@@ -300,15 +297,19 @@ static int llog_process_thread(void *arg)
                                rec, rec->lrh_type);
 
                         if (LLOG_REC_HDR_NEEDS_SWABBING(rec))
                                rec, rec->lrh_type);
 
                         if (LLOG_REC_HDR_NEEDS_SWABBING(rec))
-                                lustre_swab_llog_rec(rec, NULL);
+                               lustre_swab_llog_rec(rec);
 
                         CDEBUG(D_OTHER, "after swabbing, type=%#x idx=%d\n",
                                rec->lrh_type, rec->lrh_index);
 
 
                         CDEBUG(D_OTHER, "after swabbing, type=%#x idx=%d\n",
                                rec->lrh_type, rec->lrh_index);
 
-                        if (rec->lrh_index == 0)
-                                GOTO(out, 0); /* no more records */
-
-                        if (rec->lrh_len == 0 || rec->lrh_len >LLOG_CHUNK_SIZE){
+                       if (rec->lrh_index == 0) {
+                               /* probably another rec just got added? */
+                               if (index <= loghandle->lgh_last_idx)
+                                       GOTO(repeat, rc = 0);
+                               GOTO(out, rc = 0); /* no more records */
+                       }
+                       if (rec->lrh_len == 0 ||
+                           rec->lrh_len > LLOG_CHUNK_SIZE) {
                                 CWARN("invalid length %d in llog record for "
                                       "index %d/%d\n", rec->lrh_len,
                                       rec->lrh_index, index);
                                 CWARN("invalid length %d in llog record for "
                                       "index %d/%d\n", rec->lrh_len,
                                       rec->lrh_index, index);
@@ -355,23 +356,46 @@ static int llog_process_thread(void *arg)
                 }
         }
 
                 }
         }
 
- out:
+out:
         if (cd != NULL)
                 cd->lpcd_last_idx = last_called_index;
         if (cd != NULL)
                 cd->lpcd_last_idx = last_called_index;
-        if (buf)
-                OBD_FREE(buf, LLOG_CHUNK_SIZE);
+
+       OBD_FREE(buf, LLOG_CHUNK_SIZE);
         lpi->lpi_rc = rc;
         lpi->lpi_rc = rc;
-#ifdef __KERNEL__
-        cfs_complete(&lpi->lpi_completion);
-#endif
         return 0;
 }
 
         return 0;
 }
 
-int llog_process_flags(struct llog_handle *loghandle, llog_cb_t cb,
-                       void *data, void *catdata, int flags)
+#ifdef __KERNEL__
+static int llog_process_thread_daemonize(void *arg)
+{
+       struct llog_process_info        *lpi = arg;
+       struct lu_env                    env;
+       int                              rc;
+
+       cfs_daemonize_ctxt("llog_process_thread");
+
+       /* client env has no keys, tags is just 0 */
+       rc = lu_env_init(&env, LCT_LOCAL);
+       if (rc)
+               goto out;
+       lpi->lpi_env = &env;
+
+       rc = llog_process_thread(arg);
+
+       lu_env_fini(&env);
+out:
+       cfs_complete(&lpi->lpi_completion);
+       return rc;
+}
+#endif
+
+int llog_process_or_fork(const struct lu_env *env,
+                        struct llog_handle *loghandle,
+                        llog_cb_t cb, void *data, void *catdata, bool fork)
 {
         struct llog_process_info *lpi;
         int                      rc;
 {
         struct llog_process_info *lpi;
         int                      rc;
+
         ENTRY;
 
         OBD_ALLOC_PTR(lpi);
         ENTRY;
 
         OBD_ALLOC_PTR(lpi);
@@ -383,30 +407,39 @@ int llog_process_flags(struct llog_handle *loghandle, llog_cb_t cb,
         lpi->lpi_cb        = cb;
         lpi->lpi_cbdata    = data;
         lpi->lpi_catdata   = catdata;
         lpi->lpi_cb        = cb;
         lpi->lpi_cbdata    = data;
         lpi->lpi_catdata   = catdata;
-        lpi->lpi_flags     = flags;
 
 #ifdef __KERNEL__
 
 #ifdef __KERNEL__
-        cfs_init_completion(&lpi->lpi_completion);
-        rc = cfs_create_thread(llog_process_thread, lpi, CFS_DAEMON_FLAGS);
-        if (rc < 0) {
-                CERROR("cannot start thread: %d\n", rc);
-                OBD_FREE_PTR(lpi);
-                RETURN(rc);
-        }
-        cfs_wait_for_completion(&lpi->lpi_completion);
+       if (fork) {
+               /* The new thread can't use parent env,
+                * init the new one in llog_process_thread_daemonize. */
+               lpi->lpi_env = NULL;
+               cfs_init_completion(&lpi->lpi_completion);
+               rc = cfs_create_thread(llog_process_thread_daemonize, lpi,
+                                      CFS_DAEMON_FLAGS);
+               if (rc < 0) {
+                       CERROR("%s: cannot start thread: rc = %d\n",
+                              loghandle->lgh_ctxt->loc_obd->obd_name, rc);
+                       OBD_FREE_PTR(lpi);
+                       RETURN(rc);
+               }
+               cfs_wait_for_completion(&lpi->lpi_completion);
+       } else {
+               lpi->lpi_env = env;
+               llog_process_thread(lpi);
+       }
 #else
 #else
-        llog_process_thread(lpi);
+       lpi->lpi_env = env;
+       llog_process_thread(lpi);
 #endif
         rc = lpi->lpi_rc;
         OBD_FREE_PTR(lpi);
         RETURN(rc);
 }
 #endif
         rc = lpi->lpi_rc;
         OBD_FREE_PTR(lpi);
         RETURN(rc);
 }
-EXPORT_SYMBOL(llog_process_flags);
 
 
-int llog_process(struct llog_handle *loghandle, llog_cb_t cb,
-                 void *data, void *catdata)
+int llog_process(const struct lu_env *env, struct llog_handle *loghandle,
+                llog_cb_t cb, void *data, void *catdata)
 {
 {
-        return llog_process_flags(loghandle, cb, data, catdata, 0);
+       return llog_process_or_fork(env, loghandle, cb, data, catdata, false);
 }
 EXPORT_SYMBOL(llog_process);
 
 }
 EXPORT_SYMBOL(llog_process);
 
@@ -418,8 +451,9 @@ inline int llog_get_size(struct llog_handle *loghandle)
 }
 EXPORT_SYMBOL(llog_get_size);
 
 }
 EXPORT_SYMBOL(llog_get_size);
 
-int llog_reverse_process(struct llog_handle *loghandle, llog_cb_t cb,
-                         void *data, void *catdata)
+int llog_reverse_process(const struct lu_env *env,
+                        struct llog_handle *loghandle, llog_cb_t cb,
+                        void *data, void *catdata)
 {
         struct llog_log_hdr *llh = loghandle->lgh_hdr;
         struct llog_process_cat_data *cd = catdata;
 {
         struct llog_log_hdr *llh = loghandle->lgh_hdr;
         struct llog_process_cat_data *cd = catdata;
@@ -458,29 +492,35 @@ int llog_reverse_process(struct llog_handle *loghandle, llog_cb_t cb,
                         GOTO(out, rc);
 
                 rec = buf;
                         GOTO(out, rc);
 
                 rec = buf;
-                idx = le32_to_cpu(rec->lrh_index);
-                if (idx < index)
-                        CDEBUG(D_RPCTRACE, "index %u : idx %u\n", index, idx);
+               idx = rec->lrh_index;
+               CDEBUG(D_RPCTRACE, "index %u : idx %u\n", index, idx);
                 while (idx < index) {
                 while (idx < index) {
-                        rec = ((void *)rec + le32_to_cpu(rec->lrh_len));
+                       rec = (void *)rec + rec->lrh_len;
+                       if (LLOG_REC_HDR_NEEDS_SWABBING(rec))
+                               lustre_swab_llog_rec(rec);
                         idx ++;
                 }
                         idx ++;
                 }
-                tail = (void *)rec + le32_to_cpu(rec->lrh_len) - sizeof(*tail);
+               LASSERT(idx == index);
+               tail = (void *)rec + rec->lrh_len - sizeof(*tail);
 
                 /* process records in buffer, starting where we found one */
                 while ((void *)tail > buf) {
 
                 /* process records in buffer, starting where we found one */
                 while ((void *)tail > buf) {
-                        rec = (void *)tail - le32_to_cpu(tail->lrt_len) +
-                                sizeof(*tail);
-
-                        if (rec->lrh_index == 0)
-                                GOTO(out, 0); /* no more records */
+                       if (tail->lrt_index == 0)
+                               GOTO(out, rc = 0); /* no more records */
 
                         /* if set, process the callback on this record */
                         if (ext2_test_bit(index, llh->llh_bitmap)) {
 
                         /* if set, process the callback on this record */
                         if (ext2_test_bit(index, llh->llh_bitmap)) {
+                               rec = (void *)tail - tail->lrt_len +
+                                     sizeof(*tail);
+
                                 rc = cb(loghandle, rec, data);
                                 if (rc == LLOG_PROC_BREAK) {
                                         GOTO(out, rc);
                                 rc = cb(loghandle, rec, data);
                                 if (rc == LLOG_PROC_BREAK) {
                                         GOTO(out, rc);
-                                }
+                               } else if (rc == LLOG_DEL_RECORD) {
+                                       llog_cancel_rec(loghandle,
+                                                       tail->lrt_index);
+                                       rc = 0;
+                               }
                                 if (rc)
                                         GOTO(out, rc);
                         }
                                 if (rc)
                                         GOTO(out, rc);
                         }
@@ -489,7 +529,7 @@ int llog_reverse_process(struct llog_handle *loghandle, llog_cb_t cb,
                         --index;
                         if (index < first_index)
                                 GOTO(out, rc = 0);
                         --index;
                         if (index < first_index)
                                 GOTO(out, rc = 0);
-                        tail = (void *)rec - sizeof(*tail);
+                       tail = (void *)tail - tail->lrt_len;
                 }
         }
 
                 }
         }
 
index 54e911f..51d62e9 100644 (file)
@@ -50,7 +50,8 @@
 
 #include <obd_class.h>
 #include <lustre_log.h>
 
 #include <obd_class.h>
 #include <lustre_log.h>
-#include <libcfs/list.h>
+
+#include "llog_internal.h"
 
 /* Create a new log handle and add it to the open list.
  * This log handle will be closed when all of the records in it are removed.
 
 /* Create a new log handle and add it to the open list.
  * This log handle will be closed when all of the records in it are removed.
@@ -393,20 +394,20 @@ int llog_cat_process_cb(struct llog_handle *cat_llh, struct llog_rec_hdr *rec,
 
                 cd.lpcd_first_idx = d->lpd_startidx;
                 cd.lpcd_last_idx = 0;
 
                 cd.lpcd_first_idx = d->lpd_startidx;
                 cd.lpcd_last_idx = 0;
-                rc = llog_process_flags(llh, d->lpd_cb, d->lpd_data, &cd,
-                                        d->lpd_flags);
+               rc = llog_process(NULL, llh, d->lpd_cb, d->lpd_data, &cd);
                 /* Continue processing the next log from idx 0 */
                 d->lpd_startidx = 0;
         } else {
                 /* Continue processing the next log from idx 0 */
                 d->lpd_startidx = 0;
         } else {
-                rc = llog_process_flags(llh, d->lpd_cb, d->lpd_data, NULL,
-                                        d->lpd_flags);
+               rc = llog_process(NULL, llh, d->lpd_cb, d->lpd_data, NULL);
         }
 
         RETURN(rc);
 }
 
         }
 
         RETURN(rc);
 }
 
-int llog_cat_process_flags(struct llog_handle *cat_llh, llog_cb_t cb,
-                           void *data, int flags, int startcat, int startidx)
+int llog_cat_process_or_fork(const struct lu_env *env,
+                            struct llog_handle *cat_llh,
+                            llog_cb_t cb, void *data, int startcat,
+                            int startidx, bool fork)
 {
         struct llog_process_data d;
         struct llog_log_hdr *llh = cat_llh->lgh_hdr;
 {
         struct llog_process_data d;
         struct llog_log_hdr *llh = cat_llh->lgh_hdr;
@@ -418,7 +419,6 @@ int llog_cat_process_flags(struct llog_handle *cat_llh, llog_cb_t cb,
         d.lpd_cb = cb;
         d.lpd_startcat = startcat;
         d.lpd_startidx = startidx;
         d.lpd_cb = cb;
         d.lpd_startcat = startcat;
         d.lpd_startidx = startidx;
-        d.lpd_flags = flags;
 
         if (llh->llh_cat_idx > cat_llh->lgh_last_idx) {
                 struct llog_process_cat_data cd;
 
         if (llh->llh_cat_idx > cat_llh->lgh_last_idx) {
                 struct llog_process_cat_data cd;
@@ -428,28 +428,29 @@ int llog_cat_process_flags(struct llog_handle *cat_llh, llog_cb_t cb,
 
                 cd.lpcd_first_idx = llh->llh_cat_idx;
                 cd.lpcd_last_idx = 0;
 
                 cd.lpcd_first_idx = llh->llh_cat_idx;
                 cd.lpcd_last_idx = 0;
-                rc = llog_process_flags(cat_llh, llog_cat_process_cb, &d, &cd,
-                                        flags);
+               rc = llog_process_or_fork(env, cat_llh, llog_cat_process_cb,
+                                         &d, &cd, fork);
                 if (rc != 0)
                         RETURN(rc);
 
                 cd.lpcd_first_idx = 0;
                 cd.lpcd_last_idx = cat_llh->lgh_last_idx;
                 if (rc != 0)
                         RETURN(rc);
 
                 cd.lpcd_first_idx = 0;
                 cd.lpcd_last_idx = cat_llh->lgh_last_idx;
-                rc = llog_process_flags(cat_llh, llog_cat_process_cb, &d, &cd,
-                                        flags);
+               rc = llog_process_or_fork(env, cat_llh, llog_cat_process_cb,
+                                         &d, &cd, fork);
         } else {
         } else {
-                rc = llog_process_flags(cat_llh, llog_cat_process_cb, &d, NULL,
-                                        flags);
+               rc = llog_process_or_fork(env, cat_llh, llog_cat_process_cb,
+                                         &d, NULL, fork);
         }
 
         RETURN(rc);
 }
         }
 
         RETURN(rc);
 }
-EXPORT_SYMBOL(llog_cat_process_flags);
+EXPORT_SYMBOL(llog_cat_process_or_fork);
 
 
-int llog_cat_process(struct llog_handle *cat_llh, llog_cb_t cb, void *data,
-                     int startcat, int startidx)
+int llog_cat_process(const struct lu_env *env, struct llog_handle *cat_llh,
+                    llog_cb_t cb, void *data, int startcat, int startidx)
 {
 {
-        return llog_cat_process_flags(cat_llh, cb, data, 0, startcat, startidx);
+       return llog_cat_process_or_fork(env, cat_llh, cb, data, startcat,
+                                       startidx, 0);
 }
 EXPORT_SYMBOL(llog_cat_process);
 
 }
 EXPORT_SYMBOL(llog_cat_process);
 
@@ -460,17 +461,24 @@ int llog_cat_process_thread(void *data)
         struct llog_ctxt *ctxt = args->lpca_ctxt;
         struct llog_handle *llh = NULL;
         llog_cb_t cb = args->lpca_cb;
         struct llog_ctxt *ctxt = args->lpca_ctxt;
         struct llog_handle *llh = NULL;
         llog_cb_t cb = args->lpca_cb;
-        struct llog_logid logid;
+       struct llog_thread_info *lgi;
+       struct lu_env            env;
         int rc;
         ENTRY;
 
         cfs_daemonize_ctxt("ll_log_process");
 
         int rc;
         ENTRY;
 
         cfs_daemonize_ctxt("ll_log_process");
 
-        logid = *(struct llog_logid *)(args->lpca_arg);
-        rc = llog_create(ctxt, &llh, &logid, NULL);
+       rc = lu_env_init(&env, LCT_LOCAL);
+       if (rc)
+               GOTO(out, rc);
+       lgi = llog_info(&env);
+       LASSERT(lgi);
+
+       lgi->lgi_logid = *(struct llog_logid *)(args->lpca_arg);
+       rc = llog_create(ctxt, &llh, &lgi->lgi_logid, NULL);
         if (rc) {
                 CERROR("llog_create() failed %d\n", rc);
         if (rc) {
                 CERROR("llog_create() failed %d\n", rc);
-                GOTO(out, rc);
+               GOTO(out_env, rc);
         }
         rc = llog_init_handle(llh, LLOG_F_IS_CAT, NULL);
         if (rc) {
         }
         rc = llog_init_handle(llh, LLOG_F_IS_CAT, NULL);
         if (rc) {
@@ -479,7 +487,7 @@ int llog_cat_process_thread(void *data)
         }
 
         if (cb) {
         }
 
         if (cb) {
-                rc = llog_cat_process(llh, cb, NULL, 0, 0);
+               rc = llog_cat_process(&env, llh, cb, NULL, 0, 0);
                 if (rc != LLOG_PROC_BREAK && rc != 0)
                         CERROR("llog_cat_process() failed %d\n", rc);
                 cb(llh, NULL, NULL);
                 if (rc != LLOG_PROC_BREAK && rc != 0)
                         CERROR("llog_cat_process() failed %d\n", rc);
                 cb(llh, NULL, NULL);
@@ -496,6 +504,8 @@ release_llh:
         rc = llog_cat_put(llh);
         if (rc)
                 CERROR("llog_cat_put() failed %d\n", rc);
         rc = llog_cat_put(llh);
         if (rc)
                 CERROR("llog_cat_put() failed %d\n", rc);
+out_env:
+       lu_env_fini(&env);
 out:
         llog_ctxt_put(ctxt);
         OBD_FREE_PTR(args);
 out:
         llog_ctxt_put(ctxt);
         OBD_FREE_PTR(args);
@@ -527,12 +537,13 @@ static int llog_cat_reverse_process_cb(struct llog_handle *cat_llh,
                 RETURN(rc);
         }
 
                 RETURN(rc);
         }
 
-        rc = llog_reverse_process(llh, d->lpd_cb, d->lpd_data, NULL);
+       rc = llog_reverse_process(NULL, llh, d->lpd_cb, d->lpd_data, NULL);
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
-int llog_cat_reverse_process(struct llog_handle *cat_llh,
-                             llog_cb_t cb, void *data)
+int llog_cat_reverse_process(const struct lu_env *env,
+                            struct llog_handle *cat_llh,
+                            llog_cb_t cb, void *data)
 {
         struct llog_process_data d;
         struct llog_process_cat_data cd;
 {
         struct llog_process_data d;
         struct llog_process_cat_data cd;
@@ -550,18 +561,21 @@ int llog_cat_reverse_process(struct llog_handle *cat_llh,
 
                 cd.lpcd_first_idx = 0;
                 cd.lpcd_last_idx = cat_llh->lgh_last_idx;
 
                 cd.lpcd_first_idx = 0;
                 cd.lpcd_last_idx = cat_llh->lgh_last_idx;
-                rc = llog_reverse_process(cat_llh, llog_cat_reverse_process_cb,
-                                          &d, &cd);
+               rc = llog_reverse_process(env, cat_llh,
+                                         llog_cat_reverse_process_cb,
+                                         &d, &cd);
                 if (rc != 0)
                         RETURN(rc);
 
                 cd.lpcd_first_idx = le32_to_cpu(llh->llh_cat_idx);
                 cd.lpcd_last_idx = 0;
                 if (rc != 0)
                         RETURN(rc);
 
                 cd.lpcd_first_idx = le32_to_cpu(llh->llh_cat_idx);
                 cd.lpcd_last_idx = 0;
-                rc = llog_reverse_process(cat_llh, llog_cat_reverse_process_cb,
-                                          &d, &cd);
+               rc = llog_reverse_process(env, cat_llh,
+                                         llog_cat_reverse_process_cb,
+                                         &d, &cd);
         } else {
         } else {
-                rc = llog_reverse_process(cat_llh, llog_cat_reverse_process_cb,
-                                          &d, NULL);
+               rc = llog_reverse_process(env, cat_llh,
+                                         llog_cat_reverse_process_cb,
+                                         &d, NULL);
         }
 
         RETURN(rc);
         }
 
         RETURN(rc);
index 0fd1936..e2aec69 100644 (file)
@@ -83,4 +83,7 @@ int llog_cat_id2handle(struct llog_handle *cathandle, struct llog_handle **res,
                        struct llog_logid *logid);
 int class_config_dump_handler(struct llog_handle * handle,
                               struct llog_rec_hdr *rec, void *data);
                        struct llog_logid *logid);
 int class_config_dump_handler(struct llog_handle * handle,
                               struct llog_rec_hdr *rec, void *data);
+int llog_process_or_fork(const struct lu_env *env,
+                        struct llog_handle *loghandle,
+                        llog_cb_t cb, void *data, void *catdata, bool fork);
 #endif
 #endif
index a78c9da..8a03dae 100644 (file)
@@ -135,14 +135,12 @@ static int llog_check_cb(struct llog_handle *handle, struct llog_rec_hdr *rec,
                                lir->lid_id.lgl_ogen);
                         RETURN(rc);
                 }
                                lir->lid_id.lgl_ogen);
                         RETURN(rc);
                 }
-                rc = llog_process(log_handle, llog_check_cb, NULL, NULL);
+               rc = llog_process(NULL, log_handle, llog_check_cb, NULL, NULL);
                 llog_close(log_handle);
         } else {
                 switch (rec->lrh_type) {
                 case OST_SZ_REC:
                 llog_close(log_handle);
         } else {
                 switch (rec->lrh_type) {
                 case OST_SZ_REC:
-                case OST_RAID1_REC:
                 case MDS_UNLINK_REC:
                 case MDS_UNLINK_REC:
-                case MDS_SETATTR_REC:
                 case MDS_SETATTR64_REC:
                 case OBD_CFG_REC:
                 case LLOG_HDR_MAGIC: {
                 case MDS_SETATTR64_REC:
                 case OBD_CFG_REC:
                 case LLOG_HDR_MAGIC: {
@@ -334,7 +332,7 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
         }
         case OBD_IOC_LLOG_CHECK: {
                 LASSERT(data->ioc_inllen1);
         }
         case OBD_IOC_LLOG_CHECK: {
                 LASSERT(data->ioc_inllen1);
-                err = llog_process(handle, llog_check_cb, data, NULL);
+               err = llog_process(NULL, handle, llog_check_cb, data, NULL);
                 if (err == -LLOG_EEMPTY)
                         err = 0;
                 GOTO(out_close, err);
                 if (err == -LLOG_EEMPTY)
                         err = 0;
                 GOTO(out_close, err);
@@ -342,11 +340,13 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
 
         case OBD_IOC_LLOG_PRINT: {
                 LASSERT(data->ioc_inllen1);
 
         case OBD_IOC_LLOG_PRINT: {
                 LASSERT(data->ioc_inllen1);
-                err = llog_process(handle, class_config_dump_handler,data,NULL);
+               err = llog_process(NULL, handle, class_config_dump_handler,
+                                  data, NULL);
                 if (err == -LLOG_EEMPTY)
                         err = 0;
                 else
                 if (err == -LLOG_EEMPTY)
                         err = 0;
                 else
-                        err = llog_process(handle, llog_print_cb, data, NULL);
+                       err = llog_process(NULL, handle, llog_print_cb, data,
+                                          NULL);
 
                 GOTO(out_close, err);
         }
 
                 GOTO(out_close, err);
         }
@@ -398,8 +398,8 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
                                 GOTO(out_close, err);
                         err = llog_remove_log(handle, &plain);
                 } else {
                                 GOTO(out_close, err);
                         err = llog_remove_log(handle, &plain);
                 } else {
-                        /*remove all the log of the catalog*/
-                        llog_process(handle, llog_delete_cb, NULL, NULL);
+                       /* remove all the log of the catalog */
+                       llog_process(NULL, handle, llog_delete_cb, NULL, NULL);
                 }
                 GOTO(out_close, err);
         }
                 }
                 GOTO(out_close, err);
         }
index 817b76f..cba0de9 100644 (file)
@@ -361,13 +361,10 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle,
                 reccookie->lgc_lgl = loghandle->lgh_id;
                 reccookie->lgc_index = index;
                 if ((rec->lrh_type == MDS_UNLINK_REC) ||
                 reccookie->lgc_lgl = loghandle->lgh_id;
                 reccookie->lgc_index = index;
                 if ((rec->lrh_type == MDS_UNLINK_REC) ||
-                    (rec->lrh_type == MDS_SETATTR_REC) ||
                     (rec->lrh_type == MDS_SETATTR64_REC))
                         reccookie->lgc_subsys = LLOG_MDS_OST_ORIG_CTXT;
                 else if (rec->lrh_type == OST_SZ_REC)
                         reccookie->lgc_subsys = LLOG_SIZE_ORIG_CTXT;
                     (rec->lrh_type == MDS_SETATTR64_REC))
                         reccookie->lgc_subsys = LLOG_MDS_OST_ORIG_CTXT;
                 else if (rec->lrh_type == OST_SZ_REC)
                         reccookie->lgc_subsys = LLOG_SIZE_ORIG_CTXT;
-                else if (rec->lrh_type == OST_RAID1_REC)
-                        reccookie->lgc_subsys = LLOG_RD1_ORIG_CTXT;
                 else
                         reccookie->lgc_subsys = -1;
                 rc = 1;
                 else
                         reccookie->lgc_subsys = -1;
                 rc = 1;
@@ -454,9 +451,8 @@ static int llog_lvfs_next_block(struct llog_handle *loghandle, int *cur_idx,
                 tail = (struct llog_rec_tail *)((char *)buf + rc -
                                                 sizeof(struct llog_rec_tail));
 
                 tail = (struct llog_rec_tail *)((char *)buf + rc -
                                                 sizeof(struct llog_rec_tail));
 
-                if (LLOG_REC_HDR_NEEDS_SWABBING(rec)) {
-                        lustre_swab_llog_rec(rec, tail);
-                }
+               if (LLOG_REC_HDR_NEEDS_SWABBING(rec))
+                       lustre_swab_llog_rec(rec);
 
                 *cur_idx = tail->lrt_index;
 
 
                 *cur_idx = tail->lrt_index;
 
index aa9c3c0..e37b150 100644 (file)
@@ -382,7 +382,7 @@ int llog_obd_origin_setup(struct obd_device *obd, struct obd_llog_group *olg,
         if (rc)
                 GOTO(out, rc);
 
         if (rc)
                 GOTO(out, rc);
 
-        rc = llog_process(handle, (llog_cb_t)cat_cancel_cb, NULL, NULL);
+       rc = llog_process(NULL, handle, (llog_cb_t)cat_cancel_cb, NULL, NULL);
         if (rc)
                 CERROR("llog_process() with cat_cancel_cb failed: %d\n", rc);
         GOTO(out, rc);
         if (rc)
                 CERROR("llog_process() with cat_cancel_cb failed: %d\n", rc);
         GOTO(out, rc);
index e8a7296..3a49fdc 100644 (file)
@@ -114,45 +114,38 @@ void lustre_swab_lu_seq_range(struct lu_seq_range *range)
 }
 EXPORT_SYMBOL(lustre_swab_lu_seq_range);
 
 }
 EXPORT_SYMBOL(lustre_swab_lu_seq_range);
 
-void lustre_swab_llog_rec(struct llog_rec_hdr *rec, struct llog_rec_tail *tail)
+void lustre_swab_llog_rec(struct llog_rec_hdr *rec)
 {
 {
+       struct llog_rec_tail *tail = NULL;
+
         __swab32s(&rec->lrh_len);
         __swab32s(&rec->lrh_index);
         __swab32s(&rec->lrh_type);
         __swab32s(&rec->lrh_len);
         __swab32s(&rec->lrh_index);
         __swab32s(&rec->lrh_type);
+       __swab32s(&rec->lrh_id);
 
         switch (rec->lrh_type) {
 
         switch (rec->lrh_type) {
-        case OST_SZ_REC: {
+       case OST_SZ_REC:
+       {
                 struct llog_size_change_rec *lsc =
                         (struct llog_size_change_rec *)rec;
 
                 lustre_swab_ll_fid(&lsc->lsc_fid);
                 __swab32s(&lsc->lsc_ioepoch);
                 struct llog_size_change_rec *lsc =
                         (struct llog_size_change_rec *)rec;
 
                 lustre_swab_ll_fid(&lsc->lsc_fid);
                 __swab32s(&lsc->lsc_ioepoch);
+               tail = &lsc->lsc_tail;
                 break;
         }
                 break;
         }
-
-        case OST_RAID1_REC:
-                break;
-
-        case MDS_UNLINK_REC: {
+       case MDS_UNLINK_REC:
+       {
                 struct llog_unlink_rec *lur = (struct llog_unlink_rec *)rec;
 
                 __swab64s(&lur->lur_oid);
                 __swab32s(&lur->lur_oseq);
                 __swab32s(&lur->lur_count);
                 struct llog_unlink_rec *lur = (struct llog_unlink_rec *)rec;
 
                 __swab64s(&lur->lur_oid);
                 __swab32s(&lur->lur_oseq);
                 __swab32s(&lur->lur_count);
+               tail = &lur->lur_tail;
                 break;
         }
                 break;
         }
-
-        case MDS_SETATTR_REC: {
-                struct llog_setattr_rec *lsr = (struct llog_setattr_rec *)rec;
-
-                __swab64s(&lsr->lsr_oid);
-                __swab32s(&lsr->lsr_oseq);
-                __swab32s(&lsr->lsr_uid);
-                __swab32s(&lsr->lsr_gid);
-                break;
-        }
-
-        case CHANGELOG_REC: {
+       case CHANGELOG_REC:
+       {
                 struct llog_changelog_rec *cr = (struct llog_changelog_rec*)rec;
 
                 __swab16s(&cr->cr.cr_namelen);
                 struct llog_changelog_rec *cr = (struct llog_changelog_rec*)rec;
 
                 __swab16s(&cr->cr.cr_namelen);
@@ -169,35 +162,42 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec, struct llog_rec_tail *tail)
 
                        lustre_swab_lu_fid(&ext->cr.cr_sfid);
                        lustre_swab_lu_fid(&ext->cr.cr_spfid);
 
                        lustre_swab_lu_fid(&ext->cr.cr_sfid);
                        lustre_swab_lu_fid(&ext->cr.cr_spfid);
+                       tail = &ext->cr_tail;
+               } else {
+                       tail = &cr->cr_tail;
                }
                 break;
         }
                }
                 break;
         }
-
-        case CHANGELOG_USER_REC: {
+       case CHANGELOG_USER_REC:
+       {
                 struct llog_changelog_user_rec *cur =
                         (struct llog_changelog_user_rec*)rec;
 
                 __swab32s(&cur->cur_id);
                 __swab64s(&cur->cur_endrec);
                 struct llog_changelog_user_rec *cur =
                         (struct llog_changelog_user_rec*)rec;
 
                 __swab32s(&cur->cur_id);
                 __swab64s(&cur->cur_endrec);
+               tail = &cur->cur_tail;
                 break;
         }
 
                 break;
         }
 
-        case MDS_SETATTR64_REC: {
-                struct llog_setattr64_rec *lsr = (struct llog_setattr64_rec *)rec;
+       case MDS_SETATTR64_REC:
+       {
+               struct llog_setattr64_rec *lsr =
+                       (struct llog_setattr64_rec *)rec;
 
                 __swab64s(&lsr->lsr_oid);
                 __swab32s(&lsr->lsr_oseq);
                 __swab32s(&lsr->lsr_uid);
 
                 __swab64s(&lsr->lsr_oid);
                 __swab32s(&lsr->lsr_oseq);
                 __swab32s(&lsr->lsr_uid);
+               __swab32s(&lsr->lsr_uid_h);
                 __swab32s(&lsr->lsr_gid);
                 __swab32s(&lsr->lsr_gid);
-
+               __swab32s(&lsr->lsr_gid_h);
+               tail = &lsr->lsr_tail;
                 break;
         }
                 break;
         }
-
         case OBD_CFG_REC:
                 /* these are swabbed as they are consumed */
                 break;
         case OBD_CFG_REC:
                 /* these are swabbed as they are consumed */
                 break;
-
-        case LLOG_HDR_MAGIC: {
+       case LLOG_HDR_MAGIC:
+       {
                 struct llog_log_hdr *llh = (struct llog_log_hdr *)rec;
 
                 __swab64s(&llh->llh_timestamp);
                 struct llog_log_hdr *llh = (struct llog_log_hdr *)rec;
 
                 __swab64s(&llh->llh_timestamp);
@@ -206,24 +206,30 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec, struct llog_rec_tail *tail)
                 __swab32s(&llh->llh_flags);
                 __swab32s(&llh->llh_size);
                 __swab32s(&llh->llh_cat_idx);
                 __swab32s(&llh->llh_flags);
                 __swab32s(&llh->llh_size);
                 __swab32s(&llh->llh_cat_idx);
-                if (tail != &llh->llh_tail) {
-                        __swab32s(&llh->llh_tail.lrt_index);
-                        __swab32s(&llh->llh_tail.lrt_len);
-                }
+               tail = &llh->llh_tail;
                 break;
         }
                 break;
         }
-
-        case LLOG_LOGID_MAGIC: {
+       case LLOG_LOGID_MAGIC:
+       {
                 struct llog_logid_rec *lid = (struct llog_logid_rec *)rec;
 
                 __swab64s(&lid->lid_id.lgl_oid);
                 __swab64s(&lid->lid_id.lgl_oseq);
                 __swab32s(&lid->lid_id.lgl_ogen);
                 struct llog_logid_rec *lid = (struct llog_logid_rec *)rec;
 
                 __swab64s(&lid->lid_id.lgl_oid);
                 __swab64s(&lid->lid_id.lgl_oseq);
                 __swab32s(&lid->lid_id.lgl_ogen);
+               tail = &lid->lid_tail;
                 break;
         }
                 break;
         }
+       case LLOG_GEN_REC:
+       {
+               struct llog_gen_rec *lgr = (struct llog_gen_rec *)rec;
+
+               __swab64s(&lgr->lgr_gen.mnt_cnt);
+               __swab64s(&lgr->lgr_gen.conn_cnt);
+               tail = &lgr->lgr_tail;
+               break;
+       }
         case LLOG_PAD_MAGIC:
                 break;
         case LLOG_PAD_MAGIC:
                 break;
-
         default:
                 CERROR("Unknown llog rec type %#x swabbing rec %p\n",
                        rec->lrh_type, rec);
         default:
                 CERROR("Unknown llog rec type %#x swabbing rec %p\n",
                        rec->lrh_type, rec);
@@ -257,7 +263,7 @@ void lustre_swab_llog_hdr (struct llog_log_hdr *h)
         ENTRY;
         print_llog_hdr(h);
 
         ENTRY;
         print_llog_hdr(h);
 
-        lustre_swab_llog_rec(&h->llh_hdr, &h->llh_tail);
+       lustre_swab_llog_rec(&h->llh_hdr);
 
         print_llog_hdr(h);
         EXIT;
 
         print_llog_hdr(h);
         EXIT;
index 00678c2..cd642e1 100644 (file)
@@ -437,14 +437,14 @@ static int llog_test_5(struct obd_device *obd)
         llog_init_handle(llh, LLOG_F_IS_CAT, &uuid);
 
         CWARN("5b: print the catalog entries.. we expect 2\n");
         llog_init_handle(llh, LLOG_F_IS_CAT, &uuid);
 
         CWARN("5b: print the catalog entries.. we expect 2\n");
-        rc = llog_process(llh, cat_print_cb, "test 5", NULL);
+       rc = llog_process(NULL, llh, cat_print_cb, "test 5", NULL);
         if (rc) {
                 CERROR("5b: process with cat_print_cb failed: %d\n", rc);
                 GOTO(out, rc);
         }
 
         CWARN("5c: Cancel 40000 records, see one log zapped\n");
         if (rc) {
                 CERROR("5b: process with cat_print_cb failed: %d\n", rc);
                 GOTO(out, rc);
         }
 
         CWARN("5c: Cancel 40000 records, see one log zapped\n");
-        rc = llog_cat_process(llh, llog_cancel_rec_cb, "foobar", 0, 0);
+       rc = llog_cat_process(NULL, llh, llog_cancel_rec_cb, "foobar", 0, 0);
         if (rc != -4711) {
                 CERROR("5c: process with cat_cancel_cb failed: %d\n", rc);
                 GOTO(out, rc);
         if (rc != -4711) {
                 CERROR("5c: process with cat_cancel_cb failed: %d\n", rc);
                 GOTO(out, rc);
@@ -459,21 +459,21 @@ static int llog_test_5(struct obd_device *obd)
         }
 
         CWARN("5b: print the catalog entries.. we expect 1\n");
         }
 
         CWARN("5b: print the catalog entries.. we expect 1\n");
-        rc = llog_process(llh, cat_print_cb, "test 5", NULL);
+       rc = llog_process(NULL, llh, cat_print_cb, "test 5", NULL);
         if (rc) {
                 CERROR("5b: process with cat_print_cb failed: %d\n", rc);
                 GOTO(out, rc);
         }
 
         CWARN("5e: print plain log entries.. expect 6\n");
         if (rc) {
                 CERROR("5b: process with cat_print_cb failed: %d\n", rc);
                 GOTO(out, rc);
         }
 
         CWARN("5e: print plain log entries.. expect 6\n");
-        rc = llog_cat_process(llh, plain_print_cb, "foobar", 0, 0);
+       rc = llog_cat_process(NULL, llh, plain_print_cb, "foobar", 0, 0);
         if (rc) {
                 CERROR("5e: process with plain_print_cb failed: %d\n", rc);
                 GOTO(out, rc);
         }
 
         CWARN("5f: print plain log entries reversely.. expect 6\n");
         if (rc) {
                 CERROR("5e: process with plain_print_cb failed: %d\n", rc);
                 GOTO(out, rc);
         }
 
         CWARN("5f: print plain log entries reversely.. expect 6\n");
-        rc = llog_cat_reverse_process(llh, plain_print_cb, "foobar");
+       rc = llog_cat_reverse_process(NULL, llh, plain_print_cb, "foobar");
         if (rc) {
                 CERROR("5f: reversely process with plain_print_cb failed: %d\n", rc);
                 GOTO(out, rc);
         if (rc) {
                 CERROR("5f: reversely process with plain_print_cb failed: %d\n", rc);
                 GOTO(out, rc);
@@ -534,11 +534,11 @@ static int llog_test_6(struct obd_device *obd, char *name)
                 GOTO(parse_out, rc);
         }
 
                 GOTO(parse_out, rc);
         }
 
-        rc = llog_process(llh, plain_print_cb, NULL, NULL);
+       rc = llog_process(NULL, llh, plain_print_cb, NULL, NULL);
         if (rc)
                 CERROR("6: llog_process failed %d\n", rc);
 
         if (rc)
                 CERROR("6: llog_process failed %d\n", rc);
 
-        rc = llog_reverse_process(llh, plain_print_cb, NULL, NULL);
+       rc = llog_reverse_process(NULL, llh, plain_print_cb, NULL, NULL);
         if (rc)
                 CERROR("6: llog_reverse_process failed %d\n", rc);
 
         if (rc)
                 CERROR("6: llog_reverse_process failed %d\n", rc);
 
index e7222da..719c64d 100644 (file)
@@ -1483,7 +1483,7 @@ int class_config_parse_llog(struct llog_ctxt *ctxt, char *name,
                 cd.lpcd_first_idx = cfg->cfg_last_idx;
         cd.lpcd_last_idx = 0;
 
                 cd.lpcd_first_idx = cfg->cfg_last_idx;
         cd.lpcd_last_idx = 0;
 
-        rc = llog_process(llh, class_config_llog_handler, cfg, &cd);
+       rc = llog_process(NULL, llh, class_config_llog_handler, cfg, &cd);
 
         CDEBUG(D_CONFIG, "Processed log %s gen %d-%d (rc=%d)\n", name,
                cd.lpcd_first_idx + 1, cd.lpcd_last_idx, rc);
 
         CDEBUG(D_CONFIG, "Processed log %s gen %d-%d (rc=%d)\n", name,
                cd.lpcd_first_idx + 1, cd.lpcd_last_idx, rc);
@@ -1577,7 +1577,7 @@ int class_config_dump_llog(struct llog_ctxt *ctxt, char *name,
         if (rc)
                 GOTO(parse_out, rc);
 
         if (rc)
                 GOTO(parse_out, rc);
 
-        rc = llog_process(llh, class_config_dump_handler, cfg, NULL);
+       rc = llog_process(NULL, llh, class_config_dump_handler, cfg, NULL);
 parse_out:
         rc2 = llog_close(llh);
         if (rc == 0)
 parse_out:
         rc2 = llog_close(llh);
         if (rc == 0)
index 2999fd4..cd09c7f 100644 (file)
@@ -215,21 +215,18 @@ static int filter_recov_log_setattr_cb(struct llog_ctxt *ctxt,
         if (oinfo.oi_oa == NULL)
                 RETURN(-ENOMEM);
 
         if (oinfo.oi_oa == NULL)
                 RETURN(-ENOMEM);
 
-        if (rec->lrh_type == MDS_SETATTR_REC) {
-                struct llog_setattr_rec *lsr = (struct llog_setattr_rec *)rec;
-
-                oinfo.oi_oa->o_id = lsr->lsr_oid;
-                oinfo.oi_oa->o_seq = lsr->lsr_oseq;
-                oinfo.oi_oa->o_uid = lsr->lsr_uid;
-                oinfo.oi_oa->o_gid = lsr->lsr_gid;
-        } else {
+       if (rec->lrh_type == MDS_SETATTR64_REC) {
                 struct llog_setattr64_rec *lsr = (struct llog_setattr64_rec *)rec;
 
                 oinfo.oi_oa->o_id = lsr->lsr_oid;
                 oinfo.oi_oa->o_seq = lsr->lsr_oseq;
                 oinfo.oi_oa->o_uid = lsr->lsr_uid;
                 oinfo.oi_oa->o_gid = lsr->lsr_gid;
                 struct llog_setattr64_rec *lsr = (struct llog_setattr64_rec *)rec;
 
                 oinfo.oi_oa->o_id = lsr->lsr_oid;
                 oinfo.oi_oa->o_seq = lsr->lsr_oseq;
                 oinfo.oi_oa->o_uid = lsr->lsr_uid;
                 oinfo.oi_oa->o_gid = lsr->lsr_gid;
-        }
+       } else {
+               CERROR("%s: wrong llog type %#x\n", obd->obd_name,
+                      rec->lrh_type);
+               RETURN(-EINVAL);
+       }
 
         oinfo.oi_oa->o_valid |= (OBD_MD_FLID | OBD_MD_FLUID | OBD_MD_FLGID |
                                  OBD_MD_FLCOOKIE);
 
         oinfo.oi_oa->o_valid |= (OBD_MD_FLID | OBD_MD_FLUID | OBD_MD_FLGID |
                                  OBD_MD_FLCOOKIE);
@@ -284,12 +281,12 @@ int filter_recov_log_mds_ost_cb(struct llog_handle *llh,
         case MDS_UNLINK_REC:
                 rc = filter_recov_log_unlink_cb(ctxt, rec, &cookie);
                 break;
         case MDS_UNLINK_REC:
                 rc = filter_recov_log_unlink_cb(ctxt, rec, &cookie);
                 break;
-        case MDS_SETATTR_REC:
         case MDS_SETATTR64_REC:
                 rc = filter_recov_log_setattr_cb(ctxt, rec, &cookie);
                 break;
         case LLOG_GEN_REC: {
                 struct llog_gen_rec *lgr = (struct llog_gen_rec *)rec;
         case MDS_SETATTR64_REC:
                 rc = filter_recov_log_setattr_cb(ctxt, rec, &cookie);
                 break;
         case LLOG_GEN_REC: {
                 struct llog_gen_rec *lgr = (struct llog_gen_rec *)rec;
+
                 if (llog_gen_lt(lgr->lgr_gen, ctxt->loc_gen))
                         rc = 0;
                 else
                 if (llog_gen_lt(lgr->lgr_gen, ctxt->loc_gen))
                         rc = 0;
                 else
index a038fec..d12d7b3 100644 (file)
@@ -1146,7 +1146,7 @@ int sptlrpc_target_local_read_conf(struct obd_device *obd,
                 GOTO(out_close, rc = 0);
         }
 
                 GOTO(out_close, rc = 0);
         }
 
-        rc = llog_process(llh, local_read_handler, (void *) conf, NULL);
+       rc = llog_process(NULL, llh, local_read_handler, (void *)conf, NULL);
 
         if (rc == 0) {
                 conf->sc_local = 1;
 
         if (rc == 0) {
                 conf->sc_local = 1;
index 2364570..0f89390 100644 (file)
@@ -54,8 +54,8 @@ void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
          * (make -C lustre/utils newwiretest)
 {
         /* Wire protocol assertions generated by 'wirecheck'
          * (make -C lustre/utils newwiretest)
-         * running on Linux niu-dell 2.6.18-238 #2 SMP Mon May 16 03:44:25 PDT 2011 x86_64 x86_64 x86
-         * with gcc version 4.1.2 20080704 (Red Hat 4.1.2-44) */
+         * running on Linux node7 2.6.32 #4 SMP Tue Aug 7 13:09:55 MSK 2012 x86_64 x86_64 x86_64 GNU/
+         * with gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)  */
 
 
         /* Constants... */
 
 
         /* Constants... */
@@ -1847,8 +1847,8 @@ void lustre_assert_wire_constants(void)
                  MDS_OPEN_SYNC);
         LASSERTF(MDS_OPEN_DIRECTORY == 000000200000UL, "found 0%.11oUL\n",
                  MDS_OPEN_DIRECTORY);
                  MDS_OPEN_SYNC);
         LASSERTF(MDS_OPEN_DIRECTORY == 000000200000UL, "found 0%.11oUL\n",
                  MDS_OPEN_DIRECTORY);
-       LASSERTF(MDS_OPEN_BY_FID == 000040000000UL, "found 0%.11oUL\n",
-                MDS_OPEN_BY_FID);
+        LASSERTF(MDS_OPEN_BY_FID == 000040000000UL, "found 0%.11oUL\n",
+                 MDS_OPEN_BY_FID);
         LASSERTF(MDS_OPEN_DELAY_CREATE == 000100000000UL, "found 0%.11oUL\n",
                  MDS_OPEN_DELAY_CREATE);
         LASSERTF(MDS_OPEN_OWNEROVERRIDE == 000200000000UL, "found 0%.11oUL\n",
         LASSERTF(MDS_OPEN_DELAY_CREATE == 000100000000UL, "found 0%.11oUL\n",
                  MDS_OPEN_DELAY_CREATE);
         LASSERTF(MDS_OPEN_OWNEROVERRIDE == 000200000000UL, "found 0%.11oUL\n",
@@ -2994,13 +2994,13 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogen));
         CLASSERT(OST_SZ_REC == 274730752);
         LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogen));
         CLASSERT(OST_SZ_REC == 274730752);
-        CLASSERT(OST_RAID1_REC == 274731008);
         CLASSERT(MDS_UNLINK_REC == 274801668);
         CLASSERT(MDS_UNLINK_REC == 274801668);
-        CLASSERT(MDS_SETATTR_REC == 274801665);
+        CLASSERT(MDS_UNLINK64_REC == 275325956);
+        CLASSERT(MDS_SETATTR64_REC == 275325953);
         CLASSERT(OBD_CFG_REC == 274857984);
         CLASSERT(OBD_CFG_REC == 274857984);
-        CLASSERT(PTL_CFG_REC == 274923520);
         CLASSERT(LLOG_GEN_REC == 274989056);
         CLASSERT(LLOG_GEN_REC == 274989056);
-        CLASSERT(LLOG_JOIN_REC == 275054592);
+        CLASSERT(CHANGELOG_REC == 275120128);
+        CLASSERT(CHANGELOG_USER_REC == 275185664);
         CLASSERT(LLOG_HDR_MAGIC == 275010873);
         CLASSERT(LLOG_LOGID_MAGIC == 275010875);
 
         CLASSERT(LLOG_HDR_MAGIC == 275010873);
         CLASSERT(LLOG_LOGID_MAGIC == 275010875);
 
@@ -3039,10 +3039,10 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct llog_rec_hdr, lrh_type));
         LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_type));
                  (long long)(int)offsetof(struct llog_rec_hdr, lrh_type));
         LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_type));
-        LASSERTF((int)offsetof(struct llog_rec_hdr, lrh_padding) == 12, "found %lld\n",
-                 (long long)(int)offsetof(struct llog_rec_hdr, lrh_padding));
-        LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_padding) == 4, "found %lld\n",
-                 (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_padding));
+        LASSERTF((int)offsetof(struct llog_rec_hdr, lrh_id) == 12, "found %lld\n",
+                 (long long)(int)offsetof(struct llog_rec_hdr, lrh_id));
+        LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_id) == 4, "found %lld\n",
+                 (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_id));
 
         /* Checks for struct llog_rec_tail */
         LASSERTF((int)sizeof(struct llog_rec_tail) == 8, "found %lld\n",
 
         /* Checks for struct llog_rec_tail */
         LASSERTF((int)sizeof(struct llog_rec_tail) == 8, "found %lld\n",
index 101484c..dc7e437 100644 (file)
@@ -172,7 +172,7 @@ int llog_pack_buffer(int fd, struct llog_log_hdr **llog,
                                        cur_rec->lrh_type, cur_rec->lrh_len);
                 } else {
                         printf("Bit %d of %d not set\n", idx, recs_num);
                                        cur_rec->lrh_type, cur_rec->lrh_len);
                 } else {
                         printf("Bit %d of %d not set\n", idx, recs_num);
-                        cur_rec->lrh_padding = CANCELLED;
+                        cur_rec->lrh_id = CANCELLED;
                         /* The header counts only set records */
                         i--;
                 }
                         /* The header counts only set records */
                         i--;
                 }
@@ -466,7 +466,7 @@ void print_records(struct llog_rec_hdr **recs, int rec_number)
 
                 lopt = le32_to_cpu(recs[i]->lrh_type);
 
 
                 lopt = le32_to_cpu(recs[i]->lrh_type);
 
-                if (recs[i]->lrh_padding == CANCELLED)
+                if (recs[i]->lrh_id == CANCELLED)
                         printf("NOT SET ");
 
                 if (lopt == OBD_CFG_REC) {
                         printf("NOT SET ");
 
                 if (lopt == OBD_CFG_REC) {
index 2c4b4fc..8cdb7a6 100644 (file)
@@ -1281,16 +1281,16 @@ check_llog_logid(void)
         CHECK_MEMBER(llog_logid, lgl_oseq);
         CHECK_MEMBER(llog_logid, lgl_ogen);
 
         CHECK_MEMBER(llog_logid, lgl_oseq);
         CHECK_MEMBER(llog_logid, lgl_ogen);
 
-        CHECK_CVALUE(OST_SZ_REC);
-        CHECK_CVALUE(OST_RAID1_REC);
-        CHECK_CVALUE(MDS_UNLINK_REC);
-        CHECK_CVALUE(MDS_SETATTR_REC);
-        CHECK_CVALUE(OBD_CFG_REC);
-        CHECK_CVALUE(PTL_CFG_REC);
-        CHECK_CVALUE(LLOG_GEN_REC);
-        CHECK_CVALUE(LLOG_JOIN_REC);
-        CHECK_CVALUE(LLOG_HDR_MAGIC);
-        CHECK_CVALUE(LLOG_LOGID_MAGIC);
+       CHECK_CVALUE(OST_SZ_REC);
+       CHECK_CVALUE(MDS_UNLINK_REC);
+       CHECK_CVALUE(MDS_UNLINK64_REC);
+       CHECK_CVALUE(MDS_SETATTR64_REC);
+       CHECK_CVALUE(OBD_CFG_REC);
+       CHECK_CVALUE(LLOG_GEN_REC);
+       CHECK_CVALUE(CHANGELOG_REC);
+       CHECK_CVALUE(CHANGELOG_USER_REC);
+       CHECK_CVALUE(LLOG_HDR_MAGIC);
+       CHECK_CVALUE(LLOG_LOGID_MAGIC);
 }
 
 static void
 }
 
 static void
@@ -1312,7 +1312,7 @@ check_llog_rec_hdr(void)
         CHECK_MEMBER(llog_rec_hdr, lrh_len);
         CHECK_MEMBER(llog_rec_hdr, lrh_index);
         CHECK_MEMBER(llog_rec_hdr, lrh_type);
         CHECK_MEMBER(llog_rec_hdr, lrh_len);
         CHECK_MEMBER(llog_rec_hdr, lrh_index);
         CHECK_MEMBER(llog_rec_hdr, lrh_type);
-        CHECK_MEMBER(llog_rec_hdr, lrh_padding);
+       CHECK_MEMBER(llog_rec_hdr, lrh_id);
 }
 
 static void
 }
 
 static void
index b6d5d93..c6f4f1c 100644 (file)
@@ -62,8 +62,8 @@ void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
          * (make -C lustre/utils newwiretest)
 {
         /* Wire protocol assertions generated by 'wirecheck'
          * (make -C lustre/utils newwiretest)
-         * running on Linux niu-dell 2.6.18-238 #2 SMP Mon May 16 03:44:25 PDT 2011 x86_64 x86_64 x86
-         * with gcc version 4.1.2 20080704 (Red Hat 4.1.2-44) */
+         * running on Linux node7 2.6.32 #4 SMP Tue Aug 7 13:09:55 MSK 2012 x86_64 x86_64 x86_64 GNU/
+         * with gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)  */
 
 
         /* Constants... */
 
 
         /* Constants... */
@@ -1855,8 +1855,8 @@ void lustre_assert_wire_constants(void)
                  MDS_OPEN_SYNC);
         LASSERTF(MDS_OPEN_DIRECTORY == 000000200000UL, "found 0%.11oUL\n",
                  MDS_OPEN_DIRECTORY);
                  MDS_OPEN_SYNC);
         LASSERTF(MDS_OPEN_DIRECTORY == 000000200000UL, "found 0%.11oUL\n",
                  MDS_OPEN_DIRECTORY);
-       LASSERTF(MDS_OPEN_BY_FID == 000040000000UL, "found 0%.11oUL\n",
-                MDS_OPEN_BY_FID);
+        LASSERTF(MDS_OPEN_BY_FID == 000040000000UL, "found 0%.11oUL\n",
+                 MDS_OPEN_BY_FID);
         LASSERTF(MDS_OPEN_DELAY_CREATE == 000100000000UL, "found 0%.11oUL\n",
                  MDS_OPEN_DELAY_CREATE);
         LASSERTF(MDS_OPEN_OWNEROVERRIDE == 000200000000UL, "found 0%.11oUL\n",
         LASSERTF(MDS_OPEN_DELAY_CREATE == 000100000000UL, "found 0%.11oUL\n",
                  MDS_OPEN_DELAY_CREATE);
         LASSERTF(MDS_OPEN_OWNEROVERRIDE == 000200000000UL, "found 0%.11oUL\n",
@@ -3002,13 +3002,13 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogen));
         CLASSERT(OST_SZ_REC == 274730752);
         LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogen));
         CLASSERT(OST_SZ_REC == 274730752);
-        CLASSERT(OST_RAID1_REC == 274731008);
         CLASSERT(MDS_UNLINK_REC == 274801668);
         CLASSERT(MDS_UNLINK_REC == 274801668);
-        CLASSERT(MDS_SETATTR_REC == 274801665);
+        CLASSERT(MDS_UNLINK64_REC == 275325956);
+        CLASSERT(MDS_SETATTR64_REC == 275325953);
         CLASSERT(OBD_CFG_REC == 274857984);
         CLASSERT(OBD_CFG_REC == 274857984);
-        CLASSERT(PTL_CFG_REC == 274923520);
         CLASSERT(LLOG_GEN_REC == 274989056);
         CLASSERT(LLOG_GEN_REC == 274989056);
-        CLASSERT(LLOG_JOIN_REC == 275054592);
+        CLASSERT(CHANGELOG_REC == 275120128);
+        CLASSERT(CHANGELOG_USER_REC == 275185664);
         CLASSERT(LLOG_HDR_MAGIC == 275010873);
         CLASSERT(LLOG_LOGID_MAGIC == 275010875);
 
         CLASSERT(LLOG_HDR_MAGIC == 275010873);
         CLASSERT(LLOG_LOGID_MAGIC == 275010875);
 
@@ -3047,10 +3047,10 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct llog_rec_hdr, lrh_type));
         LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_type));
                  (long long)(int)offsetof(struct llog_rec_hdr, lrh_type));
         LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_type));
-        LASSERTF((int)offsetof(struct llog_rec_hdr, lrh_padding) == 12, "found %lld\n",
-                 (long long)(int)offsetof(struct llog_rec_hdr, lrh_padding));
-        LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_padding) == 4, "found %lld\n",
-                 (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_padding));
+        LASSERTF((int)offsetof(struct llog_rec_hdr, lrh_id) == 12, "found %lld\n",
+                 (long long)(int)offsetof(struct llog_rec_hdr, lrh_id));
+        LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_id) == 4, "found %lld\n",
+                 (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_id));
 
         /* Checks for struct llog_rec_tail */
         LASSERTF((int)sizeof(struct llog_rec_tail) == 8, "found %lld\n",
 
         /* Checks for struct llog_rec_tail */
         LASSERTF((int)sizeof(struct llog_rec_tail) == 8, "found %lld\n",