From owner-svn-src-all@FreeBSD.ORG Tue Jan 29 01:44:15 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 0D0E0BEC; Tue, 29 Jan 2013 01:44:15 +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 F179FD77; Tue, 29 Jan 2013 01:44:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0T1iEhg002297; Tue, 29 Jan 2013 01:44:14 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0T1iDvK002290; Tue, 29 Jan 2013 01:44:13 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201301290144.r0T1iDvK002290@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 29 Jan 2013 01:44:13 +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: r246049 - 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: Tue, 29 Jan 2013 01:44:15 -0000 Author: pfg Date: Tue Jan 29 01:44:13 2013 New Revision: 246049 URL: http://svnweb.freebsd.org/changeset/base/246049 Log: MFC r245820, r245844, r245950: ext2fs: make some inode fields match the ext2 spec. Ext2fs uses unsigned fields in its dinode struct. FreeBSD can have negative values in some of those fields and the inode is meant to interact with the system so we have never respected the unsigned nature of most of those fields. Block numbers and the generation number do not need to be signed so redefine them as unsigned to better match the on-disk information. Include some fixes proposed by bde@. While here add a lot of svn mergeinfo that was missing in /sys: r239963,240060,240880,241007,241141,241143,241181,243641, 243652,244475,245121,245612,245817 Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c stable/9/sys/fs/ext2fs/ext2_balloc.c stable/9/sys/fs/ext2fs/ext2_inode.c 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 Tue Jan 29 00:11:21 2013 (r246048) +++ stable/9/sys/fs/ext2fs/ext2_alloc.c Tue Jan 29 01:44:13 2013 (r246049) @@ -169,7 +169,7 @@ ext2_reallocblks(ap) struct inode *ip; struct vnode *vp; struct buf *sbp, *ebp; - int32_t *bap, *sbap, *ebap = 0; + uint32_t *bap, *sbap, *ebap = 0; struct ext2mount *ump; struct cluster_save *buflist; struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp; Modified: stable/9/sys/fs/ext2fs/ext2_balloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_balloc.c Tue Jan 29 00:11:21 2013 (r246048) +++ stable/9/sys/fs/ext2fs/ext2_balloc.c Tue Jan 29 01:44:13 2013 (r246049) @@ -69,7 +69,7 @@ ext2_balloc(ip, lbn, size, cred, bpp, fl struct buf *bp, *nbp; struct vnode *vp = ITOV(ip); struct indir indirs[NIADDR + 2]; - int32_t newb, *bap, pref; + uint32_t newb, *bap, pref; int osize, nsize, num, i, error; *bpp = NULL; Modified: stable/9/sys/fs/ext2fs/ext2_inode.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_inode.c Tue Jan 29 00:11:21 2013 (r246048) +++ stable/9/sys/fs/ext2fs/ext2_inode.c Tue Jan 29 01:44:13 2013 (r246049) @@ -119,7 +119,7 @@ ext2_truncate(vp, length, flags, cred, t int32_t lastblock; struct inode *oip; int32_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR]; - int32_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; + uint32_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; struct bufobj *bo; struct m_ext2fs *fs; struct buf *bp; @@ -341,8 +341,9 @@ done: * Put back the real size. */ oip->i_size = length; - oip->i_blocks -= blocksreleased; - if (oip->i_blocks < 0) /* sanity */ + if (oip->i_blocks >= blocksreleased) + oip->i_blocks -= blocksreleased; + else /* sanity */ oip->i_blocks = 0; oip->i_flag |= IN_CHANGE; vnode_pager_setsize(ovp, length); Modified: stable/9/sys/fs/ext2fs/inode.h ============================================================================== --- stable/9/sys/fs/ext2fs/inode.h Tue Jan 29 00:11:21 2013 (r246048) +++ stable/9/sys/fs/ext2fs/inode.h Tue Jan 29 01:44:13 2013 (r246049) @@ -90,11 +90,11 @@ struct inode { int32_t i_atimensec; /* Last access time. */ int32_t i_ctimensec; /* Last inode change time. */ int32_t i_birthnsec; /* Inode creation time. */ - int32_t i_db[NDADDR]; /* Direct disk blocks. */ - int32_t i_ib[NIADDR]; /* Indirect disk blocks. */ + uint32_t i_db[NDADDR]; /* Direct disk blocks. */ + uint32_t i_ib[NIADDR]; /* Indirect disk blocks. */ uint32_t i_flags; /* Status flags (chflags). */ - int32_t i_blocks; /* Blocks actually held. */ - int32_t i_gen; /* Generation number. */ + uint32_t i_blocks; /* Blocks actually held. */ + uint32_t i_gen; /* Generation number. */ uint32_t i_uid; /* File owner. */ uint32_t i_gid; /* File group. */ }; @@ -163,7 +163,7 @@ struct ufid { uint16_t ufid_len; /* Length of structure. */ uint16_t ufid_pad; /* Force 32-bit alignment. */ ino_t ufid_ino; /* File number (ino). */ - int32_t ufid_gen; /* Generation number. */ + uint32_t ufid_gen; /* Generation number. */ }; #endif /* _KERNEL */