From owner-p4-projects@FreeBSD.ORG Thu Jul 22 07:28:00 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 86AF11065670; Thu, 22 Jul 2010 07:28:00 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29722106566B for ; Thu, 22 Jul 2010 07:28:00 +0000 (UTC) (envelope-from lz@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 176718FC16 for ; Thu, 22 Jul 2010 07:28:00 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o6M7RxhJ006366 for ; Thu, 22 Jul 2010 07:27:59 GMT (envelope-from lz@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o6M7RxZL006364 for perforce@freebsd.org; Thu, 22 Jul 2010 07:27:59 GMT (envelope-from lz@FreeBSD.org) Date: Thu, 22 Jul 2010 07:27:59 GMT Message-Id: <201007220727.o6M7RxZL006364@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to lz@FreeBSD.org using -f From: Zheng Liu To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 181296 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jul 2010 07:28:00 -0000 http://p4web.freebsd.org/@@181296?ac=10 Change 181296 by lz@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. */