[PATCH] ext[234]: cleanup ext[234]_bg_num_gdb()

2007-12-08 Thread Akinobu Mita
Use ext[234]_bg_has_super() to remove duplicate code.

Cc: Stephen Tweedie [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Signed-off-by: Akinobu Mita [EMAIL PROTECTED]

---
 fs/ext2/balloc.c |5 +
 fs/ext3/balloc.c |6 +-
 fs/ext4/balloc.c |6 +-
 3 files changed, 3 insertions(+), 14 deletions(-)

Index: 2.6-git/fs/ext2/balloc.c
===
--- 2.6-git.orig/fs/ext2/balloc.c
+++ 2.6-git/fs/ext2/balloc.c
@@ -1466,9 +1466,6 @@ int ext2_bg_has_super(struct super_block
  */
 unsigned long ext2_bg_num_gdb(struct super_block *sb, int group)
 {
-   if (EXT2_HAS_RO_COMPAT_FEATURE(sb,EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)
-   !ext2_group_sparse(group))
-   return 0;
-   return EXT2_SB(sb)-s_gdb_count;
+   return ext2_bg_has_super(sb, group) ? EXT2_SB(sb)-s_gdb_count : 0;
 }
 
Index: 2.6-git/fs/ext3/balloc.c
===
--- 2.6-git.orig/fs/ext3/balloc.c
+++ 2.6-git/fs/ext3/balloc.c
@@ -1782,11 +1782,7 @@ static unsigned long ext3_bg_num_gdb_met
 
 static unsigned long ext3_bg_num_gdb_nometa(struct super_block *sb, int group)
 {
-   if (EXT3_HAS_RO_COMPAT_FEATURE(sb,
-   EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER) 
-   !ext3_group_sparse(group))
-   return 0;
-   return EXT3_SB(sb)-s_gdb_count;
+   return ext3_bg_has_super(sb, group) ? EXT3_SB(sb)-s_gdb_count : 0;
 }
 
 /**
Index: 2.6-git/fs/ext4/balloc.c
===
--- 2.6-git.orig/fs/ext4/balloc.c
+++ 2.6-git/fs/ext4/balloc.c
@@ -1902,11 +1902,7 @@ static unsigned long ext4_bg_num_gdb_met
 
 static unsigned long ext4_bg_num_gdb_nometa(struct super_block *sb, int group)
 {
-   if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
-   EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER) 
-   !ext4_group_sparse(group))
-   return 0;
-   return EXT4_SB(sb)-s_gdb_count;
+   return ext4_bg_has_super(sb, group) ? EXT4_SB(sb)-s_gdb_count : 0;
 }
 
 /**
-
To unsubscribe from this list: send the line unsubscribe linux-ext4 in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ext[234]: fix comment for nonexistent variable

2007-12-08 Thread Akinobu Mita
The comment in ext[234]_new_blocks() describes about i.
But there is no local variable called i in that scope.
I guess it has been renamed to group_no.

Cc: Stephen Tweedie [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Signed-off-by: Akinobu Mita [EMAIL PROTECTED]

---
 fs/ext2/balloc.c |4 ++--
 fs/ext3/balloc.c |2 +-
 fs/ext4/balloc.c |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Index: 2.6-git/fs/ext2/balloc.c
===
--- 2.6-git.orig/fs/ext2/balloc.c
+++ 2.6-git/fs/ext2/balloc.c
@@ -1250,8 +1250,8 @@ retry_alloc:
smp_rmb();
 
/*
-* Now search the rest of the groups.  We assume that 
-* i and gdp correctly point to the last group visited.
+* Now search the rest of the groups.  We assume that
+* group_no and gdp correctly point to the last group visited.
 */
for (bgi = 0; bgi  ngroups; bgi++) {
group_no++;
Index: 2.6-git/fs/ext3/balloc.c
===
--- 2.6-git.orig/fs/ext3/balloc.c
+++ 2.6-git/fs/ext3/balloc.c
@@ -1508,7 +1508,7 @@ retry_alloc:
 
/*
 * Now search the rest of the groups.  We assume that
-* i and gdp correctly point to the last group visited.
+* group_no and gdp correctly point to the last group visited.
 */
for (bgi = 0; bgi  ngroups; bgi++) {
group_no++;
Index: 2.6-git/fs/ext4/balloc.c
===
--- 2.6-git.orig/fs/ext4/balloc.c
+++ 2.6-git/fs/ext4/balloc.c
@@ -1625,7 +1625,7 @@ retry_alloc:
 
/*
 * Now search the rest of the groups.  We assume that
-* i and gdp correctly point to the last group visited.
+* group_no and gdp correctly point to the last group visited.
 */
for (bgi = 0; bgi  ngroups; bgi++) {
group_no++;
-
To unsubscribe from this list: send the line unsubscribe linux-ext4 in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ext[234]: use ext[234]_get_group_desc()

2007-12-08 Thread Akinobu Mita
Use ext[234]_get_group_desc() to get group descriptor from group number.

Cc: Stephen Tweedie [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Signed-off-by: Akinobu Mita [EMAIL PROTECTED]


---
 fs/ext2/super.c |   12 
 fs/ext3/super.c |   13 -
 fs/ext4/super.c |   14 --
 3 files changed, 12 insertions(+), 27 deletions(-)

Index: 2.6-git/fs/ext2/super.c
===
--- 2.6-git.orig/fs/ext2/super.c
+++ 2.6-git/fs/ext2/super.c
@@ -617,27 +617,24 @@ static int ext2_setup_super (struct supe
return res;
 }
 
-static int ext2_check_descriptors (struct super_block * sb)
+static int ext2_check_descriptors(struct super_block *sb)
 {
int i;
-   int desc_block = 0;
struct ext2_sb_info *sbi = EXT2_SB(sb);
unsigned long first_block = le32_to_cpu(sbi-s_es-s_first_data_block);
unsigned long last_block;
-   struct ext2_group_desc * gdp = NULL;
 
ext2_debug (Checking group descriptors);
 
-   for (i = 0; i  sbi-s_groups_count; i++)
-   {
+   for (i = 0; i  sbi-s_groups_count; i++) {
+   struct ext2_group_desc *gdp = ext2_get_group_desc(sb, i, NULL);
+
if (i == sbi-s_groups_count - 1)
last_block = le32_to_cpu(sbi-s_es-s_blocks_count) - 1;
else
last_block = first_block +
(EXT2_BLOCKS_PER_GROUP(sb) - 1);
 
-   if ((i % EXT2_DESC_PER_BLOCK(sb)) == 0)
-   gdp = (struct ext2_group_desc *) 
sbi-s_group_desc[desc_block++]-b_data;
if (le32_to_cpu(gdp-bg_block_bitmap)  first_block ||
le32_to_cpu(gdp-bg_block_bitmap)  last_block)
{
@@ -667,7 +664,6 @@ static int ext2_check_descriptors (struc
return 0;
}
first_block += EXT2_BLOCKS_PER_GROUP(sb);
-   gdp++;
}
return 1;
 }
Index: 2.6-git/fs/ext3/super.c
===
--- 2.6-git.orig/fs/ext3/super.c
+++ 2.6-git/fs/ext3/super.c
@@ -1252,28 +1252,24 @@ static int ext3_setup_super(struct super
 }
 
 /* Called at mount-time, super-block is locked */
-static int ext3_check_descriptors (struct super_block * sb)
+static int ext3_check_descriptors(struct super_block *sb)
 {
struct ext3_sb_info *sbi = EXT3_SB(sb);
ext3_fsblk_t first_block = le32_to_cpu(sbi-s_es-s_first_data_block);
ext3_fsblk_t last_block;
-   struct ext3_group_desc * gdp = NULL;
-   int desc_block = 0;
int i;
 
ext3_debug (Checking group descriptors);
 
-   for (i = 0; i  sbi-s_groups_count; i++)
-   {
+   for (i = 0; i  sbi-s_groups_count; i++) {
+   struct ext3_group_desc *gdp = ext3_get_group_desc(sb, i, NULL);
+
if (i == sbi-s_groups_count - 1)
last_block = le32_to_cpu(sbi-s_es-s_blocks_count) - 1;
else
last_block = first_block +
(EXT3_BLOCKS_PER_GROUP(sb) - 1);
 
-   if ((i % EXT3_DESC_PER_BLOCK(sb)) == 0)
-   gdp = (struct ext3_group_desc *)
-   sbi-s_group_desc[desc_block++]-b_data;
if (le32_to_cpu(gdp-bg_block_bitmap)  first_block ||
le32_to_cpu(gdp-bg_block_bitmap)  last_block)
{
@@ -1306,7 +1302,6 @@ static int ext3_check_descriptors (struc
return 0;
}
first_block += EXT3_BLOCKS_PER_GROUP(sb);
-   gdp++;
}
 
sbi-s_es-s_free_blocks_count=cpu_to_le32(ext3_count_free_blocks(sb));
Index: 2.6-git/fs/ext4/super.c
===
--- 2.6-git.orig/fs/ext4/super.c
+++ 2.6-git/fs/ext4/super.c
@@ -1353,7 +1353,7 @@ int ext4_group_desc_csum_verify(struct e
 }
 
 /* Called at mount-time, super-block is locked */
-static int ext4_check_descriptors (struct super_block * sb)
+static int ext4_check_descriptors(struct super_block *sb)
 {
struct ext4_sb_info *sbi = EXT4_SB(sb);
ext4_fsblk_t first_block = le32_to_cpu(sbi-s_es-s_first_data_block);
@@ -1361,8 +1361,6 @@ static int ext4_check_descriptors (struc
ext4_fsblk_t block_bitmap;
ext4_fsblk_t inode_bitmap;
ext4_fsblk_t inode_table;
-   struct ext4_group_desc * gdp = NULL;
-   int desc_block = 0;
int flexbg_flag = 0;
int i;
 
@@ -1371,17 +1369,15 @@ static int ext4_check_descriptors (struc
 
ext4_debug (Checking group descriptors);
 
-   for (i = 0; i  sbi-s_groups_count; i++)
-   {
+   for (i = 0; i  sbi-s_groups_count; i++) {
+   struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL);
+
if (i == 

[PATCH] ext[234]: remove unused argument for ext[234]_find_goal()

2007-12-08 Thread Akinobu Mita
The argument chain for ext[234]_find_goal() is not used.
This patch removes it and fixes comment as well.

Cc: Stephen Tweedie [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Signed-off-by: Akinobu Mita [EMAIL PROTECTED]

---
 fs/ext2/inode.c |7 ++-
 fs/ext3/inode.c |8 +++-
 fs/ext4/inode.c |8 +++-
 3 files changed, 8 insertions(+), 15 deletions(-)

Index: 2.6-git/fs/ext2/inode.c
===
--- 2.6-git.orig/fs/ext2/inode.c
+++ 2.6-git/fs/ext2/inode.c
@@ -286,15 +286,12 @@ static unsigned long ext2_find_near(stru
  * ext2_find_goal - find a prefered place for allocation.
  * @inode: owner
  * @block:  block we want
- * @chain:  chain of indirect blocks
  * @partial: pointer to the last triple within a chain
  *
  * Returns preferred place for a block (the goal).
  */
 
-static inline int ext2_find_goal(struct inode *inode,
-long block,
-Indirect chain[4],
+static inline int ext2_find_goal(struct inode *inode, long block,
 Indirect *partial)
 {
struct ext2_block_alloc_info *block_i;
@@ -639,7 +636,7 @@ reread:
if (S_ISREG(inode-i_mode)  (!ei-i_block_alloc_info))
ext2_init_block_alloc_info(inode);
 
-   goal = ext2_find_goal(inode, iblock, chain, partial);
+   goal = ext2_find_goal(inode, iblock, partial);
 
/* the number of blocks need to allocate for [d,t]indirect blocks */
indirect_blks = (chain + depth) - partial - 1;
Index: 2.6-git/fs/ext3/inode.c
===
--- 2.6-git.orig/fs/ext3/inode.c
+++ 2.6-git/fs/ext3/inode.c
@@ -439,16 +439,14 @@ static ext3_fsblk_t ext3_find_near(struc
  * ext3_find_goal - find a prefered place for allocation.
  * @inode: owner
  * @block:  block we want
- * @chain:  chain of indirect blocks
  * @partial: pointer to the last triple within a chain
- * @goal:  place to store the result.
  *
  * Normally this function find the prefered place for block allocation,
- * stores it in [EMAIL PROTECTED] and returns zero.
+ * returns it.
  */
 
 static ext3_fsblk_t ext3_find_goal(struct inode *inode, long block,
-   Indirect chain[4], Indirect *partial)
+  Indirect *partial)
 {
struct ext3_block_alloc_info *block_i;
 
@@ -884,7 +882,7 @@ int ext3_get_blocks_handle(handle_t *han
if (S_ISREG(inode-i_mode)  (!ei-i_block_alloc_info))
ext3_init_block_alloc_info(inode);
 
-   goal = ext3_find_goal(inode, iblock, chain, partial);
+   goal = ext3_find_goal(inode, iblock, partial);
 
/* the number of blocks need to allocate for [d,t]indirect blocks */
indirect_blks = (chain + depth) - partial - 1;
Index: 2.6-git/fs/ext4/inode.c
===
--- 2.6-git.orig/fs/ext4/inode.c
+++ 2.6-git/fs/ext4/inode.c
@@ -437,16 +437,14 @@ static ext4_fsblk_t ext4_find_near(struc
  * ext4_find_goal - find a prefered place for allocation.
  * @inode: owner
  * @block:  block we want
- * @chain:  chain of indirect blocks
  * @partial: pointer to the last triple within a chain
- * @goal:  place to store the result.
  *
  * Normally this function find the prefered place for block allocation,
- * stores it in [EMAIL PROTECTED] and returns zero.
+ * returns it.
  */
 
 static ext4_fsblk_t ext4_find_goal(struct inode *inode, long block,
-   Indirect chain[4], Indirect *partial)
+  Indirect *partial)
 {
struct ext4_block_alloc_info *block_i;
 
@@ -883,7 +881,7 @@ int ext4_get_blocks_handle(handle_t *han
if (S_ISREG(inode-i_mode)  (!ei-i_block_alloc_info))
ext4_init_block_alloc_info(inode);
 
-   goal = ext4_find_goal(inode, iblock, chain, partial);
+   goal = ext4_find_goal(inode, iblock, partial);
 
/* the number of blocks need to allocate for [d,t]indirect blocks */
indirect_blks = (chain + depth) - partial - 1;
-
To unsubscribe from this list: send the line unsubscribe linux-ext4 in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 2.6.24-rc4-mm1: some issues on sparc64

2007-12-08 Thread Andrew Morton
On Sat, 8 Dec 2007 19:20:28 +0100 Mariusz Kozlowski [EMAIL PROTECTED] wrote:

   The box is sun ultra 60 (dual sparc64). This was caught when
 system (gentoo) was emerging some package. 
 
 [27006.402237] kernel BUG at fs/jbd/transaction.c:1894!

That's

J_ASSERT_BH(bh, !buffer_jbddirty(bh));

at the end of journal_unmap_buffer().

I don't recall seeing that before and I can't think of anything we've
done recently which could cause it, sorry.

 [27006.402268]   \|/  \|/
 [27006.402274]   @'/ .. \`@
 [27006.402279]   /_| \__/ |_\
 [27006.402285]  \__U_/

x86 needs that.

 [27006.402298] rm(4713): Kernel bad sw trap 5 [#1]
 [27006.402538] TSTATE: 009911009605 TPC: 0053b1cc TNPC: 
 0053b1d0 Y: Not tainted
 [27006.402579] TPC: journal_invalidatepage+0x3d4/0x460
 [27006.402593] g0: 0002 g1:  g2: 0001 
 g3: f800a7d9
 [27006.402610] g4: f800b54ea460 g5: f8007f832000 g6: f800a7d9 
 g7: 0076d868
 [27006.402627] o0: 0072b660 o1: 0766 o2: 0002 
 o3: 0001
 [27006.402644] o4: 008a2940 o5:  sp: f800a7d92c91 
 ret_pc: 0053b1c4
 [27006.402665] RPC: journal_invalidatepage+0x3cc/0x460
 [27006.402679] l0: f800afbf4070 l1: 0069511c l2: 2000 
 l3: 
 [27006.402696] l4: 0001 l5: f800ba4cb730 l6: f800bf1cd338 
 l7: 0001
 [27006.402713] i0: f800bf1cd000 i1: 000201db2708 i2:  
 i3: 00727000
 [27006.402730] i4: 0020 i5: f800bf1cd028 i6: f800a7d92d51 
 i7: 00529254
 [27006.402763] I7: ext3_invalidatepage+0x3c/0x60
 [27006.402776] Caller[00529254]: ext3_invalidatepage+0x3c/0x60
 [27006.402800] Caller[004b22fc]: do_invalidatepage+0x24/0x60
 [27006.402826] Caller[004b29c4]: truncate_complete_page+0x6c/0x80
 [27006.402849] Caller[004b2a6c]: truncate_inode_pages_range+0x94/0x440
 [27006.402872] Caller[004b2e2c]: truncate_inode_pages+0x14/0x20
 [27006.402894] Caller[00529888]: ext3_delete_inode+0x10/0x160
 [27006.402918] Caller[004e7ca0]: generic_delete_inode+0x88/0x120
 [27006.402949] Caller[004e7e60]: generic_drop_inode+0x128/0x1c0
 [27006.402971] Caller[004e75d4]: iput+0x7c/0xa0
 [27006.402992] Caller[004dd680]: do_unlinkat+0x108/0x1a0
 [27006.403024] Caller[004dd884]: sys_unlinkat+0x2c/0x60
 [27006.403047] Caller[004062d4]: linux_sparc_syscall32+0x3c/0x40
 [27006.403081] Caller[f7e7d0ec]: 0xf7e7d0f4
 [27006.403102] Instruction DUMP: 92102766  7ffbbeaf  90122260 91d02005 
 92102780  7ffbbeab  90122260  91d02005  7ffbbea8
-
To unsubscribe from this list: send the line unsubscribe linux-ext4 in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html