From 242064b92f1d9c2add661bc7ca8a748df1b9b0d2 Mon Sep 17 00:00:00 2001
From: adilger <adilger>
Date: Wed, 14 Nov 2007 20:53:55 +0000
Subject: [PATCH] Branch b1_6 Due to reported negative performance impact of
 this patch, it has been removed from the ldiskfs patch series.  The patch is
 not required functionality, and was only added for an increase in reliability
 in unlikely corruption cases. b=13144 i=kalpak

---
 ...3-block-bitmap-validation-2.6-SLES10.patch | 108 ------------------
 ...t3-block-bitmap-validation-2.6-rhel5.patch | 107 -----------------
 .../ext3-blockmap-validation-2.6-rhel4.patch  | 108 ------------------
 .../series/ldiskfs-2.6-rhel4.series           |   1 -
 .../series/ldiskfs-2.6-rhel5.series           |   1 -
 .../series/ldiskfs-2.6-sles10.series          |   1 -
 6 files changed, 326 deletions(-)
 delete mode 100644 ldiskfs/kernel_patches/patches/ext3-block-bitmap-validation-2.6-SLES10.patch
 delete mode 100644 ldiskfs/kernel_patches/patches/ext3-block-bitmap-validation-2.6-rhel5.patch
 delete mode 100644 ldiskfs/kernel_patches/patches/ext3-blockmap-validation-2.6-rhel4.patch

