kern/124621: [ext3] Cannot mount ext2fs partition
Josh Carroll
josh.carroll at gmail.com
Wed Sep 3 18:30:05 UTC 2008
The following reply was made to PR kern/124621; it has been noted by GNATS.
From: "Josh Carroll" <josh.carroll at gmail.com>
To: bug-followup at FreeBSD.org, paulf at free.fr
Cc:
Subject: Re: kern/124621: [ext3] Cannot mount ext2fs partition
Date: Wed, 3 Sep 2008 14:28:58 -0400
Here is a simple patch that queries the inode size, rather than assuming 128.
This may be a rather naive way to do this (querying it every time from
(s)->s_es->s_inode_size), but it does seem to work. Perhaps there is a
smarter way of doing this (setting something at mount time?).
I tested this with mke2fs -I 128, mke2fs (defaults to -I 256 with the
latest e2fsprogs port), and -I 512.
Thanks,
Josh
diff -ud ext2fs.orig/ext2_fs.h ext2fs/ext2_fs.h
--- ext2fs.orig/ext2_fs.h 2005-06-16 06:51:38.000000000 +0000
+++ ext2fs/ext2_fs.h 2008-09-03 14:10:27.000000000 +0000
@@ -150,7 +150,7 @@
#else /* !notyet */
#define EXT2_INODES_PER_BLOCK(s) ((s)->s_inodes_per_block)
/* Should be sizeof(struct ext2_inode): */
-#define EXT2_INODE_SIZE 128
+#define EXT2_INODE_SIZE(s) ((s)->s_es->s_inode_size)
#define EXT2_FIRST_INO 11
#endif /* notyet */
diff -ud ext2fs.orig/ext2_inode.c ext2fs/ext2_inode.c
--- ext2fs.orig/ext2_inode.c 2006-09-26 04:15:58.000000000 +0000
+++ ext2fs/ext2_inode.c 2008-09-03 13:54:49.000000000 +0000
@@ -91,7 +91,7 @@
return (error);
}
ext2_i2ei(ip, (struct ext2_inode *)((char *)bp->b_data +
- EXT2_INODE_SIZE * ino_to_fsbo(fs, ip->i_number)));
+ EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)));
if (waitfor && (vp->v_mount->mnt_kern_flag & MNTK_ASYNC) == 0)
return (bwrite(bp));
else {
diff -ud ext2fs.orig/ext2_vfsops.c ext2fs/ext2_vfsops.c
--- ext2fs.orig/ext2_vfsops.c 2008-04-03 18:51:13.000000000 +0000
+++ ext2fs/ext2_vfsops.c 2008-09-03 13:55:37.000000000 +0000
@@ -424,7 +424,7 @@
V(s_frags_per_group)
fs->s_inodes_per_group = es->s_inodes_per_group;
V(s_inodes_per_group)
- fs->s_inodes_per_block = fs->s_blocksize / EXT2_INODE_SIZE;
+ fs->s_inodes_per_block = fs->s_blocksize / EXT2_INODE_SIZE(fs);
V(s_inodes_per_block)
fs->s_itb_per_group = fs->s_inodes_per_group /fs->s_inodes_per_block;
V(s_itb_per_group)
@@ -578,7 +578,7 @@
return (error);
}
ext2_ei2i((struct ext2_inode *) ((char *)bp->b_data +
- EXT2_INODE_SIZE * ino_to_fsbo(fs, ip->i_number)), ip);
+ EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)), ip);
brelse(bp);
VOP_UNLOCK(vp, 0, td);
vrele(vp);
@@ -1013,7 +1013,7 @@
return (error);
}
/* convert ext2 inode to dinode */
- ext2_ei2i((struct ext2_inode *) ((char *)bp->b_data + EXT2_INODE_SIZE *
+ ext2_ei2i((struct ext2_inode *) ((char *)bp->b_data +
EXT2_INODE_SIZE(fs) *
ino_to_fsbo(fs, ino)), ip);
ip->i_block_group = ino_to_cg(fs, ino);
ip->i_next_alloc_block = 0;
More information about the freebsd-fs
mailing list