PERFORCE change 170005 for review

Aditya Sarawgi truncs at FreeBSD.org
Sat Oct 31 16:48:54 UTC 2009


http://p4web.freebsd.org/chv.cgi?CH=170005

Change 170005 by truncs at 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.


More information about the p4-projects mailing list