X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Fllog_swab.c;h=97ed7f43dfaf63ff54edf74c0e5a56ef7a23a13a;hb=1ab4b0239bbd75b4c05f36b8d2cf04fb371b10c2;hp=f509874faaea24ad364a07cccef5886580256fbd;hpb=612f27788166e2f1153cb5f2c4b4bffba9a42235;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/llog_swab.c b/lustre/obdclass/llog_swab.c index f509874..97ed7f4 100644 --- a/lustre/obdclass/llog_swab.c +++ b/lustre/obdclass/llog_swab.c @@ -42,9 +42,6 @@ #define DEBUG_SUBSYSTEM S_LOG -#ifndef __KERNEL__ -#include -#endif #include @@ -72,7 +69,8 @@ EXPORT_SYMBOL(lustre_swab_lu_fid); void lustre_swab_ost_id(struct ost_id *oid) { - if (fid_seq_is_mdt0(oid->oi.oi_seq)) { + if (fid_seq_is_mdt0(oid->oi.oi_seq) || + fid_seq_is_default(oid->oi.oi_seq)) { __swab64s(&oid->oi.oi_id); __swab64s(&oid->oi.oi_seq); } else { @@ -82,7 +80,7 @@ void lustre_swab_ost_id(struct ost_id *oid) EXPORT_SYMBOL(lustre_swab_ost_id); void lustre_swab_llog_id(struct llog_logid *log_id) -{ +{ __swab64s(&log_id->lgl_oi.oi.oi_id); __swab64s(&log_id->lgl_oi.oi.oi_seq); __swab32s(&log_id->lgl_ogen); @@ -173,28 +171,32 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec) } case CHANGELOG_REC: { - struct llog_changelog_rec *cr = (struct llog_changelog_rec*)rec; - - __swab16s(&cr->cr.cr_namelen); - __swab16s(&cr->cr.cr_flags); - __swab32s(&cr->cr.cr_type); - __swab64s(&cr->cr.cr_index); - __swab64s(&cr->cr.cr_prev); - __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; + struct llog_changelog_rec *cr = + (struct llog_changelog_rec *)rec; + + __swab16s(&cr->cr.cr_namelen); + __swab16s(&cr->cr.cr_flags); + __swab32s(&cr->cr.cr_type); + __swab64s(&cr->cr.cr_index); + __swab64s(&cr->cr.cr_prev); + __swab64s(&cr->cr.cr_time); + lustre_swab_lu_fid(&cr->cr.cr_tfid); + lustre_swab_lu_fid(&cr->cr.cr_pfid); + 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); } - break; - } + /* 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 = @@ -233,6 +235,7 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec) __swab32s(&lsr->lsr_uid_h); __swab32s(&lsr->lsr_gid); __swab32s(&lsr->lsr_gid_h); + __swab64s(&lsr->lsr_valid); tail = &lsr->lsr_tail; break; } @@ -276,10 +279,10 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec) rec->lrh_type, rec); } - if (tail) { - __swab32s(&tail->lrt_len); - __swab32s(&tail->lrt_index); - } + if (tail) { + __swab32s(&tail->lrt_len); + __swab32s(&tail->lrt_index); + } } EXPORT_SYMBOL(lustre_swab_llog_rec);