PERFORCE change 180752 for review
Zheng Liu
lz at FreeBSD.org
Sun Jul 11 09:11:01 UTC 2010
http://p4web.freebsd.org/@@180752?ac=10
Change 180752 by lz at gnehzuil-freebsd on 2010/07/11 09:10:55
Now ext2fs can read a small file.
Affected files ...
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extents.c#4 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_inode_cnv.c#6 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_readwrite.c#5 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#7 edit
Differences ...
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extents.c#4 (text+ko) ====
@@ -76,8 +76,9 @@
return;
l = (struct ext4_extent *)(((char *)(ehp) +
- sizeof(struct ext4_extent_header)));
- r = l + ehp->eh_ecount - 1;
+ sizeof(struct ext4_extent_header))) + 1;
+ r = (struct ext4_extent *)(((char *)(ehp) +
+ sizeof(struct ext4_extent_header))) + ehp->eh_ecount - 1;
while (l <= r) {
m = l + (r - l) / 2;
if (lbn < m->e_blk)
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_inode_cnv.c#6 (text+ko) ====
@@ -96,6 +96,7 @@
ip->i_mtime = ei->e2di_mtime;
ip->i_ctime = ei->e2di_ctime;
ip->i_flags = ei->e2di_flags; /* we need to entire flags to check new features */
+ ip->i_gen = ei->e2di_gen;
#if 0
ip->i_flags = 0;
ip->i_flags |= (ei->e2di_flags & EXT2_APPEND) ? SF_APPEND : 0;
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_readwrite.c#5 (text+ko) ====
@@ -62,7 +62,6 @@
struct uio *uio;
struct m_ext2fs *fs;
struct buf *bp;
- struct ext2mount *ump;
struct ext4_extent nex, *ep;
struct ext4_extent_header *ehp;
/*struct ext4_extent_path *path = NULL;*/
@@ -80,8 +79,8 @@
ip = VTOI(vp);
mode = ip->i_mode;
uio = ap->a_uio;
- ump = ip->i_ump;
+printf("====\n");
orig_resid = uio->uio_resid;
KASSERT(orig_resid >= 0, ("ext2_read: uio->uio_resid < 0"));
if (orig_resid == 0)
@@ -139,7 +138,7 @@
(ep->e_start_lo | ((daddr_t)(ep->e_start_hi) << 31) << 1);
}
- error = bread(ump->um_devvp, fsbtodb(fs, newblk), size, NOCRED, &bp);
+ error = bread(ip->i_devvp, fsbtodb(fs, newblk), size, NOCRED, &bp);
if (error) {
brelse(bp);
bp = NULL;
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#7 (text+ko) ====
@@ -864,8 +864,8 @@
struct vnode *vp;
struct cdev *dev;
struct thread *td;
- int i, error;
- int used_blocks;
+ int error;
+ /*int i, used_blocks;*/
td = curthread;
error = vfs_hash_get(mp, ino, flags, td, vpp, NULL, NULL);
@@ -949,11 +949,18 @@
* blocks are zeroed out - ext2_balloc depends on this
* although for regular files and directories only
*/
+
+ /*
+ * NOTE: When ext4 file system use extents, we don't zero
+ * block pointers.
+ */
+#if 0
if(S_ISDIR(ip->i_mode) || S_ISREG(ip->i_mode)) {
used_blocks = (ip->i_size+fs->e2fs_bsize-1) / fs->e2fs_bsize;
for(i = used_blocks; i < EXT2_NDIR_BLOCKS; i++)
ip->i_db[i] = 0;
}
+#endif
ext2_print_inode(ip);
More information about the p4-projects
mailing list