summaryrefslogtreecommitdiffstats
path: root/sys/fs/ntfs/ntfs_vfsops.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-07-26 02:21:49 +0000
committertjr <tjr@FreeBSD.org>2003-07-26 02:21:49 +0000
commit7abd31ac6d9d1aa673ef48e09391f3dfd6941e8f (patch)
tree1abba6187b8491ee70aa9ca92f0365fa5d813fdf /sys/fs/ntfs/ntfs_vfsops.c
parent3c92e21eeb938c38b87965deb5e22241b9b268de (diff)
downloadFreeBSD-src-7abd31ac6d9d1aa673ef48e09391f3dfd6941e8f.zip
FreeBSD-src-7abd31ac6d9d1aa673ef48e09391f3dfd6941e8f.tar.gz
Revise and improve ntfs_subr.c 1.30: read only a single cluster at a time
in ntfs_writentvattr_plain and ntfs_readntvattr_plain, and purge the boot block from the buffer cache if isn't exactly one cluster long. These two changes work around the same buffer cache bug that ntfs_subr.c 1.30 tried to, but in a different way. This may decrease throughput by reading smaller amounts of data from the disk at a time, but may increase it by avoiding bogus writes of clean buffers. Problem (re)reported by Karel J. Bosschaart on -current.
Diffstat (limited to 'sys/fs/ntfs/ntfs_vfsops.c')
-rw-r--r--sys/fs/ntfs/ntfs_vfsops.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c
index 0f3e60e..f01c6ff 100644
--- a/sys/fs/ntfs/ntfs_vfsops.c
+++ b/sys/fs/ntfs/ntfs_vfsops.c
@@ -311,6 +311,14 @@ ntfs_mountfs(devvp, mp, argsp, td)
goto out;
ntmp = malloc( sizeof *ntmp, M_NTFSMNT, M_WAITOK | M_ZERO);
bcopy( bp->b_data, &ntmp->ntm_bootfile, sizeof(struct bootfile) );
+ /*
+ * We must not cache the boot block if its size is not exactly
+ * one cluster in order to avoid confusing the buffer cache when
+ * the boot file is read later by ntfs_readntvattr_plain(), which
+ * reads a cluster at a time.
+ */
+ if (ntfs_cntob(1) != BBSIZE)
+ bp->b_flags |= B_NOCACHE;
brelse( bp );
bp = NULL;
OpenPOWER on IntegriCloud