PERFORCE change 181296 for review
Zheng Liu
lz at FreeBSD.org
Thu Jul 22 07:28:00 UTC 2010
http://p4web.freebsd.org/@@181296?ac=10
Change 181296 by lz at gnehzuil-freebsd on 2010/07/22 07:27:14
Make ext2fs support dir_nlink features.
* Modify i_nlink variable's type from int16_t to u_int16_t
to support dir_nlink feature.
* Fix a bug in read ext4 extents. Avoid to release a buf when
the content of this buf is useful.
Affected files ...
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_bmap.c#4 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extents.c#8 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extents.h#6 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_readwrite.c#9 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/inode.h#5 edit
Differences ...
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_bmap.c#4 (text+ko) ====
@@ -75,6 +75,9 @@
lbn = bn;
bsize = blksize(fs, ip, lbn);
+ /*
+ * TODO: need to implement read ahead to improve the performance.
+ */
if (runp != NULL)
*runp = 0;
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extents.c#8 (text+ko) ====
@@ -141,7 +141,6 @@
{
struct vnode *vp;
struct ext4_extent_header *ehp;
- struct buf *bp = NULL;
int depth, i, error, size;
daddr_t nblk;
@@ -164,15 +163,17 @@
size = blksize(fs, ip, path->ep_blk);
nblk = path->ep_blk;
- if (bp != NULL)
- brelse(bp);
- error = bread(ip->i_devvp, fsbtodb(fs, nblk), size, NOCRED, &bp);
+ if (path->ep_bp != NULL) {
+ brelse(path->ep_bp);
+ path->ep_bp = NULL;
+ }
+ error = bread(ip->i_devvp, fsbtodb(fs, nblk), size, NOCRED, &path->ep_bp);
if (error) {
- brelse(bp);
- bp = NULL;
- return NULL;
+ brelse(path->ep_bp);
+ path->ep_bp = NULL;
+ return (NULL);
}
- ehp = (struct ext4_extent_header *)bp->b_data;
+ ehp = (struct ext4_extent_header *)path->ep_bp->b_data;
path->ep_header = ehp;
i--;
}
@@ -186,8 +187,5 @@
path->ep_blk = (((daddr_t)(path->ep_ext->e_start_hi) << 31) << 1) |
path->ep_ext->e_start_lo;
- if (bp != NULL)
- brelse(bp);
-
- return path;
+ return (path);
}
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extents.h#6 (text+ko) ====
@@ -87,6 +87,7 @@
struct ext4_extent_path {
daddr_t ep_blk;
u_int16_t ep_depth;
+ struct buf *ep_bp;
struct ext4_extent *ep_ext;
struct ext4_extent_index *ep_index;
struct ext4_extent_header *ep_header;
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_readwrite.c#9 (text+ko) ====
@@ -78,6 +78,7 @@
ip = VTOI(vp);
mode = ip->i_mode;
uio = ap->a_uio;
+ memset(&path, 0, sizeof(path));
orig_resid = uio->uio_resid;
KASSERT(orig_resid >= 0, ("ext2_read: uio->uio_resid < 0"));
@@ -126,6 +127,11 @@
newblk = lbn - ep->e_blk +
(ep->e_start_lo | ((daddr_t)(ep->e_start_hi) << 31) << 1);
+
+ if (path.ep_bp != NULL) {
+ brelse(path.ep_bp);
+ path.ep_bp = NULL;
+ }
}
error = bread(ip->i_devvp, fsbtodb(fs, newblk), size, NOCRED, &bp);
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/inode.h#5 (text+ko) ====
@@ -90,7 +90,7 @@
/* Fields from struct dinode in UFS. */
u_int16_t i_mode; /* IFMT, permissions; see below. */
- int16_t i_nlink; /* File link count. */
+ u_int16_t i_nlink; /* File link count. */
u_int64_t i_size; /* File byte count. */
int32_t i_atime; /* Last access time. */
int32_t i_atimensec; /* Last access time. */
More information about the p4-projects
mailing list