[PATCH 3/3] ext4_group_t: mballoc changes

2007-10-30 Thread Avantika Mathur
 Ext4: change groups to ext4_group_t in mballoc.c

From: Avantika Mathur <[EMAIL PROTECTED]>

Signed-off-by: Avantika Mathur <[EMAIL PROTECTED]>
---

 fs/ext4/mballoc.c |   84 --
 1 file changed, 45 insertions(+), 39 deletions(-)


Index: linux-2.6.24-rc1/fs/ext4/mballoc.c
===
--- linux-2.6.24-rc1.orig/fs/ext4/mballoc.c	2007-10-30 11:11:53.0 -0700
+++ linux-2.6.24-rc1/fs/ext4/mballoc.c	2007-10-30 11:19:59.0 -0700
@@ -311,7 +311,7 @@
 #define EXT4_BB_MAX_BLOCKS	30
 
 struct ext4_free_metadata {
-	unsigned short group;
+	ext4_group_t group;
 	unsigned short num;
 	ext4_grpblk_t  blocks[EXT4_BB_MAX_BLOCKS];
 	struct list_head list;
@@ -362,7 +362,7 @@
 struct ext4_free_extent {
 	ext4_lblk_t fe_logical;
 	ext4_grpblk_t fe_start;
-	unsigned long fe_group;
+	ext4_group_t fe_group;
 	unsigned long fe_len;
 };
 
@@ -441,7 +441,7 @@
 	struct ext4_group_info *bd_info;
 	struct super_block *bd_sb;
 	__u16 bd_blkbits;
-	__u16 bd_group;
+	ext4_group_t bd_group;
 };
 #define EXT4_MB_BITMAP(e4b)	((e4b)->bd_bitmap)
 #define EXT4_MB_BUDDY(e4b)	((e4b)->bd_buddy)
@@ -455,11 +455,12 @@
 #define in_range(b, first, len)	((b) >= (first) && (b) <= (first) + (len) - 1)
 
 static struct proc_dir_entry *proc_root_ext4;
-struct buffer_head *read_block_bitmap(struct super_block *, unsigned int);
+struct buffer_head *read_block_bitmap(struct super_block *, ext4_group_t);
 ext4_fsblk_t ext4_new_blocks_old(handle_t *handle, struct inode *inode,
 			ext4_fsblk_t goal, unsigned long *count, int *errp);
 
