patch-2.3.99-pre1 linux/fs/hpfs/buffer.c

Next file: linux/fs/hpfs/hpfs_fn.h
Previous file: linux/fs/hfs/super.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.51/linux/fs/hpfs/buffer.c linux/fs/hpfs/buffer.c
@@ -125,7 +125,8 @@
 	kdev_t dev = s->s_dev;
 	struct buffer_head *bh;
 
-	if (!ahead || secno + ahead >= s->s_hpfs_fs_size)
+					/* vvvv - workaround for the breada bug */
+	if (!ahead || secno + ahead + (read_ahead[MAJOR(dev)] >> 9) >= s->s_hpfs_fs_size)
 		*bhp = bh = bread(dev, secno, 512);
 	else *bhp = bh = breada(dev, secno, 512, 0, (ahead + 1) << 9);
 	if (bh != NULL)
@@ -144,6 +145,7 @@
 	/*return hpfs_map_sector(s, secno, bhp, 0);*/
 
 	if ((*bhp = bh = getblk(s->s_dev, secno, 512)) != NULL) {
+		if (!buffer_uptodate(bh)) wait_on_buffer(bh);
 		mark_buffer_uptodate(bh, 1);
 		return bh->b_data;
 	} else {
@@ -172,8 +174,9 @@
 		goto bail;
 	}
 
-	if (!ahead || secno + 4 + ahead > s->s_hpfs_fs_size)
-		qbh->bh[0] = bh = breada(dev, secno, 512, 0, 2048);
+					/* vvvv - workaround for the breada bug */
+	if (!ahead || secno + 4 + ahead + (read_ahead[MAJOR(dev)] >> 9) > s->s_hpfs_fs_size)
+		qbh->bh[0] = bh = bread(dev, secno, 512);
 	else qbh->bh[0] = bh = breada(dev, secno, 512, 0, (ahead + 4) << 9);
 	if (!bh)
 		goto bail0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)