From owner-p4-projects@FreeBSD.ORG Sat Oct 31 16:48:54 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4F220106568D; Sat, 31 Oct 2009 16:48:54 +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 1392D1065694 for ; Sat, 31 Oct 2009 16:48:54 +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 00DA08FC0A for ; Sat, 31 Oct 2009 16:48:54 +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 n9VGmrrY097934 for ; Sat, 31 Oct 2009 16:48:53 GMT (envelope-from truncs@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n9VGmrME097932 for perforce@freebsd.org; Sat, 31 Oct 2009 16:48:53 GMT (envelope-from truncs@FreeBSD.org) Date: Sat, 31 Oct 2009 16:48:53 GMT Message-Id: <200910311648.n9VGmrME097932@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 Precedence: bulk Cc: Subject: PERFORCE change 170005 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: Sat, 31 Oct 2009 16:48:54 -0000 http://p4web.freebsd.org/chv.cgi?CH=170005 Change 170005 by truncs@aditya on 2009/10/31 16:47:58 - Sync changes from ffs. - Intoduce Buffer Object and it's locks. Affected files ... .. //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_inode.c#8 edit Differences ... ==== //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_inode.c#8 (text+ko) ==== @@ -75,14 +75,15 @@ struct inode *ip; int error; + ASSERT_VOP_ELOCKED(vp, "ext2_update"); ext2_itimes(vp); ip = VTOI(vp); - if ((ip->i_flag & IN_MODIFIED) == 0) + if ((ip->i_flag & IN_MODIFIED) == 0 && waitfor == 0) return (0); - ip->i_flag &= ~(IN_LAZYMOD | IN_MODIFIED); - if (vp->v_mount->mnt_flag & MNT_RDONLY) + ip->i_flag &= ~(IN_LAZYACCESS | IN_LAZYMOD | IN_MODIFIED); + fs = ip->i_e2fs; + if(fs->e2fs_ronly) return (0); - fs = ip->i_e2fs; if ((error = bread(ip->i_devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), (int)fs->e2fs_bsize, NOCRED, &bp)) != 0) { @@ -119,6 +120,7 @@ struct inode *oip; int32_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR]; int32_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; + struct bufobj *bo; struct m_ext2fs *fs; struct buf *bp; int offset, size, level; @@ -127,6 +129,10 @@ off_t osize; oip = VTOI(ovp); + bo = &ovp->v_bufobj; + + ASSERT_VOP_LOCKED(vp, "ext2_truncate"); + if (length < 0) return (EINVAL); @@ -329,11 +335,11 @@ for (i = 0; i < NDADDR; i++) if (newblks[i] != oip->i_db[i]) panic("itrunc2"); - VI_LOCK(ovp); - if (length == 0 && (ovp->v_bufobj.bo_dirty.bv_cnt != 0 || - ovp->v_bufobj.bo_clean.bv_cnt != 0)) + BO_LOCK(bo); + if (length == 0 && (bo->bo_dirty.bv_cnt != 0 || + bo->bo_clean.bv_cnt != 0)) panic("itrunc3"); - VI_UNLOCK(ovp); + BO_UNLOCK(ovp); #endif /* DIAGNOSTIC */ /* * Put back the real size.