-static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap, int group);
+static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
+	ext4_group_t group);
 static void ext4_mb_poll_new_transaction(struct super_block *, handle_t *);
 static void ext4_mb_free_committed_blocks(struct super_block *);
 static void ext4_mb_return_to_preallocation(struct inode *inode,
@@ -472,19 +473,21 @@
 static int ext4_mb_destroy_per_dev_proc(struct super_block *sb);
 
 
-static inline void ext4_lock_group(struct super_block *sb, int group)
+static inline void ext4_lock_group(struct super_block *sb, ext4_group_t group)
 {
 	bit_spin_lock(EXT4_GROUP_INFO_LOCKED_BIT,
 		  _GROUP_INFO(sb, group)->bb_state);
 }
 
-static inline void ext4_unlock_group(struct super_block *sb, int group)
+static inline void ext4_unlock_group(struct super_block *sb,
+	ext4_group_t group)
 {
 	bit_spin_unlock(EXT4_GROUP_INFO_LOCKED_BIT,
 			_GROUP_INFO(sb, group)->bb_state);
 }
 
-static inline int ext4_is_group_locked(struct super_block *sb, int group)
+static inline int ext4_is_group_locked(struct super_block *sb,
+	ext4_group_t group)
 {
 	return bit_spin_is_locked(EXT4_GROUP_INFO_LOCKED_BIT,
 	_GROUP_INFO(sb, group)->bb_state);
@@ -590,7 +593,7 @@
 			le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
 
 			ext4_error(sb, __FUNCTION__, "double-free of inode"
-   " %lu's block %lu(bit %u in group %u)\n",
+   " %lu's block %lu(bit %u in group %lu)\n",
    inode ? inode->i_ino : 0, blocknr,
    first + i, e4b->bd_group);
 		}
@@ -620,8 +623,8 @@
 		b2 = (unsigned char *) bitmap;
 		for (i = 0; i < e4b->bd_sb->s_blocksize; i++) {
 			if (b1[i] != b2[i]) {
-printk("corruption in group %u at byte %u(%u): "
-   "%x in copy != %x on disk/prealloc\n",
+printk("corruption in group %lu at byte %u(%u):"
+   " %x in copy != %x on disk/prealloc\n",
 	e4b->bd_group, i, i * 8, b1[i], b2[i]);
 BUG();
 			}
@@ -738,7 +741,7 @@
 	grp = EXT4_GROUP_INFO(sb, e4b->bd_group);
 	buddy = mb_find_buddy(e4b, 0, );
 	list_for_each(cur, >bb_prealloc_list) {
-		unsigned long groupnr;
+		ext4_group_t groupnr;
 		struct ext4_prealloc_space *pa;
 		pa = list_entry(cur, struct ext4_prealloc_space, group_list);
 		ext4_get_group_no_and_offset(sb, pa->pstart, , );
@@ -812,7 +815,7 @@
 }
 
 static void ext4_mb_generate_buddy(struct super_block *sb,
-void *buddy, void *bitmap, int group)
+void *buddy, void *bitmap, ext4_group_t group)
 {
 	struct ext4_group_info *grp = EXT4_GROUP_INFO(sb, group);
 	unsigned short max = EXT4_BLOCKS_PER_GROUP(sb);
@@ -843,7 +846,8 @@
 	grp->bb_fragments = fragments;
 
 	if (free != grp->bb_free) {
-		printk("EXT4-fs: group %u: %u blocks in bitmap, %u in gd\n",
+		printk(KERN_DEBUG
+			"EXT4-fs: group %lu: %u blocks in bitmap, %u in gd\n",
 			group, free, grp->bb_free);
 		grp->bb_free = free;
 	}
@@ -881,7 +885,7 @@
 	int groups_per_page;
 	int err = 0;
 	int i;
-	int first_group;
+	ext4_group_t first_group;
 	int first_block;
 	struct super_block *sb;
 	struct buffer_head *bhs;
@@ -1029,7 +1033,7 @@
 	return err;
 }
 
-static int ext4_mb_load_buddy(struct super_blo

[PATCH 2/3] ext4_group_t: Fix negative groups

2007-10-30 Thread Avantika Mathur
 Ext4: fixes block group number being set to a negative value

From: Avantika Mathur <[EMAIL PROTECTED]>

This patch fixes various places where the group number is set to a negative
value.

Signed-off-by: Avantika Mathur <[EMAIL PROTECTED]>
---

 fs/ext4/ialloc.c |  101 ---
 1 file changed, 53 insertions(+), 48 deletions(-)


Index: linux-2.6.24-rc1/fs/ext4/ialloc.c
===
--- linux-2.6.24-rc1.orig/fs/ext4/ialloc.c	2007-10-30 10:47:50.0 -0700
+++ linux-2.6.24-rc1/fs/ext4/ialloc.c	2007-10-30 10:58:16.0 -0700
@@ -260,12 +260,14 @@
  * For other inodes, search forward from the parent directory\'s block
  * group to find a free inode.
  */
-static ext4_group_t find_group_dir(struct super_block *sb, struct inode *parent)
+static int find_group_dir(struct super_block *sb, struct inode *parent,
+ext4_group_t *best_group)
 {
 	ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count;
 	unsigned int freei, avefreei;
 	struct ext4_group_desc *desc, *best_desc = NULL;
-	ext4_group_t group, best_group = -1;
+	ext4_group_t group;
+	int ret = -1;
 
 	freei = percpu_counter_read_positive(_SB(sb)->s_freeinodes_counter);
 	avefreei = freei / ngroups;
@@ -279,11 +281,12 @@
 		if (!best_desc ||
 		(le16_to_cpu(desc->bg_free_blocks_count) >
 		 le16_to_cpu(best_desc->bg_free_blocks_count))) {
-			best_group = group;
+			*best_group = group;
 			best_desc = desc;
+			ret = 0;
 		}
 	}
-	return best_group;
+	return ret;
 }
 
 /*
@@ -314,8 +317,8 @@
 #define INODE_COST 64
 #define BLOCK_COST 256
 
-static ext4_group_t find_group_orlov(struct super_block *sb,
-  struct inode *parent)
+static int find_group_orlov(struct super_block *sb, struct inode *parent,
+ext4_group_t *group)
 {
 	ext4_group_t parent_group = EXT4_I(parent)->i_block_group;
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -328,7 +331,7 @@
 	unsigned int ndirs;
 	int max_debt, max_dirs, min_inodes;
 	ext4_grpblk_t min_blocks;
-	ext4_group_t group = -1, i;
+	ext4_group_t i;
 	struct ext4_group_desc *desc;
 
 	freei = percpu_counter_read_positive(>s_freeinodes_counter);
@@ -341,13 +344,14 @@
 	if ((parent == sb->s_root->d_inode) ||
 	(EXT4_I(parent)->i_flags & EXT4_TOPDIR_FL)) {
 		int best_ndir = inodes_per_group;
-		ext4_group_t best_group = -1;
+		ext4_group_t grp;
+		int ret = -1;
 
-		get_random_bytes(, sizeof(group));
-		parent_group = (unsigned)group % ngroups;
+		get_random_bytes(, sizeof(grp));
+		parent_group = (unsigned)grp % ngroups;
 		for (i = 0; i < ngroups; i++) {
-			group = (parent_group + i) % ngroups;
-			desc = ext4_get_group_desc (sb, group, NULL);
+			grp = (parent_group + i) % ngroups;
+			desc = ext4_get_group_desc(sb, grp, NULL);
 			if (!desc || !desc->bg_free_inodes_count)
 continue;
 			if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir)
@@ -356,11 +360,12 @@
 continue;
 			if (le16_to_cpu(desc->bg_free_blocks_count) < avefreeb)
 continue;
-			best_group = group;
+			*group = grp;
+			ret = 0;
 			best_ndir = le16_to_cpu(desc->bg_used_dirs_count);
 		}
-		if (best_group >= 0)
-			return best_group;
+		if (ret == 0)
+			return ret;
 		goto fallback;
 	}
 
@@ -381,8 +386,8 @@
 		max_debt = 1;
 
 	for (i = 0; i < ngroups; i++) {
-		group = (parent_group + i) % ngroups;
-		desc = ext4_get_group_desc (sb, group, NULL);
+		*group = (parent_group + i) % ngroups;
+		desc = ext4_get_group_desc(sb, *group, NULL);
 		if (!desc || !desc->bg_free_inodes_count)
 			continue;
 		if (le16_to_cpu(desc->bg_used_dirs_count) >= max_dirs)
@@ -391,17 +396,16 @@
 			continue;
 		if (le16_to_cpu(desc->bg_free_blocks_count) < min_blocks)
 			continue;
-		return group;
+		return 0;
 	}
 
 fallback:
 	for (i = 0; i < ngroups; i++) {
-		group = (parent_group + i) % ngroups;
-		desc = ext4_get_group_desc (sb, group, NULL);
-		if (!desc || !desc->bg_free_inodes_count)
-			continue;
-		if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei)
-			return group;
+		*group = (parent_group + i) % ngroups;
+		desc = ext4_get_group_desc(sb, *group, NULL);
+		if (desc && desc->bg_free_inodes_count &&
+			le16_to_cpu(desc->bg_free_inodes_count) >= avefreei)
+			return 0;
 	}
 
 	if (avefreei) {
@@ -416,22 +420,22 @@
 	return -1;
 }
 
-static ext4_group_t find_group_other(struct super_block *sb, 
-	struct inode *parent)
+static int find_group_other(struct super_block *sb, struct inode *parent,
+ext4_group_t *group)
 {
 	ext4_group_t parent_group = EXT4_I(parent)->i_block_group;
 	ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count;
 	struct ext4_group_desc *desc;
-	ext4_group_t group, i;
+	ext4_group_t i;
 
 	/*
 	 * Try to place the inode in its parent directory
 	 */
-	group = parent_group;
-	desc = ext4_get_group_desc (sb, group, NULL);
+	*group = parent_group;
+	desc = ext4_ge

[PATCH 1/3] ext4_group_t: Add new type

2007-10-30 Thread Avantika Mathur

I have updated the group number type patches with a new name for the type.

Changed type name from ext4_grpnum_t to ext4_group_t.   


The patches have been tested with regular fsx and fsstress tests of the
patch queue.  These patches are based on the current ext4-patch-queue,
and replace the current grpnum_t patches currently in the queue.

Thanks
Avantika

---


Ext4: add ext4_group_t, and change all group variables to this type.

From: Avantika Mathur <[EMAIL PROTECTED]>

In many places variables for block group are of type int, which limits the
maximum number of block groups to 2^31.  Each block group can have up to
2^15 blocks, with a 4K block size,  and the max filesystem size is limited to
2^31 * (2^15 * 2^12) = 2^58  -- or 256 PB

This patch introduces a new type ext4_group_t, of type unsigned long, to
represent block group numbers in ext4.
All occurrences of block group variables are converted to type ext4_group_t.

Signed-off-by: Avantika Mathur <[EMAIL PROTECTED]>
---

 fs/ext4/balloc.c   |   71 +
 fs/ext4/group.h|8 +++--
 fs/ext4/ialloc.c   |   46 +++--
 fs/ext4/inode.c|5 +--
 fs/ext4/resize.c   |   12 +++
 fs/ext4/super.c|   20 +---
 include/linux/ext4_fs.h|   11 +++---
 include/linux/ext4_fs_i.h  |5 ++-
 include/linux/ext4_fs_sb.h |2 -
 9 files changed, 92 insertions(+), 88 deletions(-)


Index: linux-2.6.24-rc1/fs/ext4/balloc.c
===
--- linux-2.6.24-rc1.orig/fs/ext4/balloc.c	2007-10-23 20:50:57.0 -0700
+++ linux-2.6.24-rc1/fs/ext4/balloc.c	2007-10-29 16:17:49.0 -0700
@@ -29,7 +29,7 @@
  * Calculate the block group number and offset, given a block number
  */
 void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
-		unsigned long *blockgrpp, ext4_grpblk_t *offsetp)
+		ext4_group_t *blockgrpp, ext4_grpblk_t *offsetp)
 {
 	struct ext4_super_block *es = EXT4_SB(sb)->s_es;
 	ext4_grpblk_t offset;
@@ -46,7 +46,7 @@
 /* Initializes an uninitialized block bitmap if given, and returns the
  * number of blocks free in the group. */
 unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
-int block_group, struct ext4_group_desc *gdp)
+		 ext4_group_t block_group, struct ext4_group_desc *gdp)
 {
 	unsigned long start;
 	int bit, bit_max;
@@ -60,7 +60,7 @@
 		 * essentially implementing a per-group read-only flag. */
 		if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) {
 			ext4_error(sb, __FUNCTION__,
-   "Checksum bad for group %u\n", block_group);
+  "Checksum bad for group %lu\n", block_group);
 			gdp->bg_free_blocks_count = 0;
 			gdp->bg_free_inodes_count = 0;
 			gdp->bg_itable_unused = 0;
