* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2013, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#include <lustre_log.h>
+#include <lustre_update.h>
static void print_llogd_body(struct llogd_body *d)
{
__swab64s(&log_id->lgl_oi.oi.oi_seq);
__swab32s(&log_id->lgl_ogen);
}
-EXPORT_SYMBOL(lustre_swab_llog_id);
void lustre_swab_llogd_body (struct llogd_body *d)
{
__swab32s (&fid->generation);
__swab32s (&fid->f_type);
}
-EXPORT_SYMBOL(lustre_swab_ll_fid);
void lustre_swab_lu_seq_range(struct lu_seq_range *range)
{
}
EXPORT_SYMBOL(lustre_swab_lu_seq_range);
+void lustre_swab_update_ops(struct update_ops *uops, unsigned int op_count)
+{
+ unsigned int i;
+ unsigned int j;
+
+ for (i = 0; i < op_count; i++) {
+ lustre_swab_lu_fid(&uops->uops_op[i].uop_fid);
+ __swab16s(&uops->uops_op[i].uop_type);
+ __swab16s(&uops->uops_op[i].uop_param_count);
+ for (j = 0; j < uops->uops_op[i].uop_param_count; j++)
+ __swab16s(&uops->uops_op[i].uop_params_off[j]);
+ }
+}
+EXPORT_SYMBOL(lustre_swab_update_ops);
+
void lustre_swab_llog_rec(struct llog_rec_hdr *rec)
{
struct llog_rec_tail *tail = NULL;
__swab64s(&cr->cr.cr_time);
lustre_swab_lu_fid(&cr->cr.cr_tfid);
lustre_swab_lu_fid(&cr->cr.cr_pfid);
- if (CHANGELOG_REC_EXTENDED(&cr->cr)) {
- struct llog_changelog_ext_rec *ext =
- (struct llog_changelog_ext_rec *)rec;
-
- 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;
+ if (cr->cr.cr_flags & CLF_RENAME) {
+ struct changelog_ext_rename *rnm =
+ changelog_rec_rename(&cr->cr);
+
+ lustre_swab_lu_fid(&rnm->cr_sfid);
+ lustre_swab_lu_fid(&rnm->cr_spfid);
}
- tail = (struct llog_rec_tail *)((char *)tail +
+ /* Because the tail follows a variable-length structure we need
+ * to compute its location at runtime */
+ tail = (struct llog_rec_tail *)((char *)&cr->cr +
+ changelog_rec_size(&cr->cr) +
cr->cr.cr_namelen);
break;
}
+
case CHANGELOG_USER_REC:
{
struct llog_changelog_user_rec *cur =
}
case LLOG_PAD_MAGIC:
break;
+ case UPDATE_REC:
+ {
+ struct llog_update_record *lur =
+ (struct llog_update_record *)rec;
+ struct update_records *record = &lur->lur_update_rec;
+
+ __swab32s(&record->ur_flags);
+ __swab64s(&record->ur_batchid);
+ __swab64s(&record->ur_master_transno);
+ __swab32s(&record->ur_param_count);
+ __swab32s(&record->ur_update_count);
+ lustre_swab_update_ops(&record->ur_ops,
+ record->ur_update_count);
+
+ /* Compute tail location. */
+ tail = (struct llog_rec_tail *)((char *)record +
+ update_records_size(record));
+ break;
+ }
default:
CERROR("Unknown llog rec type %#x swabbing rec %p\n",
rec->lrh_type, rec);
__swab32s(&tail->lrt_index);
}
}
-EXPORT_SYMBOL(lustre_swab_llog_rec);
static void print_llog_hdr(struct llog_log_hdr *h)
{
EXIT;
return;
}
-EXPORT_SYMBOL(lustre_swab_lustre_cfg);
/* used only for compatibility with old on-disk cfg_marker data */
struct cfg_marker32 {
EXIT;
return;
}
-EXPORT_SYMBOL(lustre_swab_cfg_marker);