From owner-svn-src-all@FreeBSD.ORG Wed Jun 26 04:34:18 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 07B3044D; Wed, 26 Jun 2013 04:34:18 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ED8B01CC2; Wed, 26 Jun 2013 04:34:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5Q4YHpu084300; Wed, 26 Jun 2013 04:34:17 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5Q4YGeQ084292; Wed, 26 Jun 2013 04:34:16 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306260434.r5Q4YGeQ084292@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 26 Jun 2013 04:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252234 - stable/9/sys/fs/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2013 04:34:18 -0000 Author: pfg Date: Wed Jun 26 04:34:16 2013 New Revision: 252234 URL: http://svnweb.freebsd.org/changeset/base/252234 Log: MFC r252103: Define and use e2fs_lbn_t in ext2fs. In line to what is done in UFS, define an internal type e2fs_lbn_t for the logical block numbers. This change is basically a no-op as the new type is unchanged (int32_t) but it may be useful as bumping this may be required for ext4fs. Also, as pointed out by Bruce Evans: -Use daddr_t for daddr in ext2_bmaparray(). This seems to improve reliability with the reallocblks option. - Add a cast to the fsbtodb() macro as in UFS. Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c stable/9/sys/fs/ext2fs/ext2_balloc.c stable/9/sys/fs/ext2fs/ext2_bmap.c stable/9/sys/fs/ext2fs/ext2_extern.h stable/9/sys/fs/ext2fs/ext2_subr.c stable/9/sys/fs/ext2fs/fs.h stable/9/sys/fs/ext2fs/inode.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_alloc.c Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/ext2_alloc.c Wed Jun 26 04:34:16 2013 (r252234) @@ -165,7 +165,8 @@ ext2_reallocblks(struct vop_reallocblks_ struct ext2mount *ump; struct cluster_save *buflist; struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp; - int32_t start_lbn, end_lbn, soff, newblk, blkno; + e2fs_lbn_t start_lbn, end_lbn; + int32_t soff, newblk, blkno; int i, len, start_lvl, end_lvl, pref, ssize; if (doreallocblks == 0) @@ -550,7 +551,7 @@ ext2_dirpref(struct inode *pip) * that will hold the pointer */ int32_t -ext2_blkpref(struct inode *ip, int32_t lbn, int indx, int32_t *bap, +ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, int32_t *bap, int32_t blocknr) { int tmp; Modified: stable/9/sys/fs/ext2fs/ext2_balloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_balloc.c Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/ext2_balloc.c Wed Jun 26 04:34:16 2013 (r252234) @@ -57,7 +57,7 @@ * the inode and the logical block number in a file. */ int -ext2_balloc(struct inode *ip, int32_t lbn, int size, struct ucred *cred, +ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred, struct buf **bpp, int flags) { struct m_ext2fs *fs; Modified: stable/9/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_bmap.c Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/ext2_bmap.c Wed Jun 26 04:34:16 2013 (r252234) @@ -99,8 +99,8 @@ ext2_bmaparray(struct vnode *vp, int32_t struct mount *mp; struct vnode *devvp; struct indir a[NIADDR+1], *ap; - int32_t daddr; - long metalbn; + daddr_t daddr; + e2fs_lbn_t metalbn; int error, num, maxrun = 0, bsize; int *nump; @@ -241,7 +241,8 @@ ext2_bmaparray(struct vnode *vp, int32_t int ext2_getlbns(struct vnode *vp, int32_t bn, struct indir *ap, int *nump) { - long blockcnt, metalbn, realbn; + long blockcnt; + e2fs_lbn_t metalbn, realbn; struct ext2mount *ump; int i, numlevels, off; int64_t qblockcnt; Modified: stable/9/sys/fs/ext2fs/ext2_extern.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_extern.h Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/ext2_extern.h Wed Jun 26 04:34:16 2013 (r252234) @@ -49,10 +49,10 @@ struct vnode; int ext2_alloc(struct inode *, int32_t, int32_t, int, struct ucred *, int32_t *); int ext2_balloc(struct inode *, - int32_t, int, struct ucred *, struct buf **, int); + e2fs_lbn_t, int, struct ucred *, struct buf **, int); int ext2_blkatoff(struct vnode *, off_t, char **, struct buf **); void ext2_blkfree(struct inode *, int32_t, long); -int32_t ext2_blkpref(struct inode *, int32_t, int, int32_t *, int32_t); +int32_t ext2_blkpref(struct inode *, e2fs_lbn_t, int, int32_t *, int32_t); int ext2_bmap(struct vop_bmap_args *); int ext2_bmaparray(struct vnode *, int32_t, int32_t *, int *, int *); void ext2_clusteracct(struct m_ext2fs *, char *, int, daddr_t, int); Modified: stable/9/sys/fs/ext2fs/ext2_subr.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_subr.c Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/ext2_subr.c Wed Jun 26 04:34:16 2013 (r252234) @@ -68,7 +68,7 @@ ext2_blkatoff(struct vnode *vp, off_t of struct inode *ip; struct m_ext2fs *fs; struct buf *bp; - int32_t lbn; + e2fs_lbn_t lbn; int bsize, error; ip = VTOI(vp); Modified: stable/9/sys/fs/ext2fs/fs.h ============================================================================== --- stable/9/sys/fs/ext2fs/fs.h Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/fs.h Wed Jun 26 04:34:16 2013 (r252234) @@ -98,8 +98,8 @@ * Turn file system block numbers into disk block addresses. * This maps file system blocks to device size blocks. */ -#define fsbtodb(fs, b) ((b) << ((fs)->e2fs_fsbtodb)) -#define dbtofsb(fs, b) ((b) >> ((fs)->e2fs_fsbtodb)) +#define fsbtodb(fs, b) ((daddr_t)(b) << (fs)->e2fs_fsbtodb) +#define dbtofsb(fs, b) ((b) >> (fs)->e2fs_fsbtodb) /* get group containing inode */ #define ino_to_cg(fs, x) (((x) - 1) / (fs->e2fs_ipg)) Modified: stable/9/sys/fs/ext2fs/inode.h ============================================================================== --- stable/9/sys/fs/ext2fs/inode.h Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/inode.h Wed Jun 26 04:34:16 2013 (r252234) @@ -50,6 +50,11 @@ #define NIADDR 3 /* Indirect addresses in inode. */ /* + * The size of physical and logical block numbers and time fields in UFS. + */ +typedef int32_t e2fs_lbn_t; + +/* * The inode is used to describe each active (or recently active) file in the * EXT2FS filesystem. It is composed of two types of information. The first * part is the information that is needed only while the file is active (such @@ -148,7 +153,7 @@ struct inode { * ext2_getlbns and used by truncate and bmap code. */ struct indir { - int32_t in_lbn; /* Logical block number. */ + e2fs_lbn_t in_lbn; /* Logical block number. */ int in_off; /* Offset in buffer. */ };