X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fobdclass%2Fllog_osd.c;h=a79b1ec05e9dc93a2592121deabd71fa91dabbd0;hp=0a09fb530f7cc7b6e13c6ee5bb47450a879f8ecc;hb=df45994ddcf5e6fdc379b3e1d43f1d26ba321a0e;hpb=33754bef1a26b40687f2bb8677fb3aadcc2d5c23 diff --git a/lustre/obdclass/llog_osd.c b/lustre/obdclass/llog_osd.c index 0a09fb5..a79b1ec 100644 --- a/lustre/obdclass/llog_osd.c +++ b/lustre/obdclass/llog_osd.c @@ -641,13 +641,19 @@ out: * actual records are larger than minimum size) we just skip * some more records. */ -static inline void llog_skip_over(__u64 *off, int curr, int goal, - __u32 chunk_size) +static inline void llog_skip_over(struct llog_log_hdr *llh, __u64 *off, + int curr, int goal, __u32 chunk_size) { - if (goal <= curr) - return; - *off = (*off + (goal - curr - 1) * LLOG_MIN_REC_SIZE) & - ~(chunk_size - 1); + if (goal > curr) { + if (llh->llh_size == 0) { + /* variable size records */ + *off = (*off + (goal - curr - 1) * LLOG_MIN_REC_SIZE); + } else { + *off = chunk_size + (goal - 1) * llh->llh_size; + } + } + /* always align with lower chunk boundary*/ + *off &= ~(chunk_size - 1); } /** @@ -734,7 +740,8 @@ static int llog_osd_next_block(const struct lu_env *env, struct llog_rec_hdr *rec, *last_rec; struct llog_rec_tail *tail; - llog_skip_over(cur_offset, *cur_idx, next_idx, chunk_size); + llog_skip_over(loghandle->lgh_hdr, cur_offset, *cur_idx, + next_idx, chunk_size); /* read up to next llog chunk_size block */ lgi->lgi_buf.lb_len = chunk_size - @@ -864,7 +871,8 @@ static int llog_osd_prev_block(const struct lu_env *env, LASSERT(dt); cur_offset = chunk_size; - llog_skip_over(&cur_offset, 0, prev_idx, chunk_size); + llog_skip_over(loghandle->lgh_hdr, &cur_offset, 0, prev_idx, + chunk_size); rc = dt_attr_get(env, o, &lgi->lgi_attr); if (rc)