-Index: linux-2.6.9-full/include/linux/ext3_fs.h
+Index: linux-2.6.18-53.1.14/include/linux/ext3_fs.h
===================================================================
---- linux-2.6.9-full.orig/include/linux/ext3_fs.h 2007-06-08 23:44:08.000000000 +0400
-+++ linux-2.6.9-full/include/linux/ext3_fs.h 2007-10-17 22:25:01.000000000 +0400
-@@ -57,6 +57,30 @@ struct statfs;
+--- linux-2.6.18-53.1.14.orig/include/linux/ext3_fs.h
++++ linux-2.6.18-53.1.14/include/linux/ext3_fs.h
+@@ -53,6 +53,30 @@
#define ext3_debug(f, a...) do {} while (0)
#endif
/*
* Special inodes numbers
*/
-@@ -387,6 +411,14 @@ struct ext3_inode {
+@@ -398,6 +422,14 @@ struct ext3_inode {
#define ext3_find_first_zero_bit ext2_find_first_zero_bit
#define ext3_find_next_zero_bit ext2_find_next_zero_bit
/*
* Maximal mount counts between two filesystem checks
*/
-@@ -763,6 +795,20 @@ extern unsigned long ext3_count_dirs (st
+@@ -799,6 +831,20 @@ extern unsigned long ext3_count_dirs (st
extern void ext3_check_inodes_bitmap (struct super_block *);
extern unsigned long ext3_count_free (struct buffer_head *, unsigned);
+
/* inode.c */
- extern int ext3_block_truncate_page(handle_t *, struct page *,
-@@ -804,6 +850,10 @@ extern int ext3_group_extend(struct supe
- unsigned long n_blocks_count);
+ int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode,
+@@ -843,6 +889,10 @@ extern int ext3_group_extend(struct supe
+ ext3_fsblk_t n_blocks_count);
/* super.c */
+extern struct proc_dir_entry *proc_root_ext3;
extern void ext3_error (struct super_block *, const char *, const char *, ...)
__attribute__ ((format (printf, 3, 4)));
extern void __ext3_std_error (struct super_block *, const char *, int);
-Index: linux-2.6.9-full/include/linux/ext3_fs_sb.h
+Index: linux-2.6.18-53.1.14/include/linux/ext3_fs_sb.h
===================================================================
---- linux-2.6.9-full.orig/include/linux/ext3_fs_sb.h 2007-06-08 23:44:07.000000000 +0400
-+++ linux-2.6.9-full/include/linux/ext3_fs_sb.h 2007-10-17 22:25:01.000000000 +0400
-@@ -81,6 +81,61 @@ struct ext3_sb_info {
- char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
- int s_jquota_fmt; /* Format of quota to use */
+--- linux-2.6.18-53.1.14.orig/include/linux/ext3_fs_sb.h
++++ linux-2.6.18-53.1.14/include/linux/ext3_fs_sb.h
+@@ -88,6 +88,61 @@ struct ext3_sb_info {
+ unsigned long s_ext_blocks;
+ unsigned long s_ext_extents;
#endif
+
+ /* for buddy allocator */
+ [(group) & (EXT3_DESC_PER_BLOCK(sb) - 1)]
+
#endif /* _LINUX_EXT3_FS_SB */
-Index: linux-2.6.9-full/fs/ext3/super.c
+Index: linux-2.6.18-53.1.14/fs/ext3/super.c
===================================================================
---- linux-2.6.9-full.orig/fs/ext3/super.c 2007-06-08 23:44:08.000000000 +0400
-+++ linux-2.6.9-full/fs/ext3/super.c 2007-10-17 22:26:27.000000000 +0400
-@@ -394,6 +394,7 @@ void ext3_put_super (struct super_block
+--- linux-2.6.18-53.1.14.orig/fs/ext3/super.c
++++ linux-2.6.18-53.1.14/fs/ext3/super.c
+@@ -391,6 +391,7 @@ static void ext3_put_super (struct super
struct ext3_super_block *es = sbi->s_es;
int i;
ext3_ext_release(sb);
ext3_xattr_put_super(sb);
journal_destroy(sbi->s_journal);
-@@ -438,6 +439,8 @@ void ext3_put_super (struct super_block
+@@ -433,6 +434,8 @@ static void ext3_put_super (struct super
invalidate_bdev(sbi->journal_bdev, 0);
ext3_blkdev_remove(sbi);
}
sb->s_fs_info = NULL;
kfree(sbi);
return;
-@@ -463,6 +466,8 @@ static struct inode *ext3_alloc_inode(st
+@@ -458,6 +461,8 @@ static struct inode *ext3_alloc_inode(st
ei->vfs_inode.i_version = 1;
-
+
memset(&ei->i_cached_extent, 0, sizeof(ei->i_cached_extent));
+ INIT_LIST_HEAD(&ei->i_prealloc_list);
+ spin_lock_init(&ei->i_prealloc_lock);
return &ei->vfs_inode;
}
-@@ -1353,6 +1358,13 @@ static int ext3_fill_super (struct super
+@@ -1454,6 +1459,13 @@ static int ext3_fill_super (struct super
sbi->s_mount_opt = 0;
sbi->s_resuid = EXT3_DEF_RESUID;
sbi->s_resgid = EXT3_DEF_RESGID;
+ return -ENOMEM;
+ }
- blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE);
- if (!blocksize) {
-@@ -1729,6 +1741,8 @@ failed_mount:
+ unlock_kernel();
+
+@@ -1857,6 +1869,8 @@ failed_mount:
ext3_blkdev_remove(sbi);
brelse(bh);
out_fail:
+ sbi->s_dev_proc = NULL;
sb->s_fs_info = NULL;
kfree(sbi);
- return -EINVAL;
-@@ -2593,9 +2607,47 @@ static struct file_system_type ext3_fs_t
+ lock_kernel();
+@@ -2782,9 +2796,47 @@ static struct file_system_type ext3_fs_t
.fs_flags = FS_REQUIRES_DEV,
};
if (err)
return err;
err = init_inodecache();
-@@ -2617,6 +2669,7 @@ static void __exit exit_ext3_fs(void)
+@@ -2806,6 +2858,7 @@ static void __exit exit_ext3_fs(void)
unregister_filesystem(&ext3_fs_type);
destroy_inodecache();
exit_ext3_xattr();
}
int ext3_map_inode_page(struct inode *inode, struct page *page,
-Index: linux-2.6.9-full/fs/ext3/mballoc.c
+Index: linux-2.6.18-53.1.14/fs/ext3/mballoc.c
===================================================================
---- linux-2.6.9-full.orig/fs/ext3/mballoc.c 2007-10-17 21:59:51.072534980 +0400
-+++ linux-2.6.9-full/fs/ext3/mballoc.c 2007-10-17 23:09:22.000000000 +0400
-@@ -0,0 +1,4380 @@
+--- /dev/null
++++ linux-2.6.18-53.1.14/fs/ext3/mballoc.c
+@@ -0,0 +1,4382 @@
+/*
+ * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com
+ * Written by Alex Tomas <alex@clusterfs.com>
+ fragments++;
+ first = i;
+ i = ext2_find_next_le_bit(bitmap, max, i);
++ if (i > max)
++ i = max;
+ len = i - first;
+ free += len;
+ if (len > 1)
A checksum of each group descriptor is used to ensure that corruption in
the group descriptor's bit flags does not cause incorrect operation.
-Index: linux-2.6.16.27-0.9-full/include/linux/ext3_fs.h
+Index: linux-2.6.16.54-0.2.5/include/linux/ext3_fs.h
===================================================================
---- linux-2.6.16.27-0.9-full.orig/include/linux/ext3_fs.h 2007-03-28 18:20:16.000000000 +0400
-+++ linux-2.6.16.27-0.9-full/include/linux/ext3_fs.h 2007-03-28 18:30:06.000000000 +0400
+--- linux-2.6.16.54-0.2.5.orig/include/linux/ext3_fs.h
++++ linux-2.6.16.54-0.2.5/include/linux/ext3_fs.h
@@ -153,16 +153,22 @@ struct ext3_allocation_request {
*/
struct ext3_group_desc
/*
* Macro-instructions used to manage group descriptors
*/
-@@ -590,6 +596,7 @@ static inline struct ext3_inode_info *EX
+@@ -607,6 +613,7 @@ static inline int ext3_valid_inum(struct
#define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
#define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
#define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
#define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
-@@ -606,6 +613,7 @@ static inline struct ext3_inode_info *EX
+@@ -623,6 +630,7 @@ static inline int ext3_valid_inum(struct
EXT3_FEATURE_INCOMPAT_EXTENTS)
#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
-Index: linux-2.6.16.27-0.9-full/fs/ext3/resize.c
+Index: linux-2.6.16.54-0.2.5/fs/ext3/resize.c
===================================================================
---- linux-2.6.16.27-0.9-full.orig/fs/ext3/resize.c 2007-03-13 02:56:52.000000000 +0300
-+++ linux-2.6.16.27-0.9-full/fs/ext3/resize.c 2007-03-28 18:30:06.000000000 +0400
+--- linux-2.6.16.54-0.2.5.orig/fs/ext3/resize.c
++++ linux-2.6.16.54-0.2.5/fs/ext3/resize.c
@@ -19,6 +19,7 @@
#include <linux/errno.h>
#include <linux/slab.h>
#define outside(b, first, last) ((b) < (first) || (b) >= (last))
#define inside(b, first, last) ((b) >= (first) && (b) < (last))
-@@ -818,6 +819,7 @@ int ext3_group_add(struct super_block *s
+@@ -134,25 +135,6 @@ static struct buffer_head *bclean(handle
+ }
+
+ /*
+- * To avoid calling the atomic setbit hundreds or thousands of times, we only
+- * need to use it within a single byte (to ensure we get endianness right).
+- * We can use memset for the rest of the bitmap as there are no other users.
+- */
+-static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
+-{
+- int i;
+-
+- if (start_bit >= end_bit)
+- return;
+-
+- ext3_debug("mark end bits +%d through +%d used\n", start_bit, end_bit);
+- for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++)
+- ext3_set_bit(i, bitmap);
+- if (i < end_bit)
+- memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3);
+-}
+-
+-/*
+ * Set up the block and inode bitmaps, and the inode table for the new group.
+ * This doesn't need to be part of the main transaction, since we are only
+ * changing blocks outside the actual filesystem. We still do journaling to
+@@ -818,6 +800,7 @@ int ext3_group_add(struct super_block *s
gdp->bg_inode_table = cpu_to_le32(input->inode_table);
gdp->bg_free_blocks_count = cpu_to_le16(input->free_blocks_count);
gdp->bg_free_inodes_count = cpu_to_le16(EXT3_INODES_PER_GROUP(sb));
/*
* Make the new blocks and inodes valid next. We do this before
-Index: linux-2.6.16.27-0.9-full/fs/ext3/super.c
+Index: linux-2.6.16.54-0.2.5/fs/ext3/super.c
===================================================================
---- linux-2.6.16.27-0.9-full.orig/fs/ext3/super.c 2007-03-28 18:25:51.000000000 +0400
-+++ linux-2.6.16.27-0.9-full/fs/ext3/super.c 2007-03-28 18:30:06.000000000 +0400
+--- linux-2.6.16.54-0.2.5.orig/fs/ext3/super.c
++++ linux-2.6.16.54-0.2.5/fs/ext3/super.c
@@ -42,6 +42,7 @@
#include "xattr.h"
#include "acl.h"
static int ext3_load_journal(struct super_block *, struct ext3_super_block *,
unsigned long journal_devnum);
-@@ -1221,6 +1222,90 @@ static int ext3_setup_super(struct super
+@@ -1220,6 +1221,90 @@ static int ext3_setup_super(struct super
return res;
}
/* Called at mount-time, super-block is locked */
static int ext3_check_descriptors (struct super_block * sb)
{
-@@ -1270,6 +1355,13 @@ static int ext3_check_descriptors (struc
+@@ -1269,6 +1354,13 @@ static int ext3_check_descriptors (struc
le32_to_cpu(gdp->bg_inode_table));
return 0;
}
block += EXT3_BLOCKS_PER_GROUP(sb);
gdp++;
}
-Index: linux-2.6.16.27-0.9-full/fs/ext3/group.h
+Index: linux-2.6.16.54-0.2.5/fs/ext3/group.h
===================================================================
---- linux-2.6.16.27-0.9-full.orig/fs/ext3/group.h 2007-02-13 18:39:59.640066087 +0300
-+++ linux-2.6.16.27-0.9-full/fs/ext3/group.h 2007-03-28 18:30:06.000000000 +0400
-@@ -0,0 +1,29 @@
+--- /dev/null
++++ linux-2.6.16.54-0.2.5/fs/ext3/group.h
+@@ -0,0 +1,30 @@
+/*
+ * linux/fs/ext3/group.h
+ *
+extern unsigned ext3_init_inode_bitmap(struct super_block *sb,
+ struct buffer_head *bh, int group,
+ struct ext3_group_desc *desc);
++extern void mark_bitmap_end(int start_bit, int end_bit, char *bitmap);
+#endif /* _LINUX_EXT3_GROUP_H */
-Index: linux-2.6.16.27-0.9-full/fs/ext3/ialloc.c
+Index: linux-2.6.16.54-0.2.5/fs/ext3/ialloc.c
===================================================================
---- linux-2.6.16.27-0.9-full.orig/fs/ext3/ialloc.c 2007-03-28 18:20:17.000000000 +0400
-+++ linux-2.6.16.27-0.9-full/fs/ext3/ialloc.c 2007-03-28 18:30:06.000000000 +0400
+--- linux-2.6.16.54-0.2.5.orig/fs/ext3/ialloc.c
++++ linux-2.6.16.54-0.2.5/fs/ext3/ialloc.c
@@ -28,6 +28,7 @@
#include "xattr.h"
+ * need to use it within a single byte (to ensure we get endianness right).
+ * We can use memset for the rest of the bitmap as there are no other users.
+ */
-+static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
++void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
+{
+ int i;
+
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_inc(&sbi->s_freeinodes_counter);
if (is_directory)
-@@ -453,7 +513,7 @@ struct inode *ext3_new_inode(handle_t *h
+@@ -452,7 +512,7 @@ struct inode *ext3_new_inode(handle_t *h
struct ext3_sb_info *sbi;
int err = 0;
struct inode *ret;
/* Cannot create files in a deleted directory */
if (!dir || !dir->i_nlink)
-@@ -570,11 +630,13 @@ repeat_in_this_group:
+@@ -569,11 +629,13 @@ repeat_in_this_group:
goto out;
got:
err = -EIO;
goto fail;
}
-@@ -582,13 +644,65 @@ got:
+@@ -581,13 +643,65 @@ got:
BUFFER_TRACE(bh2, "get_write_access");
err = ext3_journal_get_write_access(handle, bh2);
if (err) goto fail;
spin_unlock(sb_bgl_lock(sbi, group));
BUFFER_TRACE(bh2, "call ext3_journal_dirty_metadata");
err = ext3_journal_dirty_metadata(handle, bh2);
-@@ -610,7 +724,7 @@ got:
+@@ -609,7 +723,7 @@ got:
inode->i_gid = current->fsgid;
inode->i_mode = mode;
/* This is the optimal IO size (for stat), not the fs block size */
inode->i_blksize = PAGE_SIZE;
inode->i_blocks = 0;
-Index: linux-2.6.16.27-0.9-full/fs/ext3/mballoc.c
+Index: linux-2.6.16.54-0.2.5/fs/ext3/mballoc.c
===================================================================
---- linux-2.6.16.27-0.9-full.orig/fs/ext3/mballoc.c 2007-03-28 16:03:19.000000000 +0400
-+++ linux-2.6.16.27-0.9-full/fs/ext3/mballoc.c 2007-03-28 18:30:36.000000000 +0400
+--- linux-2.6.16.54-0.2.5.orig/fs/ext3/mballoc.c
++++ linux-2.6.16.54-0.2.5/fs/ext3/mballoc.c
@@ -36,6 +36,8 @@
#include <linux/seq_file.h>
#include <linux/version.h>
unsigned short bb_first_free;
unsigned short bb_free;
unsigned short bb_fragments;
-@@ -928,10 +931,7 @@ static int ext3_mb_init_cache(struct pag
+@@ -943,10 +946,7 @@ static int ext3_mb_init_cache(struct pag
if (first_group + i >= EXT3_SB(sb)->s_groups_count)
break;
err = -ENOMEM;
bh[i] = sb_getblk(sb, le32_to_cpu(desc->bg_block_bitmap));
-@@ -946,7 +946,12 @@ static int ext3_mb_init_cache(struct pag
+@@ -961,7 +961,12 @@ static int ext3_mb_init_cache(struct pag
unlock_buffer(bh[i]);
continue;
}
get_bh(bh[i]);
bh[i]->b_end_io = end_buffer_read_sync;
submit_bh(READ, bh[i]);
-@@ -1703,6 +1708,10 @@ static int ext3_mb_good_group(struct ext
+@@ -1733,6 +1738,10 @@ static int ext3_mb_good_group(struct ext
switch (cr) {
case 0:
BUG_ON(ac->ac_2order == 0);
bits = ac->ac_sb->s_blocksize_bits + 1;
for (i = ac->ac_2order; i <= bits; i++)
if (grp->bb_counters[i] > 0)
-@@ -1796,7 +1805,9 @@ repeat:
+@@ -1826,7 +1835,9 @@ repeat:
}
ac->ac_groups_scanned++;
ext3_mb_simple_scan_group(ac, &e3b);
else if (cr == 1 && ac->ac_g_ex.fe_len == sbi->s_stripe)
ext3_mb_scan_aligned(ac, &e3b);
-@@ -2267,12 +2278,13 @@ int ext3_mb_init_backend(struct super_bl
+@@ -2306,12 +2317,13 @@ int ext3_mb_init_backend(struct super_bl
i--;
goto err_freebuddy;
}
set_bit(EXT3_GROUP_INFO_NEED_INIT_BIT,
&meta_group_info[j]->bb_state);
-@@ -2936,9 +2948,17 @@ int ext3_mb_mark_diskspace_used(struct e
- mb_set_bits(bitmap_bh->b_data, ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
+@@ -2945,9 +2957,17 @@ int ext3_mb_mark_diskspace_used(struct e
+ ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
spin_lock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
+ if (gdp->bg_flags & cpu_to_le16(EXT3_BG_BLOCK_UNINIT)) {
spin_unlock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, - ac->ac_b_ex.fe_len);
-@@ -4303,6 +4323,7 @@ do_more:
+@@ -4357,6 +4377,7 @@ do_more:
spin_lock(sb_bgl_lock(sbi, block_group));
gdp->bg_free_blocks_count =
cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count) + count);
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
-Index: linux-2.6.16.27-0.9-full/fs/ext3/balloc.c
+Index: linux-2.6.16.54-0.2.5/fs/ext3/balloc.c
===================================================================
---- linux-2.6.16.27-0.9-full.orig/fs/ext3/balloc.c 2007-03-28 16:03:20.000000000 +0400
-+++ linux-2.6.16.27-0.9-full/fs/ext3/balloc.c 2007-03-28 18:30:06.000000000 +0400
+--- linux-2.6.16.54-0.2.5.orig/fs/ext3/balloc.c
++++ linux-2.6.16.54-0.2.5/fs/ext3/balloc.c
@@ -21,6 +21,7 @@
#include <linux/quotaops.h>
#include <linux/buffer_head.h>
/*
* balloc.c contains the blocks allocation and deallocation routines
*/
-@@ -74,6 +75,75 @@ struct ext3_group_desc * ext3_get_group_
+@@ -74,6 +75,83 @@ struct ext3_group_desc * ext3_get_group_
return desc + offset;
}
+ for (bit = le32_to_cpu(gdp->bg_inode_table) - start,
+ bit_max = bit + sbi->s_itb_per_group; bit < bit_max; bit++)
+ ext3_set_bit(bit, bh->b_data);
++
++ /*
++ * Also if the number of blocks within the group is
++ * less than the blocksize * 8 ( which is the size
++ * of bitmap ), set rest of the block bitmap to 1
++ */
++ mark_bitmap_end(EXT3_BLOCKS_PER_GROUP(sb), sb->s_blocksize * 8,
++ bh->b_data);
+ }
+
+ return free_blocks - sbi->s_itb_per_group - 2;
/*
* Read the bitmap for a given block_group, reading into the specified
* slot in the superblock's bitmap cache.
-@@ -89,7 +159,19 @@ read_block_bitmap(struct super_block *sb
+@@ -89,7 +167,19 @@ read_block_bitmap(struct super_block *sb
desc = ext3_get_group_desc (sb, block_group, NULL);
if (!desc)
goto error_out;
if (!bh)
ext3_error (sb, "read_block_bitmap",
"Cannot read block bitmap - "
-@@ -468,6 +550,7 @@ do_more:
+@@ -468,6 +558,7 @@ do_more:
desc->bg_free_blocks_count =
cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) +
group_freed);
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
-@@ -1378,8 +1461,11 @@ allocated:
+@@ -1378,8 +1469,11 @@ allocated:
ret_block, goal_hits, goal_attempts);
spin_lock(sb_bgl_lock(sbi, group_no));
spin_unlock(sb_bgl_lock(sbi, group_no));
percpu_counter_mod(&sbi->s_freeblocks_counter, -1);
-
-%diffstat
- fs/ext3/balloc.c | 88 +++++++++++++++++++++++++++++
- fs/ext3/group.h | 38 ++++++++++++
- fs/ext3/ialloc.c | 144 +++++++++++++++++++++++++++++++++++++++++++-----
- fs/ext3/mballoc.c | 35 +++++++++--
- fs/ext3/resize.c | 2
- fs/ext3/super.c | 92 ++++++++++++++++++++++++++++++
- include/linux/ext3_fs.h | 16 ++++-
- 7 files changed, 388 insertions(+), 27 deletions(-)
A checksum of each group descriptor is used to ensure that corruption in
the group descriptor's bit flags does not cause incorrect operation.
-Index: linux-2.6.5-7.283-full/include/linux/ext3_fs.h
+Index: linux-2.6.5-7.311/include/linux/ext3_fs.h
===================================================================
---- linux-2.6.5-7.283-full.orig/include/linux/ext3_fs.h 2007-03-28 17:33:05.000000000 +0400
-+++ linux-2.6.5-7.283-full/include/linux/ext3_fs.h 2007-03-28 18:33:35.000000000 +0400
+--- linux-2.6.5-7.311.orig/include/linux/ext3_fs.h
++++ linux-2.6.5-7.311/include/linux/ext3_fs.h
@@ -153,16 +153,22 @@ struct ext3_allocation_request {
*/
struct ext3_group_desc
/*
* Macro-instructions used to manage group descriptors
*/
-@@ -458,7 +464,7 @@ struct ext3_super_block {
+@@ -466,7 +472,7 @@ struct ext3_super_block {
*/
__u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
__u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
/*
* Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
*/
-@@ -546,6 +552,7 @@ static inline struct ext3_inode_info *EX
+@@ -554,6 +560,7 @@ static inline struct ext3_inode_info *EX
#define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
#define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
#define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
#define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
-@@ -562,6 +569,7 @@ static inline struct ext3_inode_info *EX
+@@ -570,6 +577,7 @@ static inline struct ext3_inode_info *EX
EXT3_FEATURE_INCOMPAT_EXTENTS)
#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
-Index: linux-2.6.5-7.283-full/fs/ext3/super.c
+Index: linux-2.6.5-7.311/fs/ext3/super.c
===================================================================
---- linux-2.6.5-7.283-full.orig/fs/ext3/super.c 2007-03-28 17:33:05.000000000 +0400
-+++ linux-2.6.5-7.283-full/fs/ext3/super.c 2007-03-28 18:33:35.000000000 +0400
+--- linux-2.6.5-7.311.orig/fs/ext3/super.c
++++ linux-2.6.5-7.311/fs/ext3/super.c
@@ -36,6 +36,7 @@
#include <linux/quotaops.h>
#include "xattr.h"
static int ext3_load_journal(struct super_block *, struct ext3_super_block *);
static int ext3_create_journal(struct super_block *, struct ext3_super_block *,
-@@ -996,6 +997,90 @@ static int ext3_setup_super(struct super
+@@ -998,6 +999,90 @@ static int ext3_setup_super(struct super
return res;
}
static int ext3_check_descriptors (struct super_block * sb)
{
struct ext3_sb_info *sbi = EXT3_SB(sb);
-@@ -1044,6 +1129,13 @@ static int ext3_check_descriptors (struc
+@@ -1046,6 +1131,13 @@ static int ext3_check_descriptors (struc
le32_to_cpu(gdp->bg_inode_table));
return 0;
}
block += EXT3_BLOCKS_PER_GROUP(sb);
gdp++;
}
-Index: linux-2.6.5-7.283-full/fs/ext3/group.h
+Index: linux-2.6.5-7.311/fs/ext3/group.h
===================================================================
---- linux-2.6.5-7.283-full.orig/fs/ext3/group.h 2007-02-13 18:39:59.640066087 +0300
-+++ linux-2.6.5-7.283-full/fs/ext3/group.h 2007-03-28 18:33:35.000000000 +0400
-@@ -0,0 +1,29 @@
+--- /dev/null
++++ linux-2.6.5-7.311/fs/ext3/group.h
+@@ -0,0 +1,30 @@
+/*
+ * linux/fs/ext3/group.h
+ *
+extern unsigned ext3_init_inode_bitmap(struct super_block *sb,
+ struct buffer_head *bh, int group,
+ struct ext3_group_desc *desc);
++extern void mark_bitmap_end(int start_bit, int end_bit, char *bitmap);
+#endif /* _LINUX_EXT3_GROUP_H */
-Index: linux-2.6.5-7.283-full/fs/ext3/ialloc.c
+Index: linux-2.6.5-7.311/fs/ext3/ialloc.c
===================================================================
---- linux-2.6.5-7.283-full.orig/fs/ext3/ialloc.c 2007-03-28 17:33:03.000000000 +0400
-+++ linux-2.6.5-7.283-full/fs/ext3/ialloc.c 2007-03-28 18:33:35.000000000 +0400
+--- linux-2.6.5-7.311.orig/fs/ext3/ialloc.c
++++ linux-2.6.5-7.311/fs/ext3/ialloc.c
@@ -28,6 +28,7 @@
#include "xattr.h"
+ * need to use it within a single byte (to ensure we get endianness right).
+ * We can use memset for the rest of the bitmap as there are no other users.
+ */
-+static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
++void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
+{
+ int i;
+
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_inc(&sbi->s_freeinodes_counter);
if (is_directory)
-@@ -454,7 +514,7 @@ struct inode *ext3_new_inode(handle_t *h
+@@ -453,7 +513,7 @@ struct inode *ext3_new_inode(handle_t *h
struct ext3_sb_info *sbi;
int err = 0;
struct inode *ret;
/* Cannot create files in a deleted directory */
if (!dir || !dir->i_nlink)
-@@ -570,11 +630,13 @@ repeat_in_this_group:
+@@ -569,11 +629,13 @@ repeat_in_this_group:
goto out;
got:
err = -EIO;
goto fail;
}
-@@ -582,13 +644,65 @@ got:
+@@ -581,13 +643,65 @@ got:
BUFFER_TRACE(bh2, "get_write_access");
err = ext3_journal_get_write_access(handle, bh2);
if (err) goto fail;
spin_unlock(sb_bgl_lock(sbi, group));
BUFFER_TRACE(bh2, "call ext3_journal_dirty_metadata");
err = ext3_journal_dirty_metadata(handle, bh2);
-@@ -610,7 +724,7 @@ got:
+@@ -609,7 +723,7 @@ got:
inode->i_gid = current->fsgid;
inode->i_mode = mode;
/* This is the optimal IO size (for stat), not the fs block size */
inode->i_blksize = PAGE_SIZE;
inode->i_blocks = 0;
-Index: linux-2.6.5-7.283-full/fs/ext3/mballoc.c
+Index: linux-2.6.5-7.311/fs/ext3/mballoc.c
===================================================================
---- linux-2.6.5-7.283-full.orig/fs/ext3/mballoc.c 2007-03-28 15:46:00.000000000 +0400
-+++ linux-2.6.5-7.283-full/fs/ext3/mballoc.c 2007-03-28 18:33:35.000000000 +0400
+--- linux-2.6.5-7.311.orig/fs/ext3/mballoc.c
++++ linux-2.6.5-7.311/fs/ext3/mballoc.c
@@ -36,6 +36,8 @@
#include <linux/seq_file.h>
#include <linux/version.h>
unsigned short bb_first_free;
unsigned short bb_free;
unsigned short bb_fragments;
-@@ -928,10 +931,7 @@ static int ext3_mb_init_cache(struct pag
+@@ -943,10 +946,7 @@ static int ext3_mb_init_cache(struct pag
if (first_group + i >= EXT3_SB(sb)->s_groups_count)
break;
err = -ENOMEM;
bh[i] = sb_getblk(sb, le32_to_cpu(desc->bg_block_bitmap));
-@@ -946,7 +946,12 @@ static int ext3_mb_init_cache(struct pag
+@@ -961,7 +961,12 @@ static int ext3_mb_init_cache(struct pag
unlock_buffer(bh[i]);
continue;
}
get_bh(bh[i]);
bh[i]->b_end_io = end_buffer_read_sync;
submit_bh(READ, bh[i]);
-@@ -1703,6 +1708,10 @@ static int ext3_mb_good_group(struct ext
+@@ -1733,6 +1738,10 @@ static int ext3_mb_good_group(struct ext
switch (cr) {
case 0:
BUG_ON(ac->ac_2order == 0);
bits = ac->ac_sb->s_blocksize_bits + 1;
for (i = ac->ac_2order; i <= bits; i++)
if (grp->bb_counters[i] > 0)
-@@ -1796,7 +1805,9 @@ repeat:
+@@ -1826,7 +1835,9 @@ repeat:
}
ac->ac_groups_scanned++;
ext3_mb_simple_scan_group(ac, &e3b);
else if (cr == 1 && ac->ac_g_ex.fe_len == sbi->s_stripe)
ext3_mb_scan_aligned(ac, &e3b);
-@@ -2267,12 +2278,13 @@ int ext3_mb_init_backend(struct super_bl
+@@ -2306,12 +2317,13 @@ int ext3_mb_init_backend(struct super_bl
i--;
goto err_freebuddy;
}
set_bit(EXT3_GROUP_INFO_NEED_INIT_BIT,
&meta_group_info[j]->bb_state);
-@@ -2936,9 +2948,17 @@ int ext3_mb_mark_diskspace_used(struct e
- mb_set_bits(bitmap_bh->b_data, ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
+@@ -2945,9 +2957,17 @@ int ext3_mb_mark_diskspace_used(struct e
+ ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
spin_lock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
+ if (gdp->bg_flags & cpu_to_le16(EXT3_BG_BLOCK_UNINIT)) {
spin_unlock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, - ac->ac_b_ex.fe_len);
-@@ -4303,6 +4323,7 @@ do_more:
+@@ -4357,6 +4377,7 @@ do_more:
spin_lock(sb_bgl_lock(sbi, block_group));
gdp->bg_free_blocks_count =
cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count) + count);
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
-Index: linux-2.6.5-7.283-full/fs/ext3/balloc.c
+Index: linux-2.6.5-7.311/fs/ext3/balloc.c
===================================================================
---- linux-2.6.5-7.283-full.orig/fs/ext3/balloc.c 2007-03-28 17:33:02.000000000 +0400
-+++ linux-2.6.5-7.283-full/fs/ext3/balloc.c 2007-03-28 18:33:35.000000000 +0400
+--- linux-2.6.5-7.311.orig/fs/ext3/balloc.c
++++ linux-2.6.5-7.311/fs/ext3/balloc.c
@@ -20,6 +20,7 @@
#include <linux/quotaops.h>
#include <linux/buffer_head.h>
/*
* balloc.c contains the blocks allocation and deallocation routines
*/
-@@ -72,6 +73,75 @@ struct ext3_group_desc * ext3_get_group_
+@@ -72,6 +73,83 @@ struct ext3_group_desc * ext3_get_group_
return gdp + desc;
}
+ for (bit = le32_to_cpu(gdp->bg_inode_table) - start,
+ bit_max = bit + sbi->s_itb_per_group; bit < bit_max; bit++)
+ ext3_set_bit(bit, bh->b_data);
++
++ /*
++ * Also if the number of blocks within the group is
++ * less than the blocksize * 8 ( which is the size
++ * of bitmap ), set rest of the block bitmap to 1
++ */
++ mark_bitmap_end(EXT3_BLOCKS_PER_GROUP(sb), sb->s_blocksize * 8,
++ bh->b_data);
+ }
+
+ return free_blocks - sbi->s_itb_per_group - 2;
/*
* Read the bitmap for a given block_group, reading into the specified
* slot in the superblock's bitmap cache.
-@@ -87,7 +157,19 @@ read_block_bitmap(struct super_block *sb
+@@ -87,7 +165,19 @@ read_block_bitmap(struct super_block *sb
desc = ext3_get_group_desc (sb, block_group, NULL);
if (!desc)
goto error_out;
if (!bh)
ext3_error (sb, "read_block_bitmap",
"Cannot read block bitmap - "
-@@ -432,6 +514,7 @@ do_more:
+@@ -432,6 +522,7 @@ do_more:
gdp->bg_free_blocks_count =
cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count) +
dquot_freed_blocks);
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
-@@ -1372,8 +1455,11 @@ allocated:
+@@ -1372,8 +1463,11 @@ allocated:
ret_block, goal_hits, goal_attempts);
spin_lock(sb_bgl_lock(sbi, group_no));
A checksum of each group descriptor is used to ensure that corruption in
the group descriptor's bit flags does not cause incorrect operation.
-Index: linux-rhel5/include/linux/ext3_fs.h
+Index: linux-2.6.18-53.1.14/include/linux/ext3_fs.h
===================================================================
---- linux-rhel5.orig/include/linux/ext3_fs.h 2007-07-18 17:32:04.000000000 +0200
-+++ linux-rhel5/include/linux/ext3_fs.h 2007-07-18 17:32:15.000000000 +0200
+--- linux-2.6.18-53.1.14.orig/include/linux/ext3_fs.h
++++ linux-2.6.18-53.1.14/include/linux/ext3_fs.h
@@ -150,16 +150,22 @@ struct ext3_allocation_request {
*/
struct ext3_group_desc
EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
-Index: linux-rhel5/fs/ext3/resize.c
+Index: linux-2.6.18-53.1.14/fs/ext3/resize.c
===================================================================
---- linux-rhel5.orig/fs/ext3/resize.c 2007-07-15 09:36:00.000000000 +0200
-+++ linux-rhel5/fs/ext3/resize.c 2007-07-18 17:32:15.000000000 +0200
+--- linux-2.6.18-53.1.14.orig/fs/ext3/resize.c
++++ linux-2.6.18-53.1.14/fs/ext3/resize.c
@@ -18,6 +18,7 @@
#include <linux/errno.h>
#include <linux/slab.h>
#define outside(b, first, last) ((b) < (first) || (b) >= (last))
#define inside(b, first, last) ((b) >= (first) && (b) < (last))
-@@ -834,6 +835,7 @@ int ext3_group_add(struct super_block *s
+@@ -137,25 +138,6 @@ static struct buffer_head *bclean(handle
+ }
+
+ /*
+- * To avoid calling the atomic setbit hundreds or thousands of times, we only
+- * need to use it within a single byte (to ensure we get endianness right).
+- * We can use memset for the rest of the bitmap as there are no other users.
+- */
+-static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
+-{
+- int i;
+-
+- if (start_bit >= end_bit)
+- return;
+-
+- ext3_debug("mark end bits +%d through +%d used\n", start_bit, end_bit);
+- for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++)
+- ext3_set_bit(i, bitmap);
+- if (i < end_bit)
+- memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3);
+-}
+-
+-/*
+ * Set up the block and inode bitmaps, and the inode table for the new group.
+ * This doesn't need to be part of the main transaction, since we are only
+ * changing blocks outside the actual filesystem. We still do journaling to
+@@ -834,6 +816,7 @@ int ext3_group_add(struct super_block *s
gdp->bg_inode_table = cpu_to_le32(input->inode_table);
gdp->bg_free_blocks_count = cpu_to_le16(input->free_blocks_count);
gdp->bg_free_inodes_count = cpu_to_le16(EXT3_INODES_PER_GROUP(sb));
/*
* Make the new blocks and inodes valid next. We do this before
-Index: linux-rhel5/fs/ext3/super.c
+Index: linux-2.6.18-53.1.14/fs/ext3/super.c
===================================================================
---- linux-rhel5.orig/fs/ext3/super.c 2007-07-18 17:32:06.000000000 +0200
-+++ linux-rhel5/fs/ext3/super.c 2007-07-18 17:35:03.000000000 +0200
+--- linux-2.6.18-53.1.14.orig/fs/ext3/super.c
++++ linux-2.6.18-53.1.14/fs/ext3/super.c
@@ -41,6 +41,7 @@
#include "xattr.h"
#include "acl.h"
static int ext3_load_journal(struct super_block *, struct ext3_super_block *,
unsigned long journal_devnum);
-@@ -1225,6 +1226,91 @@ static int ext3_setup_super(struct super
+@@ -1227,6 +1228,91 @@ static int ext3_setup_super(struct super
return res;
}
/* Called at mount-time, super-block is locked */
static int ext3_check_descriptors (struct super_block * sb)
{
-@@ -1279,6 +1365,13 @@ static int ext3_check_descriptors (struc
+@@ -1281,6 +1367,13 @@ static int ext3_check_descriptors (struc
le32_to_cpu(gdp->bg_inode_table));
return 0;
}
first_block += EXT3_BLOCKS_PER_GROUP(sb);
gdp++;
}
-Index: linux-rhel5/fs/ext3/group.h
+Index: linux-2.6.18-53.1.14/fs/ext3/group.h
===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-rhel5/fs/ext3/group.h 2007-07-18 17:32:15.000000000 +0200
-@@ -0,0 +1,29 @@
+--- /dev/null
++++ linux-2.6.18-53.1.14/fs/ext3/group.h
+@@ -0,0 +1,30 @@
+/*
+ * linux/fs/ext3/group.h
+ *
+extern unsigned ext3_init_inode_bitmap(struct super_block *sb,
+ struct buffer_head *bh, int group,
+ struct ext3_group_desc *desc);
++extern void mark_bitmap_end(int start_bit, int end_bit, char *bitmap);
+#endif /* _LINUX_EXT3_GROUP_H */
-Index: linux-rhel5/fs/ext3/ialloc.c
+Index: linux-2.6.18-53.1.14/fs/ext3/ialloc.c
===================================================================
---- linux-rhel5.orig/fs/ext3/ialloc.c 2007-07-18 17:32:05.000000000 +0200
-+++ linux-rhel5/fs/ext3/ialloc.c 2007-07-18 17:32:15.000000000 +0200
+--- linux-2.6.18-53.1.14.orig/fs/ext3/ialloc.c
++++ linux-2.6.18-53.1.14/fs/ext3/ialloc.c
@@ -28,6 +28,7 @@
#include "xattr.h"
+ * need to use it within a single byte (to ensure we get endianness right).
+ * We can use memset for the rest of the bitmap as there are no other users.
+ */
-+static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
++void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
+{
+ int i;
+
/* This is the optimal IO size (for stat), not the fs block size */
inode->i_blocks = 0;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
-Index: linux-rhel5/fs/ext3/mballoc.c
+Index: linux-2.6.18-53.1.14/fs/ext3/mballoc.c
===================================================================
---- linux-rhel5.orig/fs/ext3/mballoc.c 2007-07-18 17:32:04.000000000 +0200
-+++ linux-rhel5/fs/ext3/mballoc.c 2007-07-18 17:32:15.000000000 +0200
+--- linux-2.6.18-53.1.14.orig/fs/ext3/mballoc.c
++++ linux-2.6.18-53.1.14/fs/ext3/mballoc.c
@@ -36,6 +36,8 @@
#include <linux/seq_file.h>
#include <linux/version.h>
unsigned short bb_first_free;
unsigned short bb_free;
unsigned short bb_fragments;
-@@ -943,10 +946,7 @@ static int ext3_mb_init_cache(struct pag
+@@ -941,10 +944,7 @@ static int ext3_mb_init_cache(struct pag
if (first_group + i >= EXT3_SB(sb)->s_groups_count)
break;
err = -ENOMEM;
bh[i] = sb_getblk(sb, le32_to_cpu(desc->bg_block_bitmap));
-@@ -961,7 +961,12 @@ static int ext3_mb_init_cache(struct pag
+@@ -959,7 +959,12 @@ static int ext3_mb_init_cache(struct pag
unlock_buffer(bh[i]);
continue;
}
get_bh(bh[i]);
bh[i]->b_end_io = end_buffer_read_sync;
submit_bh(READ, bh[i]);
-@@ -1732,6 +1737,10 @@ static int ext3_mb_good_group(struct ext
+@@ -1731,6 +1736,10 @@ static int ext3_mb_good_group(struct ext
switch (cr) {
case 0:
BUG_ON(ac->ac_2order == 0);
bits = ac->ac_sb->s_blocksize_bits + 1;
for (i = ac->ac_2order; i <= bits; i++)
if (grp->bb_counters[i] > 0)
-@@ -1825,7 +1834,9 @@ repeat:
+@@ -1824,7 +1833,9 @@ repeat:
}
ac->ac_groups_scanned++;
set_bit(EXT3_GROUP_INFO_NEED_INIT_BIT,
&meta_group_info[j]->bb_state);
-@@ -2958,9 +2970,17 @@ int ext3_mb_mark_diskspace_used(struct e
- mb_set_bits(bitmap_bh->b_data, ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
+@@ -2943,9 +2955,17 @@ int ext3_mb_mark_diskspace_used(struct e
+ ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
spin_lock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
+ if (gdp->bg_flags & cpu_to_le16(EXT3_BG_BLOCK_UNINIT)) {
spin_unlock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, - ac->ac_b_ex.fe_len);
-@@ -4346,6 +4366,7 @@ do_more:
+@@ -4355,6 +4375,7 @@ do_more:
spin_lock(sb_bgl_lock(sbi, block_group));
gdp->bg_free_blocks_count =
cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count) + count);
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
-Index: linux-rhel5/fs/ext3/balloc.c
+Index: linux-2.6.18-53.1.14/fs/ext3/balloc.c
===================================================================
---- linux-rhel5.orig/fs/ext3/balloc.c 2007-07-18 17:32:04.000000000 +0200
-+++ linux-rhel5/fs/ext3/balloc.c 2007-07-18 17:32:15.000000000 +0200
+--- linux-2.6.18-53.1.14.orig/fs/ext3/balloc.c
++++ linux-2.6.18-53.1.14/fs/ext3/balloc.c
@@ -20,6 +20,7 @@
#include <linux/quotaops.h>
#include <linux/buffer_head.h>
/*
* balloc.c contains the blocks allocation and deallocation routines
*/
-@@ -73,6 +74,75 @@ struct ext3_group_desc * ext3_get_group_
+@@ -73,6 +74,83 @@ struct ext3_group_desc * ext3_get_group_
return desc + offset;
}
+ for (bit = le32_to_cpu(gdp->bg_inode_table) - start,
+ bit_max = bit + sbi->s_itb_per_group; bit < bit_max; bit++)
+ ext3_set_bit(bit, bh->b_data);
++
++ /*
++ * Also if the number of blocks within the group is
++ * less than the blocksize * 8 ( which is the size
++ * of bitmap ), set rest of the block bitmap to 1
++ */
++ mark_bitmap_end(EXT3_BLOCKS_PER_GROUP(sb), sb->s_blocksize * 8,
++ bh->b_data);
+ }
+
+ return free_blocks - sbi->s_itb_per_group - 2;
/*
* Read the bitmap for a given block_group, reading into the specified
* slot in the superblock's bitmap cache.
-@@ -88,7 +158,19 @@ read_block_bitmap(struct super_block *sb
+@@ -88,7 +166,19 @@ read_block_bitmap(struct super_block *sb
desc = ext3_get_group_desc (sb, block_group, NULL);
if (!desc)
goto error_out;
if (!bh)
ext3_error (sb, "read_block_bitmap",
"Cannot read block bitmap - "
-@@ -467,6 +549,7 @@ do_more:
+@@ -467,6 +557,7 @@ do_more:
desc->bg_free_blocks_count =
cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) +
group_freed);
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
-@@ -1434,8 +1517,11 @@ allocated:
+@@ -1434,8 +1525,11 @@ allocated:
ret_block, goal_hits, goal_attempts);
spin_lock(sb_bgl_lock(sbi, group_no));
A checksum of each group descriptor is used to ensure that corruption in
the group descriptor's bit flags does not cause incorrect operation.
-Index: linux-rhel5/include/linux/ext3_fs.h
+Index: linux-2.6.22.14/include/linux/ext3_fs.h
===================================================================
---- linux-rhel5.orig/include/linux/ext3_fs.h 2007-07-18 17:32:04.000000000 +0200
-+++ linux-rhel5/include/linux/ext3_fs.h 2007-07-18 17:32:15.000000000 +0200
-@@ -150,16 +150,22 @@ struct ext3_allocation_request {
+--- linux-2.6.22.14.orig/include/linux/ext3_fs.h
++++ linux-2.6.22.14/include/linux/ext3_fs.h
+@@ -146,16 +146,22 @@ struct ext3_allocation_request {
*/
struct ext3_group_desc
{
/*
* Macro-instructions used to manage group descriptors
*/
-@@ -603,6 +609,7 @@ static inline int ext3_valid_inum(struct
+@@ -617,6 +623,7 @@ static inline int ext3_valid_inum(struct
#define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
#define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
#define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
#define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
-@@ -619,6 +626,7 @@ static inline int ext3_valid_inum(struct
+@@ -633,6 +640,7 @@ static inline int ext3_valid_inum(struct
EXT3_FEATURE_INCOMPAT_EXTENTS)
#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
-Index: linux-rhel5/fs/ext3/resize.c
+Index: linux-2.6.22.14/fs/ext3/resize.c
===================================================================
---- linux-rhel5.orig/fs/ext3/resize.c 2007-07-15 09:36:00.000000000 +0200
-+++ linux-rhel5/fs/ext3/resize.c 2007-07-18 17:32:15.000000000 +0200
-@@ -18,6 +18,7 @@
+--- linux-2.6.22.14.orig/fs/ext3/resize.c
++++ linux-2.6.22.14/fs/ext3/resize.c
+@@ -16,6 +16,7 @@
#include <linux/errno.h>
#include <linux/slab.h>
#define outside(b, first, last) ((b) < (first) || (b) >= (last))
#define inside(b, first, last) ((b) >= (first) && (b) < (last))
-@@ -834,6 +835,7 @@ int ext3_group_add(struct super_block *s
+@@ -135,25 +136,6 @@ static struct buffer_head *bclean(handle
+ }
+
+ /*
+- * To avoid calling the atomic setbit hundreds or thousands of times, we only
+- * need to use it within a single byte (to ensure we get endianness right).
+- * We can use memset for the rest of the bitmap as there are no other users.
+- */
+-static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
+-{
+- int i;
+-
+- if (start_bit >= end_bit)
+- return;
+-
+- ext3_debug("mark end bits +%d through +%d used\n", start_bit, end_bit);
+- for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++)
+- ext3_set_bit(i, bitmap);
+- if (i < end_bit)
+- memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3);
+-}
+-
+-/*
+ * Set up the block and inode bitmaps, and the inode table for the new group.
+ * This doesn't need to be part of the main transaction, since we are only
+ * changing blocks outside the actual filesystem. We still do journaling to
+@@ -833,6 +815,7 @@ int ext3_group_add(struct super_block *s
gdp->bg_inode_table = cpu_to_le32(input->inode_table);
gdp->bg_free_blocks_count = cpu_to_le16(input->free_blocks_count);
gdp->bg_free_inodes_count = cpu_to_le16(EXT3_INODES_PER_GROUP(sb));
/*
* Make the new blocks and inodes valid next. We do this before
-Index: linux-rhel5/fs/ext3/super.c
+Index: linux-2.6.22.14/fs/ext3/super.c
===================================================================
---- linux-rhel5.orig/fs/ext3/super.c 2007-07-18 17:32:06.000000000 +0200
-+++ linux-rhel5/fs/ext3/super.c 2007-07-18 17:35:03.000000000 +0200
+--- linux-2.6.22.14.orig/fs/ext3/super.c
++++ linux-2.6.22.14/fs/ext3/super.c
@@ -41,6 +41,7 @@
#include "xattr.h"
#include "acl.h"
static int ext3_load_journal(struct super_block *, struct ext3_super_block *,
unsigned long journal_devnum);
-@@ -1225,6 +1226,91 @@ static int ext3_setup_super(struct super
+@@ -1224,6 +1225,91 @@ static int ext3_setup_super(struct super
return res;
}
/* Called at mount-time, super-block is locked */
static int ext3_check_descriptors (struct super_block * sb)
{
-@@ -1279,6 +1365,13 @@ static int ext3_check_descriptors (struc
+@@ -1278,6 +1364,13 @@ static int ext3_check_descriptors (struc
le32_to_cpu(gdp->bg_inode_table));
return 0;
}
first_block += EXT3_BLOCKS_PER_GROUP(sb);
gdp++;
}
-Index: linux-rhel5/fs/ext3/group.h
+Index: linux-2.6.22.14/fs/ext3/group.h
===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-rhel5/fs/ext3/group.h 2007-07-18 17:32:15.000000000 +0200
-@@ -0,0 +1,29 @@
+--- /dev/null
++++ linux-2.6.22.14/fs/ext3/group.h
+@@ -0,0 +1,30 @@
+/*
+ * linux/fs/ext3/group.h
+ *
+extern unsigned ext3_init_inode_bitmap(struct super_block *sb,
+ struct buffer_head *bh, int group,
+ struct ext3_group_desc *desc);
++extern void mark_bitmap_end(int start_bit, int end_bit, char *bitmap);
+#endif /* _LINUX_EXT3_GROUP_H */
-Index: linux-rhel5/fs/ext3/ialloc.c
+Index: linux-2.6.22.14/fs/ext3/ialloc.c
===================================================================
---- linux-rhel5.orig/fs/ext3/ialloc.c 2007-07-18 17:32:05.000000000 +0200
-+++ linux-rhel5/fs/ext3/ialloc.c 2007-07-18 17:32:15.000000000 +0200
+--- linux-2.6.22.14.orig/fs/ext3/ialloc.c
++++ linux-2.6.22.14/fs/ext3/ialloc.c
@@ -28,6 +28,7 @@
#include "xattr.h"
+ * need to use it within a single byte (to ensure we get endianness right).
+ * We can use memset for the rest of the bitmap as there are no other users.
+ */
-+static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
++void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
+{
+ int i;
+
/* This is the optimal IO size (for stat), not the fs block size */
inode->i_blocks = 0;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
-Index: linux-rhel5/fs/ext3/mballoc.c
+Index: linux-2.6.22.14/fs/ext3/mballoc.c
===================================================================
---- linux-rhel5.orig/fs/ext3/mballoc.c 2007-07-18 17:32:04.000000000 +0200
-+++ linux-rhel5/fs/ext3/mballoc.c 2007-07-18 17:32:15.000000000 +0200
+--- linux-2.6.22.14.orig/fs/ext3/mballoc.c
++++ linux-2.6.22.14/fs/ext3/mballoc.c
@@ -36,6 +36,8 @@
#include <linux/seq_file.h>
#include <linux/version.h>
get_bh(bh[i]);
bh[i]->b_end_io = end_buffer_read_sync;
submit_bh(READ, bh[i]);
-@@ -1732,6 +1737,10 @@ static int ext3_mb_good_group(struct ext
+@@ -1733,6 +1738,10 @@ static int ext3_mb_good_group(struct ext
switch (cr) {
case 0:
BUG_ON(ac->ac_2order == 0);
bits = ac->ac_sb->s_blocksize_bits + 1;
for (i = ac->ac_2order; i <= bits; i++)
if (grp->bb_counters[i] > 0)
-@@ -1825,7 +1834,9 @@ repeat:
+@@ -1826,7 +1835,9 @@ repeat:
}
ac->ac_groups_scanned++;
ext3_mb_simple_scan_group(ac, &e3b);
else if (cr == 1 && ac->ac_g_ex.fe_len == sbi->s_stripe)
ext3_mb_scan_aligned(ac, &e3b);
-@@ -2304,12 +2315,13 @@ int ext3_mb_init_backend(struct super_bl
+@@ -2306,12 +2317,13 @@ int ext3_mb_init_backend(struct super_bl
i--;
goto err_freebuddy;
}
set_bit(EXT3_GROUP_INFO_NEED_INIT_BIT,
&meta_group_info[j]->bb_state);
-@@ -2958,9 +2970,17 @@ int ext3_mb_mark_diskspace_used(struct e
- mb_set_bits(bitmap_bh->b_data, ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
+@@ -2945,9 +2957,17 @@ int ext3_mb_mark_diskspace_used(struct e
+ ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
spin_lock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
+ if (gdp->bg_flags & cpu_to_le16(EXT3_BG_BLOCK_UNINIT)) {
spin_unlock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, - ac->ac_b_ex.fe_len);
-@@ -4346,6 +4366,7 @@ do_more:
+@@ -4357,6 +4377,7 @@ do_more:
spin_lock(sb_bgl_lock(sbi, block_group));
gdp->bg_free_blocks_count =
cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count) + count);
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
-Index: linux-rhel5/fs/ext3/balloc.c
+Index: linux-2.6.22.14/fs/ext3/balloc.c
===================================================================
---- linux-rhel5.orig/fs/ext3/balloc.c 2007-07-18 17:32:04.000000000 +0200
-+++ linux-rhel5/fs/ext3/balloc.c 2007-07-18 17:32:15.000000000 +0200
-@@ -20,6 +20,7 @@
+--- linux-2.6.22.14.orig/fs/ext3/balloc.c
++++ linux-2.6.22.14/fs/ext3/balloc.c
+@@ -20,10 +20,88 @@
#include <linux/quotaops.h>
#include <linux/buffer_head.h>
/*
* balloc.c contains the blocks allocation and deallocation routines
*/
-@@ -73,6 +74,75 @@ struct ext3_group_desc * ext3_get_group_
- return desc + offset;
- }
+/* Initializes an uninitialized block bitmap if given, and returns the
+ * number of blocks free in the group. */
+ for (bit = le32_to_cpu(gdp->bg_inode_table) - start,
+ bit_max = bit + sbi->s_itb_per_group; bit < bit_max; bit++)
+ ext3_set_bit(bit, bh->b_data);
++
++ /*
++ * Also if the number of blocks within the group is
++ * less than the blocksize * 8 ( which is the size
++ * of bitmap ), set rest of the block bitmap to 1
++ */
++ mark_bitmap_end(EXT3_BLOCKS_PER_GROUP(sb), sb->s_blocksize * 8,
++ bh->b_data);
+ }
+
+ return free_blocks - sbi->s_itb_per_group - 2;
+}
+
/*
- * Read the bitmap for a given block_group, reading into the specified
- * slot in the superblock's bitmap cache.
-@@ -88,7 +158,19 @@ read_block_bitmap(struct super_block *sb
+ * The free blocks are managed by bitmaps. A file system contains several
+ * blocks groups. Each group contains 1 bitmap block for blocks, 1 bitmap
+@@ -99,7 +177,19 @@ read_block_bitmap(struct super_block *sb
desc = ext3_get_group_desc (sb, block_group, NULL);
if (!desc)
goto error_out;
if (!bh)
ext3_error (sb, "read_block_bitmap",
"Cannot read block bitmap - "
-@@ -467,6 +549,7 @@ do_more:
+@@ -571,6 +661,7 @@ do_more:
desc->bg_free_blocks_count =
cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) +
group_freed);
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
-@@ -1434,8 +1517,11 @@ allocated:
+@@ -1637,8 +1728,11 @@ allocated:
ret_block, goal_hits, goal_attempts);
spin_lock(sb_bgl_lock(sbi, group_no));
A checksum of each group descriptor is used to ensure that corruption in
the group descriptor's bit flags does not cause incorrect operation.
-Index: linux-2.6.9-full/include/linux/ext3_fs.h
+Index: linux-2.6.9-67.0.15/include/linux/ext3_fs.h
===================================================================
---- linux-2.6.9-full.orig/include/linux/ext3_fs.h 2007-03-28 18:35:41.000000000 +0400
-+++ linux-2.6.9-full/include/linux/ext3_fs.h 2007-03-28 18:36:16.000000000 +0400
+--- linux-2.6.9-67.0.15.orig/include/linux/ext3_fs.h
++++ linux-2.6.9-67.0.15/include/linux/ext3_fs.h
@@ -153,16 +153,22 @@ struct ext3_allocation_request {
*/
struct ext3_group_desc
/*
* Macro-instructions used to manage group descriptors
*/
-@@ -572,6 +578,7 @@ static inline struct ext3_inode_info *EX
+@@ -580,6 +586,7 @@ static inline struct ext3_inode_info *EX
#define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
#define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
#define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
#define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
-@@ -588,6 +595,7 @@ static inline struct ext3_inode_info *EX
+@@ -596,6 +603,7 @@ static inline struct ext3_inode_info *EX
EXT3_FEATURE_INCOMPAT_EXTENTS)
#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
-Index: linux-2.6.9-full/fs/ext3/resize.c
+Index: linux-2.6.9-67.0.15/fs/ext3/resize.c
===================================================================
---- linux-2.6.9-full.orig/fs/ext3/resize.c 2006-03-10 18:20:03.000000000 +0300
-+++ linux-2.6.9-full/fs/ext3/resize.c 2007-03-28 18:36:16.000000000 +0400
+--- linux-2.6.9-67.0.15.orig/fs/ext3/resize.c
++++ linux-2.6.9-67.0.15/fs/ext3/resize.c
@@ -19,6 +19,7 @@
#include <linux/errno.h>
#include <linux/slab.h>
#define outside(b, first, last) ((b) < (first) || (b) >= (last))
#define inside(b, first, last) ((b) >= (first) && (b) < (last))
-@@ -807,6 +808,7 @@ int ext3_group_add(struct super_block *s
+@@ -132,25 +133,6 @@ static struct buffer_head *bclean(handle
+ }
+
+ /*
+- * To avoid calling the atomic setbit hundreds or thousands of times, we only
+- * need to use it within a single byte (to ensure we get endianness right).
+- * We can use memset for the rest of the bitmap as there are no other users.
+- */
+-static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
+-{
+- int i;
+-
+- if (start_bit >= end_bit)
+- return;
+-
+- ext3_debug("mark end bits +%d through +%d used\n", start_bit, end_bit);
+- for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++)
+- ext3_set_bit(i, bitmap);
+- if (i < end_bit)
+- memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3);
+-}
+-
+-/*
+ * Set up the block and inode bitmaps, and the inode table for the new group.
+ * This doesn't need to be part of the main transaction, since we are only
+ * changing blocks outside the actual filesystem. We still do journaling to
+@@ -807,6 +789,7 @@ int ext3_group_add(struct super_block *s
gdp->bg_inode_table = cpu_to_le32(input->inode_table);
gdp->bg_free_blocks_count = cpu_to_le16(input->free_blocks_count);
gdp->bg_free_inodes_count = cpu_to_le16(EXT3_INODES_PER_GROUP(sb));
/*
* Make the new blocks and inodes valid next. We do this before
-Index: linux-2.6.9-full/fs/ext3/super.c
+Index: linux-2.6.9-67.0.15/fs/ext3/super.c
===================================================================
---- linux-2.6.9-full.orig/fs/ext3/super.c 2007-03-28 18:35:42.000000000 +0400
-+++ linux-2.6.9-full/fs/ext3/super.c 2007-03-28 18:36:16.000000000 +0400
+--- linux-2.6.9-67.0.15.orig/fs/ext3/super.c
++++ linux-2.6.9-67.0.15/fs/ext3/super.c
@@ -38,6 +38,7 @@
#include <asm/uaccess.h>
#include "xattr.h"
#include "acl.h"
+#include "group.h"
- static int ext3_load_journal(struct super_block *, struct ext3_super_block *,
- unsigned long journal_devnum);
-@@ -1090,6 +1091,90 @@ static int ext3_setup_super(struct super
+ static int ext3_load_journal(struct super_block *, struct ext3_super_block *);
+ static int ext3_create_journal(struct super_block *, struct ext3_super_block *,
+@@ -1130,6 +1131,90 @@ static int ext3_setup_super(struct super
return res;
}
/* Called at mount-time, super-block is locked */
static int ext3_check_descriptors (struct super_block * sb)
{
-@@ -1139,6 +1224,13 @@ static int ext3_check_descriptors (struc
+@@ -1179,6 +1264,13 @@ static int ext3_check_descriptors (struc
le32_to_cpu(gdp->bg_inode_table));
return 0;
}
block += EXT3_BLOCKS_PER_GROUP(sb);
gdp++;
}
-Index: linux-2.6.9-full/fs/ext3/group.h
+Index: linux-2.6.9-67.0.15/fs/ext3/group.h
===================================================================
---- linux-2.6.9-full.orig/fs/ext3/group.h 2007-02-13 18:39:59.640066087 +0300
-+++ linux-2.6.9-full/fs/ext3/group.h 2007-03-28 18:36:16.000000000 +0400
-@@ -0,0 +1,29 @@
+--- /dev/null
++++ linux-2.6.9-67.0.15/fs/ext3/group.h
+@@ -0,0 +1,30 @@
+/*
+ * linux/fs/ext3/group.h
+ *
+extern unsigned ext3_init_inode_bitmap(struct super_block *sb,
+ struct buffer_head *bh, int group,
+ struct ext3_group_desc *desc);
++extern void mark_bitmap_end(int start_bit, int end_bit, char *bitmap);
+#endif /* _LINUX_EXT3_GROUP_H */
-Index: linux-2.6.9-full/fs/ext3/ialloc.c
+Index: linux-2.6.9-67.0.15/fs/ext3/ialloc.c
===================================================================
---- linux-2.6.9-full.orig/fs/ext3/ialloc.c 2007-03-28 18:35:38.000000000 +0400
-+++ linux-2.6.9-full/fs/ext3/ialloc.c 2007-03-28 18:36:16.000000000 +0400
+--- linux-2.6.9-67.0.15.orig/fs/ext3/ialloc.c
++++ linux-2.6.9-67.0.15/fs/ext3/ialloc.c
@@ -28,6 +28,7 @@
#include "xattr.h"
+ * need to use it within a single byte (to ensure we get endianness right).
+ * We can use memset for the rest of the bitmap as there are no other users.
+ */
-+static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
++void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
+{
+ int i;
+
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_inc(&sbi->s_freeinodes_counter);
if (is_directory)
-@@ -453,7 +513,7 @@ struct inode *ext3_new_inode(handle_t *h
+@@ -452,7 +512,7 @@ struct inode *ext3_new_inode(handle_t *h
struct ext3_sb_info *sbi;
int err = 0;
struct inode *ret;
/* Cannot create files in a deleted directory */
if (!dir || !dir->i_nlink)
-@@ -566,11 +626,13 @@ repeat_in_this_group:
+@@ -568,11 +628,13 @@ repeat_in_this_group:
goto out;
got:
err = -EIO;
goto fail;
}
-@@ -578,13 +640,65 @@ got:
+@@ -580,13 +642,65 @@ got:
BUFFER_TRACE(bh2, "get_write_access");
err = ext3_journal_get_write_access(handle, bh2);
if (err) goto fail;
spin_unlock(sb_bgl_lock(sbi, group));
BUFFER_TRACE(bh2, "call ext3_journal_dirty_metadata");
err = ext3_journal_dirty_metadata(handle, bh2);
-@@ -606,7 +720,7 @@ got:
+@@ -608,7 +722,7 @@ got:
inode->i_gid = current->fsgid;
inode->i_mode = mode;
/* This is the optimal IO size (for stat), not the fs block size */
inode->i_blksize = PAGE_SIZE;
inode->i_blocks = 0;
-Index: linux-2.6.9-full/fs/ext3/mballoc.c
+Index: linux-2.6.9-67.0.15/fs/ext3/mballoc.c
===================================================================
---- linux-2.6.9-full.orig/fs/ext3/mballoc.c 2007-03-28 15:42:45.000000000 +0400
-+++ linux-2.6.9-full/fs/ext3/mballoc.c 2007-03-28 18:36:16.000000000 +0400
+--- linux-2.6.9-67.0.15.orig/fs/ext3/mballoc.c
++++ linux-2.6.9-67.0.15/fs/ext3/mballoc.c
@@ -36,6 +36,8 @@
#include <linux/seq_file.h>
#include <linux/version.h>
unsigned short bb_first_free;
unsigned short bb_free;
unsigned short bb_fragments;
-@@ -928,10 +931,7 @@ static int ext3_mb_init_cache(struct pag
+@@ -943,10 +946,7 @@ static int ext3_mb_init_cache(struct pag
if (first_group + i >= EXT3_SB(sb)->s_groups_count)
break;
err = -ENOMEM;
bh[i] = sb_getblk(sb, le32_to_cpu(desc->bg_block_bitmap));
-@@ -946,7 +946,12 @@ static int ext3_mb_init_cache(struct pag
+@@ -961,7 +961,12 @@ static int ext3_mb_init_cache(struct pag
unlock_buffer(bh[i]);
continue;
}
get_bh(bh[i]);
bh[i]->b_end_io = end_buffer_read_sync;
submit_bh(READ, bh[i]);
-@@ -1703,6 +1708,10 @@ static int ext3_mb_good_group(struct ext
+@@ -1733,6 +1738,10 @@ static int ext3_mb_good_group(struct ext
switch (cr) {
case 0:
BUG_ON(ac->ac_2order == 0);
bits = ac->ac_sb->s_blocksize_bits + 1;
for (i = ac->ac_2order; i <= bits; i++)
if (grp->bb_counters[i] > 0)
-@@ -1796,7 +1805,9 @@ repeat:
+@@ -1826,7 +1835,9 @@ repeat:
}
ac->ac_groups_scanned++;
ext3_mb_simple_scan_group(ac, &e3b);
else if (cr == 1 && ac->ac_g_ex.fe_len == sbi->s_stripe)
ext3_mb_scan_aligned(ac, &e3b);
-@@ -2267,12 +2278,13 @@ int ext3_mb_init_backend(struct super_bl
+@@ -2306,12 +2317,13 @@ int ext3_mb_init_backend(struct super_bl
i--;
goto err_freebuddy;
}
set_bit(EXT3_GROUP_INFO_NEED_INIT_BIT,
&meta_group_info[j]->bb_state);
-@@ -2936,9 +2948,17 @@ int ext3_mb_mark_diskspace_used(struct e
- mb_set_bits(bitmap_bh->b_data, ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
+@@ -2945,9 +2957,17 @@ int ext3_mb_mark_diskspace_used(struct e
+ ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
spin_lock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
+ if (gdp->bg_flags & cpu_to_le16(EXT3_BG_BLOCK_UNINIT)) {
spin_unlock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, - ac->ac_b_ex.fe_len);
-@@ -4303,6 +4323,7 @@ do_more:
+@@ -4357,6 +4377,7 @@ do_more:
spin_lock(sb_bgl_lock(sbi, block_group));
gdp->bg_free_blocks_count =
cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count) + count);
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
-Index: linux-2.6.9-full/fs/ext3/balloc.c
+Index: linux-2.6.9-67.0.15/fs/ext3/balloc.c
===================================================================
---- linux-2.6.9-full.orig/fs/ext3/balloc.c 2007-03-28 15:45:41.000000000 +0400
-+++ linux-2.6.9-full/fs/ext3/balloc.c 2007-03-28 18:36:16.000000000 +0400
+--- linux-2.6.9-67.0.15.orig/fs/ext3/balloc.c
++++ linux-2.6.9-67.0.15/fs/ext3/balloc.c
@@ -20,6 +20,7 @@
#include <linux/quotaops.h>
#include <linux/buffer_head.h>
/*
* balloc.c contains the blocks allocation and deallocation routines
*/
-@@ -73,6 +74,75 @@ struct ext3_group_desc * ext3_get_group_
+@@ -73,6 +74,83 @@ struct ext3_group_desc * ext3_get_group_
return gdp + desc;
}
+ for (bit = le32_to_cpu(gdp->bg_inode_table) - start,
+ bit_max = bit + sbi->s_itb_per_group; bit < bit_max; bit++)
+ ext3_set_bit(bit, bh->b_data);
++
++ /*
++ * Also if the number of blocks within the group is
++ * less than the blocksize * 8 ( which is the size
++ * of bitmap ), set rest of the block bitmap to 1
++ */
++ mark_bitmap_end(EXT3_BLOCKS_PER_GROUP(sb), sb->s_blocksize * 8,
++ bh->b_data);
+ }
+
+ return free_blocks - sbi->s_itb_per_group - 2;
/*
* Read the bitmap for a given block_group, reading into the specified
* slot in the superblock's bitmap cache.
-@@ -88,7 +158,19 @@ read_block_bitmap(struct super_block *sb
+@@ -88,7 +166,19 @@ read_block_bitmap(struct super_block *sb
desc = ext3_get_group_desc (sb, block_group, NULL);
if (!desc)
goto error_out;
if (!bh)
ext3_error (sb, "read_block_bitmap",
"Cannot read block bitmap - "
-@@ -429,6 +511,7 @@ do_more:
+@@ -429,6 +519,7 @@ do_more:
gdp->bg_free_blocks_count =
cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count) +
*pdquot_freed_blocks);
spin_unlock(sb_bgl_lock(sbi, block_group));
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
-@@ -1330,8 +1413,11 @@ allocated:
+@@ -1330,8 +1421,11 @@ allocated:
ret_block, goal_hits, goal_attempts);
spin_lock(sb_bgl_lock(sbi, group_no));