From owner-p4-projects@FreeBSD.ORG Tue Aug 25 19:46:12 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B0AD5106568D; Tue, 25 Aug 2009 19:46:11 +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 753D4106568B for ; Tue, 25 Aug 2009 19:46:11 +0000 (UTC) (envelope-from truncs@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4A2C18FC1A for ; Tue, 25 Aug 2009 19:46:11 +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 n7PJkBSO003570 for ; Tue, 25 Aug 2009 19:46:11 GMT (envelope-from truncs@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n7PJkBsr003568 for perforce@freebsd.org; Tue, 25 Aug 2009 19:46:11 GMT (envelope-from truncs@FreeBSD.org) Date: Tue, 25 Aug 2009 19:46:11 GMT Message-Id: <200908251946.n7PJkBsr003568@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to truncs@FreeBSD.org using -f From: Aditya Sarawgi To: Perforce Change Reviews Cc: Subject: PERFORCE change 167803 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 19:46:12 -0000 http://perforce.freebsd.org/chv.cgi?CH=167803 Change 167803 by truncs@aditya on 2009/08/25 19:45:12 Revert some of my previous changes. Affected files ... .. //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_inode.c#2 edit Differences ... ==== //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_inode.c#2 (text+ko) ==== @@ -125,16 +125,16 @@ long count, nblocks, blocksreleased = 0; int aflags, error, i, allerror; off_t osize; - - /* +/* +printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length); +*/ /* * negative file sizes will totally break the code below and * are not meaningful anyways. - * We should check the max file size here too. */ - oip = VTOI(ovp); if (length < 0) - return EINVAL; + return EFBIG; + oip = VTOI(ovp); if (ovp->v_type == VLNK && oip->i_size < ovp->v_mount->mnt_maxsymlinklen) { #ifdef DIAGNOSTIC @@ -155,7 +155,7 @@ /* * Lengthen the size of the file. We must ensure that the * last byte of the file is allocated. Since the smallest - * value of osize is 0, length will be at least 1. + * value of oszie is 0, length will be at least 1. */ if (osize < length) { if (length > oip->i_e2fs->e2fs_maxfilesize) @@ -165,13 +165,12 @@ aflags = B_CLRBUF; if (flags & IO_SYNC) aflags |= B_SYNC; - error = ext2_balloc(oip, lbn, offset + 1, cred, &bp, - aflags); - if(error) + vnode_pager_setsize(ovp, length); + if ((error = ext2_balloc(oip, lbn, offset + 1, cred, &bp, + aflags)) != 0) return (error); oip->i_size = length; - vnode_pager_setsize(ovp, length); - if (aflags & B_SYNC) + if (aflags & IO_SYNC) bwrite(bp); else bawrite(bp); @@ -201,12 +200,11 @@ size = blksize(fs, oip, lbn); bzero((char *)bp->b_data + offset, (u_int)(size - offset)); allocbuf(bp, size); - if (aflags & B_SYNC) + if (aflags & IO_SYNC) bwrite(bp); else bawrite(bp); } - vnode_pager_setsize(ovp, length); /* * Calculate index into inode's block list of * last direct and indirect blocks (if any) @@ -445,9 +443,8 @@ last = lastbn % factor; nb = bap[i]; if (nb != 0) { - error = ext2_indirtrunc(ip, nlbn, fsbtodb(fs, nb), - last, level - 1, &blkcount); - if (error) + if ((error = ext2_indirtrunc(ip, nlbn, fsbtodb(fs, nb), + last, level - 1, &blkcount)) != 0) allerror = error; blocksreleased += blkcount; }