From: wang di Date: Tue, 7 May 2013 18:43:43 +0000 (-0700) Subject: LU-3302 llog: Do not use ostid swab for llogid X-Git-Tag: 2.4.0-RC1~16 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=57d8d7f152b1a1cabc103193f859bd927b3fbe9c LU-3302 llog: Do not use ostid swab for llogid Since logid still use id/seq format in the request, it will be swabbed by its own swab func, instead of using ostid swab, which might see logid as FID incorrectly. Signed-off-by: wang di Change-Id: I35f554e99a765384218ee3a357c931d6be1de6b3 Reviewed-on: http://review.whamcloud.com/6305 Tested-by: Hudson Reviewed-by: John Hammond Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 086fda1..efcca73 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -3274,6 +3274,7 @@ 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); +extern void lustre_swab_llog_id(struct llog_logid *lid); struct lustre_cfg; extern void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg); diff --git a/lustre/obdclass/llog_swab.c b/lustre/obdclass/llog_swab.c index ad71309..10c6225 100644 --- a/lustre/obdclass/llog_swab.c +++ b/lustre/obdclass/llog_swab.c @@ -81,12 +81,19 @@ 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); +} +EXPORT_SYMBOL(lustre_swab_llog_id); + void lustre_swab_llogd_body (struct llogd_body *d) { ENTRY; print_llogd_body(d); - lustre_swab_ost_id(&d->lgd_logid.lgl_oi); - __swab32s (&d->lgd_logid.lgl_ogen); + lustre_swab_llog_id(&d->lgd_logid); __swab32s (&d->lgd_ctxt_idx); __swab32s (&d->lgd_llh_flags); __swab32s (&d->lgd_index); @@ -102,8 +109,7 @@ void lustre_swab_llogd_conn_body (struct llogd_conn_body *d) { __swab64s (&d->lgdc_gen.mnt_cnt); __swab64s (&d->lgdc_gen.conn_cnt); - lustre_swab_ost_id(&d->lgdc_logid.lgl_oi); - __swab32s (&d->lgdc_logid.lgl_ogen); + lustre_swab_llog_id(&d->lgdc_logid); __swab32s (&d->lgdc_ctxt_idx); } EXPORT_SYMBOL(lustre_swab_llogd_conn_body); @@ -233,8 +239,7 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec) { struct llog_logid_rec *lid = (struct llog_logid_rec *)rec; - lustre_swab_ost_id(&lid->lid_id.lgl_oi); - __swab32s(&lid->lid_id.lgl_ogen); + lustre_swab_llog_id(&lid->lid_id); tail = &lid->lid_tail; break; } diff --git a/lustre/osp/osp_sync.c b/lustre/osp/osp_sync.c index c845077..fa90527 100644 --- a/lustre/osp/osp_sync.c +++ b/lustre/osp/osp_sync.c @@ -943,7 +943,7 @@ static int osp_sync_llog_init(const struct lu_env *env, struct osp_device *d) ctxt = llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT); LASSERT(ctxt); - if (likely(ostid_id(&osi->osi_cid.lci_logid.lgl_oi) != 0)) { + if (likely(logid_id(&osi->osi_cid.lci_logid) != 0)) { rc = llog_open(env, ctxt, &lgh, &osi->osi_cid.lci_logid, NULL, LLOG_OPEN_EXISTS); /* re-create llog if it is missing */