Whamcloud - gitweb
LU-9848 llog: check padding size for update reclen 54/28554/2
authorLai Siyao <lai.siyao@intel.com>
Tue, 15 Aug 2017 11:51:08 +0000 (19:51 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 28 Aug 2017 06:25:50 +0000 (06:25 +0000)
Update log only checks padding size for split case, which should also
be done if it's less than chunk size.

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Change-Id: Ie7819f67dd9bcbfb060713bb208c9777420c5178
Reviewed-on: https://review.whamcloud.com/28554
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/target/update_trans.c

index 36ab331..76153b1 100644 (file)
@@ -201,7 +201,17 @@ static int sub_updates_write(const struct lu_env *env,
                 "lrh_len %u record_size %zu\n", record->lur_hdr.lrh_len,
                 llog_update_record_size(record));
 
-       if (likely(record->lur_hdr.lrh_len <= ctxt->loc_chunk_size)) {
+       /*
+        * If its size > llog chunk_size, then write current chunk to the update
+        * llog, NB the padding should >= LLOG_MIN_REC_SIZE.
+        *
+        * So check padding length is either >= LLOG_MIN_REC_SIZE or is 0
+        * (record length just matches the chunk size).
+        */
+
+       reclen = record->lur_hdr.lrh_len;
+       if (reclen + LLOG_MIN_REC_SIZE <= ctxt->loc_chunk_size ||
+           reclen == ctxt->loc_chunk_size) {
                OBD_ALLOC_PTR(stc);
                if (stc == NULL)
                        GOTO(llog_put, rc = -ENOMEM);
@@ -245,13 +255,6 @@ static int sub_updates_write(const struct lu_env *env,
                else
                        eof = true;
 
-               /*
-                * If its size > llog chunk_size, then write current chunk to
-                * the update llog, NB the padding should >= LLOG_MIN_REC_SIZE.
-                *
-                * So check padding length is either >= LLOG_MIN_REC_SIZE or is
-                * 0 (record length just matches the chunk size).
-                */
                reclen = __llog_update_record_size(
                                __update_records_size(next - start));
                if ((reclen + LLOG_MIN_REC_SIZE <= ctxt->loc_chunk_size ||