Whamcloud - gitweb
LU-6714 llog: fix the llog_cat_set_first_idx() 41/15841/4
authorMikhail Pershin <mike.pershin@intel.com>
Sat, 1 Aug 2015 16:10:58 +0000 (19:10 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 9 Aug 2015 23:52:14 +0000 (23:52 +0000)
The bug was introduced in previous commit causing
wrong catalog index to be set.

Test-Parameters: alwaysuploadlogs envdefinitions=SLOW=yes mdtfilesystemtype=ldiskfs mdsfilesystemtype=ldiskfs ostfilesystemtype=ldiskfs clientdistro=el7 ossdistro=el6.6 mdsdistro=el6.6 mdtcount=1 testlist=performance-sanity
Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Change-Id: Iaa0747c5f504109f3a265c7cdda91ebe7ba83b4f
Reviewed-on: http://review.whamcloud.com/15841
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/llog_cat.c

index e1ad2cd..981af6f 100644 (file)
@@ -764,20 +764,21 @@ static int llog_cat_set_first_idx(struct llog_handle *cathandle, int idx)
        if (llh->llh_cat_idx == (idx - 1)) {
                llh->llh_cat_idx = idx;
 
-               do {
+               while (idx != cathandle->lgh_last_idx) {
                        idx = (idx + 1) % bitmap_size;
                        if (!ext2_test_bit(idx, LLOG_HDR_BITMAP(llh))) {
                                /* update llh_cat_idx for each unset bit,
-                                * expecting the*/
+                                * expecting the next one is set */
                                llh->llh_cat_idx = idx;
                        } else if (idx == 0) {
                                /* skip header bit */
+                               llh->llh_cat_idx = 0;
                                continue;
                        } else {
                                /* the first index is found */
                                break;
                        }
-               } while (idx != cathandle->lgh_last_idx);
+               }
 
                CDEBUG(D_RPCTRACE, "Set catlog "DOSTID" first idx %u,"
                       " (last_idx %u)\n", POSTID(&cathandle->lgh_id.lgl_oi),