Whamcloud - gitweb
LU-9410 ldiskfs: no check mb bitmap if flex_bg enabled
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel7 / ext4-mballoc-extra-checks.patch
index ac71448..c1dd290 100644 (file)
@@ -152,7 +152,7 @@ Index: linux-3.10.0-123.el7.x86_64/fs/ext4/mballoc.c
        for (i = 0; i <= 13; i++)
                seq_printf(seq, " %-5u", i <= sb->s_blocksize_bits + 1 ?
                                sg.info.bb_counters[i] : 0);
-@@ -3507,22 +3517,67 @@ static void ext4_mb_generate_from_freeli
+@@ -3507,22 +3517,71 @@ static void ext4_mb_generate_from_freeli
  }
  
  /*
@@ -166,6 +166,10 @@ Index: linux-3.10.0-123.el7.x86_64/fs/ext4/mballoc.c
 +{
 +      unsigned short max = EXT4_CLUSTERS_PER_GROUP(sb);
 +      unsigned short i, first, free = 0;
++      unsigned short free_in_gdp = ext4_free_group_clusters(sb, gdp);
++
++      if (free_in_gdp == 0 && gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))
++              return 0;
 +
 +      i = mb_find_next_zero_bit(bitmap, max, 0);
 +
@@ -179,10 +183,10 @@ Index: linux-3.10.0-123.el7.x86_64/fs/ext4/mballoc.c
 +                      i = mb_find_next_zero_bit(bitmap, max, i);
 +      }
 +
-+      if (free != ext4_free_group_clusters(sb, gdp)) {
++      if (free != free_in_gdp) {
 +              ext4_error(sb, "on-disk bitmap for group %d"
 +                      "corrupted: %u blocks free in bitmap, %u - in gd\n",
-+                      group, free, ext4_free_group_clusters(sb, gdp));
++                      group, free, free_in_gdp);
 +              return -EIO;
 +      }
 +      return 0;