diff --git a/ldiskfs/kernel_patches/patches/ext3-block-bitmap-validation-2.6-SLES10.patch b/ldiskfs/kernel_patches/patches/ext3-block-bitmap-validation-2.6-SLES10.patch
deleted file mode 100644
index 8e258d2ea5..0000000000
--- a/ldiskfs/kernel_patches/patches/ext3-block-bitmap-validation-2.6-SLES10.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
-Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
-Index: linux-2.6.16.46-0.14/fs/ext3/balloc.c
-===================================================================
---- linux-2.6.16.46-0.14.orig/fs/ext3/balloc.c
-+++ linux-2.6.16.46-0.14/fs/ext3/balloc.c
-@@ -144,6 +144,14 @@ unsigned ext3_init_block_bitmap(struct s
- 	return free_blocks - sbi->s_itb_per_group - 2;
- }
- 
-+static inline int
-+block_in_use(unsigned long block, struct super_block *sb, unsigned char *map)
-+{
-+	return ext3_test_bit ((block -
-+		le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
-+			 EXT3_BLOCKS_PER_GROUP(sb), map);
-+}
-+
- /*
-  * Read the bitmap for a given block_group, reading into the specified 
-  * slot in the superblock's bitmap cache.
-@@ -153,33 +161,52 @@ unsigned ext3_init_block_bitmap(struct s
- struct buffer_head *
- read_block_bitmap(struct super_block *sb, unsigned int block_group)
- {
-+	int i;
- 	struct ext3_group_desc * desc;
- 	struct buffer_head * bh = NULL;
-+	unsigned long bitmap_blk;
- 
- 	desc = ext3_get_group_desc (sb, block_group, NULL);
- 	if (!desc)
--		goto error_out;
--	if (desc->bg_flags & cpu_to_le16(EXT3_BG_BLOCK_UNINIT)) {
--		bh = sb_getblk(sb, le32_to_cpu(desc->bg_block_bitmap));
--		if (!buffer_uptodate(bh)) {
--			lock_buffer(bh);
--			if (!buffer_uptodate(bh)) {
--				ext3_init_block_bitmap(sb, bh,block_group,desc);
--				set_buffer_uptodate(bh);
--			}
--			unlock_buffer(bh);
--		}
--	} else {
--		bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap));
--	}
-+		return NULL;
-+	bitmap_blk = le32_to_cpu(desc->bg_block_bitmap);
-+	bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap));
- 	if (!bh)
--		ext3_error (sb, "read_block_bitmap",
--			    "Cannot read block bitmap - "
--			    "block_group = %d, block_bitmap = %u",
--			    block_group, le32_to_cpu(desc->bg_block_bitmap));
-+		ext3_error (sb, __FUNCTION__,
-+				"Cannot read block bitmap - "
-+				"block_group = %d, block_bitmap = %lu",
-+				block_group, bitmap_blk);
-+	/* check whether block bitmap block number is set */
-+	   if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
-+		   /* bad block bitmap */
-+		   goto error_out;
-+	   }
-+
-+	   /* check whether the inode bitmap block number is set */
-+	   bitmap_blk = le32_to_cpu(desc->bg_inode_bitmap);
-+	   if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
-+		   /* bad block bitmap */
-+		   goto error_out;
-+	   }
-+	   /* check whether the inode table block number is set */
-+	   bitmap_blk = le32_to_cpu(desc->bg_inode_table);
-+	   for (i = 0; i < EXT3_SB(sb)->s_itb_per_group; i++, bitmap_blk++) {
-+		   if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
-+			   /* bad block bitmap */
-+			   goto error_out;
-+		   }
-+	   }
-+	   return bh;
-+
- error_out:
--	return bh;
-+	   brelse(bh);
-+	   ext3_error(sb, __FUNCTION__,
-+			   "Invalid block bitmap - "
-+			   "block_group = %d, block = %lu",
-+			   block_group, bitmap_blk);
-+	   return NULL;
- }
-+
- /*
-  * The reservation window structure operations
-  * --------------------------------------------
-@@ -1548,14 +1575,6 @@ unsigned long ext3_count_free_blocks(str
- #endif
- }
- 
--static inline int
--block_in_use(unsigned long block, struct super_block *sb, unsigned char *map)
--{
--	return ext3_test_bit ((block -
--		le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
--			 EXT3_BLOCKS_PER_GROUP(sb), map);
--}
--
- static inline int test_root(int a, int b)
- {
- 	int num = b;
diff --git a/ldiskfs/kernel_patches/patches/ext3-block-bitmap-validation-2.6-rhel5.patch b/ldiskfs/kernel_patches/patches/ext3-block-bitmap-validation-2.6-rhel5.patch
deleted file mode 100644
index f76289e931..0000000000
--- a/ldiskfs/kernel_patches/patches/ext3-block-bitmap-validation-2.6-rhel5.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
-Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
-Index: linux-2.6.18-8.1.8/fs/ext3/balloc.c
-===================================================================
---- linux-2.6.18-8.1.8.orig/fs/ext3/balloc.c
-+++ linux-2.6.18-8.1.8/fs/ext3/balloc.c
-@@ -143,6 +143,14 @@ unsigned ext3_init_block_bitmap(struct s
- 	return free_blocks - sbi->s_itb_per_group - 2;
- }
- 
-+static inline int
-+block_in_use(unsigned long block, struct super_block *sb, unsigned char *map)
-+{
-+       return ext3_test_bit ((block -
-+		le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
-+			EXT3_BLOCKS_PER_GROUP(sb), map);
-+}
-+
- /*
-  * Read the bitmap for a given block_group, reading into the specified 
-  * slot in the superblock's bitmap cache.
-@@ -152,14 +160,18 @@ unsigned ext3_init_block_bitmap(struct s
- struct buffer_head *
- read_block_bitmap(struct super_block *sb, unsigned int block_group)
- {
-+	int i;
- 	struct ext3_group_desc * desc;
- 	struct buffer_head * bh = NULL;
-+	unsigned long bitmap_blk;
- 
- 	desc = ext3_get_group_desc (sb, block_group, NULL);
- 	if (!desc)
--		goto error_out;
-+		return NULL;
-+
-+	bitmap_blk = le32_to_cpu(desc->bg_block_bitmap);
- 	if (desc->bg_flags & cpu_to_le16(EXT3_BG_BLOCK_UNINIT)) {
--		bh = sb_getblk(sb, le32_to_cpu(desc->bg_block_bitmap));
-+		bh = sb_getblk(sb, bitmap_blk);
- 		if (!buffer_uptodate(bh)) {
- 			lock_buffer(bh);
- 			if (!buffer_uptodate(bh)) {
-@@ -169,15 +181,44 @@ read_block_bitmap(struct super_block *sb
- 			unlock_buffer(bh);
- 		}
- 	} else {
--		bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap));
-+		bh = sb_bread(sb, bitmap_blk);
- 	}
- 	if (!bh)
--		ext3_error (sb, "read_block_bitmap",
-+		ext3_error (sb, __FUNCTION__,
- 			    "Cannot read block bitmap - "
--			    "block_group = %d, block_bitmap = %u",
--			    block_group, le32_to_cpu(desc->bg_block_bitmap));
--error_out:
-+			    "block_group = %d, block_bitmap = %lu",
-+			    block_group, bitmap_blk);
-+
-+	/* check whether block bitmap block number is set */
-+	if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
-+		/* bad block bitmap */
-+		goto error_out;
-+	}
-+
-+	/* check whether the inode bitmap block number is set */
-+	bitmap_blk = le32_to_cpu(desc->bg_inode_bitmap);
-+	if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
-+	/* bad block bitmap */
-+		goto error_out;
-+	}
-+	/* check whether the inode table block number is set */
-+	bitmap_blk = le32_to_cpu(desc->bg_inode_table);
-+	for (i = 0; i < EXT3_SB(sb)->s_itb_per_group; i++, bitmap_blk++) {
-+		if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
-+			/* bad block bitmap */
-+			goto error_out;
-+		}
-+	}
- 	return bh;
-+
-+error_out:
-+ 	brelse(bh);
-+	ext3_error(sb, __FUNCTION__,
-+			"Invalid block bitmap - "
-+			"block_group = %d, block = %lu",
-+			block_group, bitmap_blk);
-+	return NULL;
-+
- }
- /*
-  * The reservation window structure operations
-@@ -1617,14 +1658,6 @@ ext3_fsblk_t ext3_count_free_blocks(stru
- #endif
- }
- 
--static inline int
--block_in_use(ext3_fsblk_t block, struct super_block *sb, unsigned char *map)
--{
--	return ext3_test_bit ((block -
--		le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
--			 EXT3_BLOCKS_PER_GROUP(sb), map);
--}
--
- static inline int test_root(int a, int b)
- {
- 	int num = b;
diff --git a/ldiskfs/kernel_patches/patches/ext3-blockmap-validation-2.6-rhel4.patch b/ldiskfs/kernel_patches/patches/ext3-blockmap-validation-2.6-rhel4.patch
deleted file mode 100644
index e41c85a804..0000000000
--- a/ldiskfs/kernel_patches/patches/ext3-blockmap-validation-2.6-rhel4.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
-Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
-Index: linux-2.6.9/fs/ext3/balloc.c
-===================================================================
---- linux-2.6.9.orig/fs/ext3/balloc.c
-+++ linux-2.6.9/fs/ext3/balloc.c
-@@ -143,6 +143,14 @@ unsigned ext3_init_block_bitmap(struct s
- 	return free_blocks - sbi->s_itb_per_group - 2;
- }
- 
-+static inline int
-+block_in_use(unsigned long block, struct super_block *sb, unsigned char *map)
-+{
-+       return ext3_test_bit ((block -
-+		le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
-+			EXT3_BLOCKS_PER_GROUP(sb), map);
-+}
-+
- /*
-  * Read the bitmap for a given block_group, reading into the specified 
-  * slot in the superblock's bitmap cache.
-@@ -152,14 +160,18 @@ unsigned ext3_init_block_bitmap(struct s
- struct buffer_head *
- read_block_bitmap(struct super_block *sb, unsigned int block_group)
- {
-+	int i;
- 	struct ext3_group_desc * desc;
- 	struct buffer_head * bh = NULL;
-+	unsigned long bitmap_blk;
- 
- 	desc = ext3_get_group_desc (sb, block_group, NULL);
- 	if (!desc)
--		goto error_out;
-+		return NULL;
-+
-+	bitmap_blk = le32_to_cpu(desc->bg_block_bitmap);
- 	if (desc->bg_flags & cpu_to_le16(EXT3_BG_BLOCK_UNINIT)) {
--		bh = sb_getblk(sb, le32_to_cpu(desc->bg_block_bitmap));
-+		bh = sb_getblk(sb, bitmap_blk);
- 		if (!buffer_uptodate(bh)) {
- 			lock_buffer(bh);
- 			if (!buffer_uptodate(bh)) {
-@@ -169,15 +181,44 @@ read_block_bitmap(struct super_block *sb
- 			unlock_buffer(bh);
- 		}
- 	} else {
--		bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap));
-+		bh = sb_bread(sb, bitmap_blk);
- 	}
- 	if (!bh)
--		ext3_error (sb, "read_block_bitmap",
-+		ext3_error (sb, __FUNCTION__,
- 			    "Cannot read block bitmap - "
--			    "block_group = %d, block_bitmap = %u",
--			    block_group, le32_to_cpu(desc->bg_block_bitmap));
--error_out:
-+			    "block_group = %d, block_bitmap = %lu",
-+			    block_group, bitmap_blk);
-+
-+	/* check whether block bitmap block number is set */
-+	if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
-+		/* bad block bitmap */
-+		goto error_out;
-+	}
-+
-+	/* check whether the inode bitmap block number is set */
-+	bitmap_blk = le32_to_cpu(desc->bg_inode_bitmap);
-+	if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
-+	/* bad block bitmap */
-+		goto error_out;
-+	}
-+	/* check whether the inode table block number is set */
-+	bitmap_blk = le32_to_cpu(desc->bg_inode_table);
-+	for (i = 0; i < EXT3_SB(sb)->s_itb_per_group; i++, bitmap_blk++) {
-+		if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
-+			/* bad block bitmap */
-+			goto error_out;
-+		}
-+	}
- 	return bh;
-+
-+error_out:
-+ 	brelse(bh);
-+	ext3_error(sb, __FUNCTION__,
-+			"Invalid block bitmap - "
-+			"block_group = %d, block = %lu",
-+			block_group, bitmap_blk);
-+	return NULL;
-+
- }
- /*
-  * The reservation window structure operations
-@@ -1501,15 +1542,6 @@ unsigned long ext3_count_free_blocks(str
- #endif
- }
- 
--static inline int block_in_use(unsigned long block,
--				struct super_block * sb,
--				unsigned char * map)
--{
--	return ext3_test_bit ((block -
--		le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
--			 EXT3_BLOCKS_PER_GROUP(sb), map);
--}
--
- static inline int test_root(int a, int b)
- {
- 	if (a == 0)
diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel4.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel4.series
index dd11d0146f..3be9760e08 100644
--- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel4.series
+++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel4.series
@@ -21,5 +21,4 @@ ext3-uninit-2.6.9.patch
 ext3-nanosecond-2.6-rhel4.patch
 ext3-unlink-race.patch
 ext3-mmp-2.6-rhel4.patch
-ext3-blockmap-validation-2.6-rhel4.patch
 ext3-fiemap-2.6-sles10.patch
diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series
index efa74ed660..b899b8fb1f 100644
--- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series
+++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series
@@ -16,5 +16,4 @@ ext3-inode-version-2.6.18-vanilla.patch
 ext3-mmp-2.6.18-vanilla.patch
 ext3-unlink-race.patch
 ext3-fiemap-2.6.18-vanilla.patch
-ext3-block-bitmap-validation-2.6-rhel5.patch
 ext3-statfs-2.6-rhel5.patch
diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series
index 6e09977724..d7ee3b0e84 100644
--- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series
+++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series
@@ -20,5 +20,4 @@ ext3-nanosecond-2.6-sles10.patch
 ext3-inode-version-2.6-sles10.patch
 ext3-mmp-2.6-sles10.patch
 ext3-fiemap-2.6-sles10.patch
-ext3-block-bitmap-validation-2.6-SLES10.patch
 ext3-statfs-2.6-sles10.patch
-- 
GitLab