Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Mar 1998 02:53:12 +0300
From:      Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
To:        dmaddox@scsn.net
Cc:        current@FreeBSD.ORG, mike@smith.net.au
Subject:   Re: MSDOSFS Broken(?) 
Message-ID:  <199803022353.CAA00516@tejblum.dnttm.rssi.ru>
In-Reply-To: Your message of "Mon, 02 Mar 1998 17:15:44 EST." <19980302171544.21782@scsn.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
Donald J. Maddox wrote:

> After a 'make world' and a new kernel from sources cvsupped ~10PM EST
> last night, it seems that msdosfs is broken...  Files that are known
> to be good appear corrupt when accessed from FBSD.

Sorry, the fix I sent to Mike yesterday was incomplete, and broke more 
than fixed. Try the next one. Beware: I want to sleep. (But I tried 
it...)

Dima

--- msdosfs_vnops.c	Tue Mar  3 01:59:43 1998
+++ msdosfs_vnops.c	Tue Mar  3 02:48:28 1998
@@ -552,7 +552,7 @@ msdosfs_read(ap)
 	long n;
 	long on;
 	daddr_t lbn;
-	daddr_t rablock, rablock1;
+	daddr_t rablock;
 	int rasize;
 	struct buf *bp;
 	struct vnode *vp = ap->a_vp;
@@ -602,14 +602,12 @@ msdosfs_read(ap)
 #endif
 			if (vp->v_lastr + 1 == lbn &&
 			    de_cn2off(pmp, rablock) < dep->de_FileSize) {
-				rablock1 = de_cn2bn(pmp, rablock);
 				rasize = pmp->pm_bpcluster;
-				error = breadn(vp, de_cn2bn(pmp, lbn),
-				    pmp->pm_bpcluster, &rablock1, &rasize, 1,
-				    NOCRED, &bp); 
+				error = breadn(vp, lbn, pmp->pm_bpcluster,
+				    &rablock, &rasize, 1, NOCRED, &bp); 
 			} else
-				error = bread(vp, de_cn2bn(pmp, lbn),
-				    pmp->pm_bpcluster, NOCRED, &bp);
+				error = bread(vp, lbn, pmp->pm_bpcluster, 
+				    NOCRED, &bp);
 			vp->v_lastr = lbn;
 		}
 		n = min(n, pmp->pm_bpcluster - bp->b_resid);
@@ -742,9 +740,10 @@ msdosfs_write(ap)
 			vnode_pager_setsize(vp, dep->de_FileSize);
 		}
 
-		bn = de_blk(pmp, uio->uio_offset);
+		bn = de_cluster(pmp, uio->uio_offset);
 		if ((uio->uio_offset & pmp->pm_crbomask) == 0
-		    && (de_blk(pmp, uio->uio_offset + uio->uio_resid) > de_blk(pmp, uio->uio_offset)
+		    && (de_cluster(pmp, uio->uio_offset + uio->uio_resid) 
+		        > de_cluster(pmp, uio->uio_offset)
 			|| uio->uio_offset + uio->uio_resid >= dep->de_FileSize)) {
 			/*
 			 * If either the whole cluster gets written,
@@ -758,9 +757,8 @@ msdosfs_write(ap)
 			 * for the fat table. (see msdosfs_strategy)
 			 */
 			if (bp->b_blkno == bp->b_lblkno) {
-				error = pcbmap(dep,
-					       de_bn2cn(pmp, bp->b_lblkno),
-					       &bp->b_blkno, 0, 0);
+				error = pcbmap(dep, bp->b_lblkno, &bp->b_blkno, 
+				     0, 0);
 				if (error)
 					bp->b_blkno = -1;
 			}



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803022353.CAA00516>