@@ -153,7 +153,7 @@
  *			group descriptor
  */
 struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
-	 unsigned int block_group,
+	 ext4_group_t block_group,
 	 struct buffer_head ** bh)
 {
 	unsigned long group_desc;
@@ -164,7 +164,7 @@
 	if (block_group >= sbi->s_groups_count) {
 		ext4_error (sb, "ext4_get_group_desc",
 			"block_group >= groups_count - "
-			"block_group = %d, groups_count = %lu",
+			"block_group = %lu, groups_count = %lu",
 			block_group, sbi->s_groups_count);
 
 		return NULL;
@@ -176,7 +176,7 @@
 	if (!sbi->s_group_desc[group_desc]) {
 		ext4_error (sb, "ext4_get_group_desc",
 			"Group descriptor not loaded - "
-			"block_group = %d, group_desc = %lu, desc = %lu",
+			"block_group = %lu, group_desc = %lu, desc = %lu",
 			 block_group, group_desc, offset);
 		return NULL;
 	}
@@ -209,7 +209,7 @@
  * Return buffer_head on success or NULL in case of failure.
  */
 struct buffer_head *
-read_block_bitmap(struct super_block *sb, unsigned int block_group)
+read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
 {
 	int i;
 	struct ext4_group_desc * desc;
@@ -237,7 +237,7 @@
 	if (!bh)
 		ext4_error (sb, __FUNCTION__,
 			"Cannot read block bitmap - "
-			"block_group = %d, block_bitmap = %llu",
+			"block_group = %lu, block_bitmap = %llu",
 			block_group, bitmap_blk);
 
 	/* check whether block bitmap block number is set */
@@ -267,7 +267,7 @@
 	brelse(bh);
 	ext4_error(sb, __FUNCTION__,
 			"Invalid block bitmap - "
-			"block_group = %d, block = %llu",
+			"block_group = %lu, block = %llu",
 			block_group, bitmap_blk);
 	return NULL;
 
@@ -361,7 +361,7 @@
  */
 static int
 goal_in_my_reservation(struct ext4_reserve_window *rsv, ext4_grpblk_t grp_goal,
-			unsigned int group, struct super_block * sb)
+			ext4_group_t group, struct super_block *sb)
 {
 	ext4_fsblk_t group_fi

[PATCH 3/3] ext4_group_t: mballoc changes

2007-10-30 Thread Avantika Mathur
 Ext4: change groups to ext4_group_t in mballoc.c

From: Avantika Mathur [EMAIL PROTECTED]

Signed-off-by: Avantika Mathur [EMAIL PROTECTED]
---

 fs/ext4/mballoc.c |   84 --
 1 file changed, 45 insertions(+), 39 deletions(-)


Index: linux-2.6.24-rc1/fs/ext4/mballoc.c
===
--- linux-2.6.24-rc1.orig/fs/ext4/mballoc.c	2007-10-30 11:11:53.0 -0700
+++ linux-2.6.24-rc1/fs/ext4/mballoc.c	2007-10-30 11:19:59.0 -0700
@@ -311,7 +311,7 @@
 #define EXT4_BB_MAX_BLOCKS	30
 
 struct ext4_free_metadata {
-	unsigned short group;
+	ext4_group_t group;
 	unsigned short num;
 	ext4_grpblk_t  blocks[EXT4_BB_MAX_BLOCKS];
 	struct list_head list;
@@ -362,7 +362,7 @@
 struct ext4_free_extent {
 	ext4_lblk_t fe_logical;
 	ext4_grpblk_t fe_start;
-	unsigned long fe_group;
+	ext4_group_t fe_group;
 	unsigned long fe_len;
 };
 
@@ -441,7 +441,7 @@
 	struct ext4_group_info *bd_info;
 	struct super_block *bd_sb;
 	__u16 bd_blkbits;
-	__u16 bd_group;
+	ext4_group_t bd_group;
 };
 #define EXT4_MB_BITMAP(e4b)	((e4b)-bd_bitmap)
 #define EXT4_MB_BUDDY(e4b)	((e4b)-bd_buddy)
@@ -455,11 +455,12 @@
 #define in_range(b, first, len)	((b) = (first)  (b) = (first) + (len) - 1)
 
 static struct proc_dir_entry *proc_root_ext4;
-struct buffer_head *read_block_bitmap(struct super_block *, unsigned int);
+struct buffer_head *read_block_bitmap(struct super_block *, ext4_group_t);
 ext4_fsblk_t ext4_new_blocks_old(handle_t *handle, struct inode *inode,
 			ext4_fsblk_t goal, unsigned long *count, int *errp);
 
-static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap, int group);
+static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
+	ext4_group_t group);
 static void ext4_mb_poll_new_transaction(struct super_block *, handle_t *);
 static void ext4_mb_free_committed_blocks(struct super_block *);
 static void ext4_mb_return_to_preallocation(struct inode *inode,
@@ -472,19 +473,21 @@
 static int ext4_mb_destroy_per_dev_proc(struct super_block *sb);
 
 
-static inline void ext4_lock_group(struct super_block *sb, int group)
+static inline void ext4_lock_group(struct super_block *sb, ext4_group_t group)
 {
 	bit_spin_lock(EXT4_GROUP_INFO_LOCKED_BIT,
 		  EXT4_GROUP_INFO(sb, group)-bb_state);
 }
 
-static inline void ext4_unlock_group(struct super_block *sb, int group)
+static inline void ext4_unlock_group(struct super_block *sb,
+	ext4_group_t group)
 {
 	bit_spin_unlock(EXT4_GROUP_INFO_LOCKED_BIT,
 			EXT4_GROUP_INFO(sb, group)-bb_state);
 }
 
-static inline int ext4_is_group_locked(struct super_block *sb, int group)
+static inline int ext4_is_group_locked(struct super_block *sb,
+	ext4_group_t group)
 {
 	return bit_spin_is_locked(EXT4_GROUP_INFO_LOCKED_BIT,
 	EXT4_GROUP_INFO(sb, group)-bb_state);
@@ -590,7 +593,7 @@
 			le32_to_cpu(EXT4_SB(sb)-s_es-s_first_data_block);
 
 			ext4_error(sb, __FUNCTION__, double-free of inode
-%lu's block %lu(bit %u in group %u)\n,
+%lu's block %lu(bit %u in group %lu)\n,
    inode ? inode-i_ino : 0, blocknr,
    first + i, e4b-bd_group);
 		}
@@ -620,8 +623,8 @@
 		b2 = (unsigned char *) bitmap;
 		for (i = 0; i  e4b-bd_sb-s_blocksize; i++) {
 			if (b1[i] != b2[i]) {
-printk(corruption in group %u at byte %u(%u): 
-   %x in copy != %x on disk/prealloc\n,
+printk(corruption in group %lu at byte %u(%u):
+%x in copy != %x on disk/prealloc\n,
 	e4b-bd_group, i, i * 8, b1[i], b2[i]);
 BUG();
 			}
@@ -738,7 +741,7 @@
 	grp = EXT4_GROUP_INFO(sb, e4b-bd_group);
 	buddy = mb_find_buddy(e4b, 0, max);
 	list_for_each(cur, grp-bb_prealloc_list) {
-		unsigned long groupnr;
+		ext4_group_t groupnr;
 		struct ext4_prealloc_space *pa;
 		pa = list_entry(cur, struct ext4_prealloc_space, group_list);
 		ext4_get_group_no_and_offset(sb, pa-pstart, groupnr, k);
@@ -812,7 +815,7 @@
 }
 
 static void ext4_mb_generate_buddy(struct super_block *sb,
-void *buddy, void *bitmap, int group)
+void *buddy, void *bitmap, ext4_group_t group)
 {
 	struct ext4_group_info *grp = EXT4_GROUP_INFO(sb, group);
 	unsigned short max = EXT4_BLOCKS_PER_GROUP(sb);
@@ -843,7 +846,8 @@
 	grp-bb_fragments = fragments;
 
 	if (free != grp-bb_free) {
-		printk(EXT4-fs: group %u: %u blocks in bitmap, %u in gd\n,
+		printk(KERN_DEBUG
+			EXT4-fs: group %lu: %u blocks in bitmap, %u in gd\n,
 			group, free, grp-bb_free);
 		grp-bb_free = free;
 	}
@@ -881,7 +885,7 @@
 	int groups_per_page;
 	int err = 0;
 	int i;
-	int first_group;
+	ext4_group_t first_group;
 	int first_block;
 	struct super_block *sb;
 	struct buffer_head *bhs;
@@ -1029,7 +1033,7 @@
 	return err;
 }
 
-static int ext4_mb_load_buddy(struct super_block *sb, int group,
+static int ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
 		struct ext4_buddy *e4b)
 {
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -1040,7 +1044,7 @@
 	int poff

[PATCH 2/3] ext4_group_t: Fix negative groups

2007-10-30 Thread Avantika Mathur
 Ext4: fixes block group number being set to a negative value

From: Avantika Mathur [EMAIL PROTECTED]

This patch fixes various places where the group number is set to a negative
value.

Signed-off-by: Avantika Mathur [EMAIL PROTECTED]
---

 fs/ext4/ialloc.c |  101 ---
 1 file changed, 53 insertions(+), 48 deletions(-)


Index: linux-2.6.24-rc1/fs/ext4/ialloc.c
===
--- linux-2.6.24-rc1.orig/fs/ext4/ialloc.c	2007-10-30 10:47:50.0 -0700
+++ linux-2.6.24-rc1/fs/ext4/ialloc.c	2007-10-30 10:58:16.0 -0700
@@ -260,12 +260,14 @@
  * For other inodes, search forward from the parent directory\'s block
  * group to find a free inode.
  */
-static ext4_group_t find_group_dir(struct super_block *sb, struct inode *parent)
+static int find_group_dir(struct super_block *sb, struct inode *parent,
+ext4_group_t *best_group)
 {
 	ext4_group_t ngroups = EXT4_SB(sb)-s_groups_count;
 	unsigned int freei, avefreei;
 	struct ext4_group_desc *desc, *best_desc = NULL;
-	ext4_group_t group, best_group = -1;
+	ext4_group_t group;
+	int ret = -1;
 
 	freei = percpu_counter_read_positive(EXT4_SB(sb)-s_freeinodes_counter);
 	avefreei = freei / ngroups;
@@ -279,11 +281,12 @@
 		if (!best_desc ||
 		(le16_to_cpu(desc-bg_free_blocks_count) 
 		 le16_to_cpu(best_desc-bg_free_blocks_count))) {
-			best_group = group;
+			*best_group = group;
 			best_desc = desc;
+			ret = 0;
 		}
 	}
-	return best_group;
+	return ret;
 }
 
 /*
@@ -314,8 +317,8 @@
 #define INODE_COST 64
 #define BLOCK_COST 256
 
-static ext4_group_t find_group_orlov(struct super_block *sb,
-  struct inode *parent)
+static int find_group_orlov(struct super_block *sb, struct inode *parent,
+ext4_group_t *group)
 {
 	ext4_group_t parent_group = EXT4_I(parent)-i_block_group;
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -328,7 +331,7 @@
 	unsigned int ndirs;
 	int max_debt, max_dirs, min_inodes;
 	ext4_grpblk_t min_blocks;
-	ext4_group_t group = -1, i;
+	ext4_group_t i;
 	struct ext4_group_desc *desc;
 
 	freei = percpu_counter_read_positive(sbi-s_freeinodes_counter);
@@ -341,13 +344,14 @@
 	if ((parent == sb-s_root-d_inode) ||
 	(EXT4_I(parent)-i_flags  EXT4_TOPDIR_FL)) {
 		int best_ndir = inodes_per_group;
-		ext4_group_t best_group = -1;
+		ext4_group_t grp;
+		int ret = -1;
 
-		get_random_bytes(group, sizeof(group));
-		parent_group = (unsigned)group % ngroups;
+		get_random_bytes(grp, sizeof(grp));
+		parent_group = (unsigned)grp % ngroups;
 		for (i = 0; i  ngroups; i++) {
-			group = (parent_group + i) % ngroups;
-			desc = ext4_get_group_desc (sb, group, NULL);
+			grp = (parent_group + i) % ngroups;
+			desc = ext4_get_group_desc(sb, grp, NULL);
 			if (!desc || !desc-bg_free_inodes_count)
 continue;
 			if (le16_to_cpu(desc-bg_used_dirs_count) = best_ndir)
@@ -356,11 +360,12 @@
 continue;
 			if (le16_to_cpu(desc-bg_free_blocks_count)  avefreeb)
 continue;
-			best_group = group;
+			*group = grp;
+			ret = 0;
 			best_ndir = le16_to_cpu(desc-bg_used_dirs_count);
 		}
-		if (best_group = 0)
-			return best_group;
+		if (ret == 0)
+			return ret;
 		goto fallback;
 	}
 
@@ -381,8 +386,8 @@
 		max_debt = 1;
 
 	for (i = 0; i  ngroups; i++) {
-		group = (parent_group + i) % ngroups;
-		desc = ext4_get_group_desc (sb, group, NULL);
+		*group = (parent_group + i) % ngroups;
+		desc = ext4_get_group_desc(sb, *group, NULL);
 		if (!desc || !desc-bg_free_inodes_count)
 			continue;
 		if (le16_to_cpu(desc-bg_used_dirs_count) = max_dirs)
@@ -391,17 +396,16 @@
 			continue;
 		if (le16_to_cpu(desc-bg_free_blocks_count)  min_blocks)
 			continue;
-		return group;
+		return 0;
 	}
 
 fallback:
 	for (i = 0; i  ngroups; i++) {
-		group = (parent_group + i) % ngroups;
-		desc = ext4_get_group_desc (sb, group, NULL);
-		if (!desc || !desc-bg_free_inodes_count)
-			continue;
-		if (le16_to_cpu(desc-bg_free_inodes_count) = avefreei)
-			return group;
+		*group = (parent_group + i) % ngroups;
+		desc = ext4_get_group_desc(sb, *group, NULL);
+		if (desc  desc-bg_free_inodes_count 
+			le16_to_cpu(desc-bg_free_inodes_count) = avefreei)
+			return 0;
 	}
 
 	if (avefreei) {
@@ -416,22 +420,22 @@
 	return -1;
 }
 
-static ext4_group_t find_group_other(struct super_block *sb, 
-	struct inode *parent)
+static int find_group_other(struct super_block *sb, struct inode *parent,
+ext4_group_t *group)
 {
 	ext4_group_t parent_group = EXT4_I(parent)-i_block_group;
 	ext4_group_t ngroups = EXT4_SB(sb)-s_groups_count;
 	struct ext4_group_desc *desc;
-	ext4_group_t group, i;
+	ext4_group_t i;
 
 	/*
 	 * Try to place the inode in its parent directory
 	 */
-	group = parent_group;
-	desc = ext4_get_group_desc (sb, group, NULL);
+	*group = parent_group;
+	desc = ext4_get_group_desc(sb, *group, NULL);
 	if (desc  le16_to_cpu(desc-bg_free_inodes_count) 
 			le16_to_cpu(desc-bg_free_blocks_count))
-		return group;
+		return 0

[PATCH 1/3] ext4_group_t: Add new type

2007-10-30 Thread Avantika Mathur

I have updated the group number type patches with a new name for the type.

Changed type name from ext4_grpnum_t to ext4_group_t.   


The patches have been tested with regular fsx and fsstress tests of the
patch queue.  These patches are based on the current ext4-patch-queue,
and replace the current grpnum_t patches currently in the queue.

Thanks
Avantika

---


Ext4: add ext4_group_t, and change all group variables to this type.

From: Avantika Mathur [EMAIL PROTECTED]

In many places variables for block group are of type int, which limits the
maximum number of block groups to 2^31.  Each block group can have up to
2^15 blocks, with a 4K block size,  and the max filesystem size is limited to
2^31 * (2^15 * 2^12) = 2^58  -- or 256 PB

This patch introduces a new type ext4_group_t, of type unsigned long, to
represent block group numbers in ext4.
All occurrences of block group variables are converted to type ext4_group_t.

Signed-off-by: Avantika Mathur [EMAIL PROTECTED]
---

 fs/ext4/balloc.c   |   71 +
 fs/ext4/group.h|8 +++--
 fs/ext4/ialloc.c   |   46 +++--
 fs/ext4/inode.c|5 +--
 fs/ext4/resize.c   |   12 +++
 fs/ext4/super.c|   20 +---
 include/linux/ext4_fs.h|   11 +++---
 include/linux/ext4_fs_i.h  |5 ++-
 include/linux/ext4_fs_sb.h |2 -
 9 files changed, 92 insertions(+), 88 deletions(-)


Index: linux-2.6.24-rc1/fs/ext4/balloc.c
===
--- linux-2.6.24-rc1.orig/fs/ext4/balloc.c	2007-10-23 20:50:57.0 -0700
+++ linux-2.6.24-rc1/fs/ext4/balloc.c	2007-10-29 16:17:49.0 -0700
@@ -29,7 +29,7 @@
  * Calculate the block group number and offset, given a block number
  */
 void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
-		unsigned long *blockgrpp, ext4_grpblk_t *offsetp)
+		ext4_group_t *blockgrpp, ext4_grpblk_t *offsetp)
 {
 	struct ext4_super_block *es = EXT4_SB(sb)-s_es;
 	ext4_grpblk_t offset;
@@ -46,7 +46,7 @@
 /* Initializes an uninitialized block bitmap if given, and returns the
  * number of blocks free in the group. */
 unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
-int block_group, struct ext4_group_desc *gdp)
+		 ext4_group_t block_group, struct ext4_group_desc *gdp)
 {
 	unsigned long start;
 	int bit, bit_max;
@@ -60,7 +60,7 @@
 		 * essentially implementing a per-group read-only flag. */
 		if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) {
 			ext4_error(sb, __FUNCTION__,
-   Checksum bad for group %u\n, block_group);
+  Checksum bad for group %lu\n, block_group);
 			gdp-bg_free_blocks_count = 0;
 			gdp-bg_free_inodes_count = 0;
 			gdp-bg_itable_unused = 0;
@@ -153,7 +153,7 @@
  *			group descriptor
  */
 struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
-	 unsigned int block_group,
+	 ext4_group_t block_group,
 	 struct buffer_head ** bh)
 {
 	unsigned long group_desc;
@@ -164,7 +164,7 @@
 	if (block_group = sbi-s_groups_count) {
 		ext4_error (sb, ext4_get_group_desc,
 			block_group = groups_count - 
-			block_group = %d, groups_count = %lu,
+			block_group = %lu, groups_count = %lu,
 			block_group, sbi-s_groups_count);
 
 		return NULL;
@@ -176,7 +176,7 @@
 	if (!sbi-s_group_desc[group_desc]) {
 		ext4_error (sb, ext4_get_group_desc,
 			Group descriptor not loaded - 
-			block_group = %d, group_desc = %lu, desc = %lu,
+			block_group = %lu, group_desc = %lu, desc = %lu,
 			 block_group, group_desc, offset);
 		return NULL;
 	}
@@ -209,7 +209,7 @@
  * Return buffer_head on success or NULL in case of failure.
  */
 struct buffer_head *
-read_block_bitmap(struct super_block *sb, unsigned int block_group)
+read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
 {
 	int i;
 	struct ext4_group_desc * desc;
@@ -237,7 +237,7 @@
 	if (!bh)
 		ext4_error (sb, __FUNCTION__,
 			Cannot read block bitmap - 
-			block_group = %d, block_bitmap = %llu,
+			block_group = %lu, block_bitmap = %llu,
 			block_group, bitmap_blk);
 
 	/* check whether block bitmap block number is set */
@@ -267,7 +267,7 @@
 	brelse(bh);
 	ext4_error(sb, __FUNCTION__,
 			Invalid block bitmap - 
-			block_group = %d, block = %llu,
+			block_group = %lu, block = %llu,
 			block_group, bitmap_blk);
 	return NULL;
 
@@ -361,7 +361,7 @@
  */
 static int
 goal_in_my_reservation(struct ext4_reserve_window *rsv, ext4_grpblk_t grp_goal,
-			unsigned int group, struct super_block * sb)
+			ext4_group_t group, struct super_block *sb)
 {
 	ext4_fsblk_t group_first_block, group_last_block;
 
@@ -581,7 +581,7 @@
 {
 	struct buffer_head *bitmap_bh = NULL;
 	struct buffer_head *gd_bh;
-	unsigned long block_group;
+	ext4_group_t block_group;
 	ext4_grpblk_t bit;
 	unsigned long i;
 	unsigned long overflow

Re: [PATCH] Ext4: Uninitialized Block Groups

2007-09-19 Thread Avantika Mathur

Andreas Dilger wrote:

On Sep 18, 2007  20:03 -0700, Andrew Morton wrote:
  

On Tue, 18 Sep 2007 17:25:31 -0700 Avantika Mathur <[EMAIL PROTECTED]> wrote:



+#if !defined(CONFIG_CRC16)
+/** CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1) */
+__u16 const crc16_table[256] = { me
+   0x, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
  

That's rather sad.  A plain old "depends on" would be better.



My bad.  We wrote this patch and it had to run on older kernels that might
not even have lib/crc16.c (it was added around 2.6.15 or so, so e.g. RHEL4
doesn't have it).  I forgot to remove it from the upstream submission,
and since it didn't cause problems nobody else complained...

The incremental patch below removes the local crc16 code, and also resolves an
issue with properly updating bg_itable_unused when an inode is allocated in an 
unused block groups.


Thanks
Avantika

---
fs/Kconfig   |1 +
fs/ext4/ialloc.c |8 +++-
fs/ext4/super.c  |   51 +--
3 files changed, 9 insertions(+), 51 deletions(-)

Index: linux-2.6.23-rc6/fs/ext4/ialloc.c
===
--- linux-2.6.23-rc6.orig/fs/ext4/ialloc.c  2007-09-19 15:38:21.0 
-0700
+++ linux-2.6.23-rc6/fs/ext4/ialloc.c   2007-09-19 15:41:11.0 -0700
@@ -635,12 +635,18 @@
if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) {
gdp->bg_flags &= cpu_to_le16(~EXT4_BG_INODE_UNINIT);
-   free = EXT4_INODES_PER_GROUP(sb);
+   free = 0;
} else {
free = EXT4_INODES_PER_GROUP(sb) -
le16_to_cpu(gdp->bg_itable_unused);
}

+   /*
+* Check the relative inode number against the last used
+* relative inode number in this group. if it is greater
+* we need to  update the bg_itable_unused count
+*
+*/
if (ino > free)
gdp->bg_itable_unused =
cpu_to_le16(EXT4_INODES_PER_GROUP(sb) - ino);
Index: linux-2.6.23-rc6/fs/ext4/super.c
===
--- linux-2.6.23-rc6.orig/fs/ext4/super.c   2007-09-19 15:38:21.0 
-0700
+++ linux-2.6.23-rc6/fs/ext4/super.c2007-09-19 15:38:51.0 -0700
@@ -37,6 +37,7 @@
#include 
#include 
#include 
+#include 

#include 

@@ -1248,56 +1249,6 @@
return res;
}

-#if !defined(CONFIG_CRC16)
-/** CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1) */
-__u16 const crc16_table[256] = {
-   0x, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
-   0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
-   0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
-   0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
-   0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
-   0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
-   0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
-   0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
-   0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
-   0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
-   0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
-   0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
-   0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
-   0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
-   0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
-   0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
-   0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
-   0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
-   0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
-   0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
-   0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
-   0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
-   0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
-   0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
-   0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
-   0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
-   0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
-   0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
-   0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
-  

Re: [PATCH] Ext4: Uninitialized Block Groups

2007-09-19 Thread Avantika Mathur

Andreas Dilger wrote:

On Sep 18, 2007  20:03 -0700, Andrew Morton wrote:
  

On Tue, 18 Sep 2007 17:25:31 -0700 Avantika Mathur [EMAIL PROTECTED] wrote:



+#if !defined(CONFIG_CRC16)
+/** CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1) */
+__u16 const crc16_table[256] = { me
+   0x, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
  

That's rather sad.  A plain old depends on would be better.



My bad.  We wrote this patch and it had to run on older kernels that might
not even have lib/crc16.c (it was added around 2.6.15 or so, so e.g. RHEL4
doesn't have it).  I forgot to remove it from the upstream submission,
and since it didn't cause problems nobody else complained...

The incremental patch below removes the local crc16 code, and also resolves an
issue with properly updating bg_itable_unused when an inode is allocated in an 
unused block groups.


Thanks
Avantika

---
fs/Kconfig   |1 +
fs/ext4/ialloc.c |8 +++-
fs/ext4/super.c  |   51 +--
3 files changed, 9 insertions(+), 51 deletions(-)

Index: linux-2.6.23-rc6/fs/ext4/ialloc.c
===
--- linux-2.6.23-rc6.orig/fs/ext4/ialloc.c  2007-09-19 15:38:21.0 
-0700
+++ linux-2.6.23-rc6/fs/ext4/ialloc.c   2007-09-19 15:41:11.0 -0700
@@ -635,12 +635,18 @@
if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
if (gdp-bg_flags  cpu_to_le16(EXT4_BG_INODE_UNINIT)) {
gdp-bg_flags = cpu_to_le16(~EXT4_BG_INODE_UNINIT);
-   free = EXT4_INODES_PER_GROUP(sb);
+   free = 0;
} else {
free = EXT4_INODES_PER_GROUP(sb) -
le16_to_cpu(gdp-bg_itable_unused);
}

+   /*
+* Check the relative inode number against the last used
+* relative inode number in this group. if it is greater
+* we need to  update the bg_itable_unused count
+*
+*/
if (ino  free)
gdp-bg_itable_unused =
cpu_to_le16(EXT4_INODES_PER_GROUP(sb) - ino);
Index: linux-2.6.23-rc6/fs/ext4/super.c
===
--- linux-2.6.23-rc6.orig/fs/ext4/super.c   2007-09-19 15:38:21.0 
-0700
+++ linux-2.6.23-rc6/fs/ext4/super.c2007-09-19 15:38:51.0 -0700
@@ -37,6 +37,7 @@
#include linux/quotaops.h
#include linux/seq_file.h
#include linux/log2.h
+#include linux/crc16.h

#include asm/uaccess.h

@@ -1248,56 +1249,6 @@
return res;
}

-#if !defined(CONFIG_CRC16)
-/** CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1) */
-__u16 const crc16_table[256] = {
-   0x, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
-   0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
-   0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
-   0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
-   0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
-   0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
-   0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
-   0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
-   0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
-   0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
-   0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
-   0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
-   0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
-   0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
-   0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
-   0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
-   0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
-   0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
-   0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
-   0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
-   0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
-   0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
-   0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
-   0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
-   0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
-   0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
-   0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
-   0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
-   0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81

Re: cfq performance gap

2006-12-08 Thread Avantika Mathur
On Fri, 2006-12-08 at 13:05 +0100, Jens Axboe wrote:
> On Thu, Dec 07 2006, Avantika Mathur wrote:
> > Hi Jens,
> 
> (you probably noticed now, but the [EMAIL PROTECTED] email is no longer
> valid)

I saw that, thanks!
> > I've noticed a performance gap between the cfq scheduler and other io
> > schedulers when running the rawio benchmark.
> > Results from rawio on 2.6.19, cfq and noop schedulers:
> >
> > CFQ:
> >
> > procs   devicenum read   KB/sec I/O Ops/sec
> > -  ---  --  ---  --
> >   16 /dev/sda   16412 83382084
> > -  ---  --  ---  --
> >   1616412 83382084
> >
> > Total run time 0.492072 seconds
> >
> >
> > NOOP:
> >
> > procs   devicenum read   KB/sec I/O Ops/sec
> > -  ---  --  ---  --
> >   16 /dev/sda   16399292247306
> > -  ---  --  ---  --
> >   1616399292247306
> >
> > Total run time 0.140284 seconds
> >
> > The benchmark workload is 16 processes running 4k random reads.
> >
> > Is this performance gap a known issue?
> 
> CFQ could be a little slower at this benchmark, but your results are
> much worse than I would expect. What is the queueing depth of sda? How
> are you invoking rawio?

I am running rawio with the following options:
rawread -p 16 -m 1 -d 1 -x -z -t 0 -s 4096
 
The queue depth on sda is 4.

> 
> Your runtime is very low, how does it look if you allow the test to run
> for much longer? 30MiB/sec random read bandwidth seems very high, I'm
> wondering what exactly is being tested here.
> 

rawio is actually performing sequential reads, but I don't believe it is
purely sequential with the multiple processes.
I am currently running the test with longer runtimes and will post
results once it is complete. 
I've also attached the rawio source.

Thanks,
Avantika



rawio-2.4.2.tar.gz
Description: application/compressed-tar


Re: cfq performance gap

2006-12-08 Thread Avantika Mathur
On Fri, 2006-12-08 at 13:05 +0100, Jens Axboe wrote:
 On Thu, Dec 07 2006, Avantika Mathur wrote:
  Hi Jens,
 
 (you probably noticed now, but the [EMAIL PROTECTED] email is no longer
 valid)

I saw that, thanks!
  I've noticed a performance gap between the cfq scheduler and other io
  schedulers when running the rawio benchmark.
  Results from rawio on 2.6.19, cfq and noop schedulers:
 
  CFQ:
 
  procs   devicenum read   KB/sec I/O Ops/sec
  -  ---  --  ---  --
16 /dev/sda   16412 83382084
  -  ---  --  ---  --
1616412 83382084
 
  Total run time 0.492072 seconds
 
 
  NOOP:
 
  procs   devicenum read   KB/sec I/O Ops/sec
  -  ---  --  ---  --
16 /dev/sda   16399292247306
  -  ---  --  ---  --
1616399292247306
 
  Total run time 0.140284 seconds
 
  The benchmark workload is 16 processes running 4k random reads.
 
  Is this performance gap a known issue?
 
 CFQ could be a little slower at this benchmark, but your results are
 much worse than I would expect. What is the queueing depth of sda? How
 are you invoking rawio?

I am running rawio with the following options:
rawread -p 16 -m 1 -d 1 -x -z -t 0 -s 4096
 
The queue depth on sda is 4.

 
 Your runtime is very low, how does it look if you allow the test to run
 for much longer? 30MiB/sec random read bandwidth seems very high, I'm
 wondering what exactly is being tested here.
 

rawio is actually performing sequential reads, but I don't believe it is
purely sequential with the multiple processes.
I am currently running the test with longer runtimes and will post
results once it is complete. 
I've also attached the rawio source.

Thanks,
Avantika



rawio-2.4.2.tar.gz
Description: application/compressed-tar


cfq performance gap

2006-12-07 Thread Avantika Mathur
Hi Jens, 

I've noticed a performance gap between the cfq scheduler and other io
schedulers when running the rawio benchmark. 
Results from rawio on 2.6.19, cfq and noop schedulers: 

CFQ: 

procs   devicenum read   KB/sec I/O Ops/sec 
-  ---  --  ---  -- 
  16 /dev/sda   16412 83382084 
-  ---  --  ---  -- 
  1616412 83382084 

Total run time 0.492072 seconds 


NOOP: 

procs   devicenum read   KB/sec I/O Ops/sec 
-  ---  --  ---  -- 
  16 /dev/sda   16399292247306 
-  ---  --  ---  -- 
  1616399292247306 

Total run time 0.140284 seconds 

The benchmark workload is 16 processes running 4k random reads. 

Is this performance gap a known issue? 
Thanks, 
Avantika Mathur 


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


cfq performance gap

2006-12-07 Thread Avantika Mathur
Hi Jens, 

I've noticed a performance gap between the cfq scheduler and other io
schedulers when running the rawio benchmark. 
Results from rawio on 2.6.19, cfq and noop schedulers: 

CFQ: 

procs   devicenum read   KB/sec I/O Ops/sec 
-  ---  --  ---  -- 
  16 /dev/sda   16412 83382084 
-  ---  --  ---  -- 
  1616412 83382084 

Total run time 0.492072 seconds 


NOOP: 

procs   devicenum read   KB/sec I/O Ops/sec 
-  ---  --  ---  -- 
  16 /dev/sda   16399292247306 
-  ---  --  ---  -- 
  1616399292247306 

Total run time 0.140284 seconds 

The benchmark workload is 16 processes running 4k random reads. 

Is this performance gap a known issue? 
Thanks, 
Avantika Mathur 


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/