Skip to contentSkip to conversation

sync up block & inode bitmap reading functions

PATCH In review Eric Sandeen 2 participants 2 messages Jul 18, 2008 – Jul 21, 2008 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sync up block & inode bitmap reading functions

ext4_read_block_bitmap and read_inode_bitmap do essentially the same thing, and yet they are structured quite differently. I came across this difference while looking at doing bg locking during bg initialization.

This patch:

* removes unnecessary casts in the error messages
* renames read_inode_bitmap to ext4_read_inode_bitmap
* and more substantially, restructures the inode bitmap reading function to be more like the block bitmap counterpart.

The change to the inode bitmap reader simplifies the locking to be applied in the next patch.

---

fs/ext4/balloc.c +4 -4
Index: linux-2.6/fs/ext4/balloc.c
===================================================================
@@ -314,8 +314,8 @@ ext4_read_block_bitmap(struct super_bloc
 	if (unlikely(!bh)) {
 		ext4_error(sb, __func__,
 			    "Cannot read block bitmap - "
-			    "block_group = %d, block_bitmap = %llu",
-			    (int)block_group, (unsigned long long)bitmap_blk);
+			    "block_group = %lu, block_bitmap = %llu",
+			    block_group, bitmap_blk);
 		return NULL;
 	}
 	if (bh_uptodate_or_lock(bh))
@@ -331,8 +331,8 @@ ext4_read_block_bitmap(struct super_bloc
 		put_bh(bh);
 		ext4_error(sb, __func__,
 			    "Cannot read block bitmap - "
-			    "block_group = %d, block_bitmap = %llu",
-			    (int)block_group, (unsigned long long)bitmap_blk);
+			    "block_group = %lu, block_bitmap = %llu",
+			    block_group, bitmap_blk);
 		return NULL;
 	}
 	ext4_valid_block_bitmap(sb, desc, block_group, bh);
fs/ext4/ialloc.c +29 -22

91 lines not on this page · raw message

#1 lore raw

fs/ext4/ialloc.c unsigned ext4_init_inode_bitmap(struct s · line 106

Quoted 12 lines · Eric Sandeen
fs/ext4/ialloc.c +3 -1
@@ -97,34 +97,41 @@ unsigned ext4_init_inode_bitmap(struct s
 static struct buffer_head *
-read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
+ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
 {
 	struct ext4_group_desc *desc;
 	struct buffer_head *bh = NULL;
+	ext4_fsblk_t bitmap_blk;
 
 	desc = ext4_get_group_desc(sb, block_group, NULL);
 	if (!desc)
+		return NULL;

If you were feeling generous, you could change this function to take gdp as a parameter (or post it as a kernel janitor task?), because it is already available in most of the functions that call read_{block,inode}_bitmap(), with the exception of ext4_orphan_get().

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.