summaryrefslogtreecommitdiffstats
path: root/sys/fs/msdosfs
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2007-07-12 17:17:47 +0000
committerbde <bde@FreeBSD.org>2007-07-12 17:17:47 +0000
commitdba17f21d375effcf89349e1d86b34b2f408ad0b (patch)
tree4158e3668ebe22dacaf64729dcd3f690623503d0 /sys/fs/msdosfs
parent441582040c22d482801d42047860f700b6035be8 (diff)
downloadFreeBSD-src-dba17f21d375effcf89349e1d86b34b2f408ad0b.zip
FreeBSD-src-dba17f21d375effcf89349e1d86b34b2f408ad0b.tar.gz
Round up the FAT block size to a multiple of the sector size so that i/o
to the FAT is possible. Make the FAT block size less arbitrary before it is rounded up: - for FAT12, default to 3*512 instead of to 3 sectors. The magic 3 is the default number of 512-byte FAT sectors on a floppy drive. That many sectors is too many if the sector size is larger. - for !FAT12, default to PAGE_SIZE instead of to 4096. Remove MSDOSFS_DFLTBSIZE since it only obfuscated this 4096. For reading the BPB, use a block size of 8192 instead of 2048 so that sector sizes up to 8192 can work. We should try several sizes, or just try the maximum supported size (MAXBSIZE = 64K). I use 8192 because that is enough for DVD-RW's (even 2048 is enough) and 8192 has been tested a lot in use by ffs. This completes fixing msdosfs for some large sector sizes (up to 8K for read and 64K for write). Microsoft documents support for sector sizes up to 4K in mdosfs. ffs is currently limited to 8K for both read and write. Approved by: re (kensmith) Approved by: nyan (several years ago)
Diffstat (limited to 'sys/fs/msdosfs')
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index 8c30fde..ee09185 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -85,8 +85,6 @@ static const char *msdosfs_opts[] = {
NULL
};
-#define MSDOSFS_DFLTBSIZE 4096
-
#if 1 /*def PC98*/
/*
* XXX - The boot signature formatted by NEC PC-98 DOS looks like a
@@ -423,9 +421,9 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp, struct thread *td)
* Read the boot sector of the filesystem, and then check the
* boot signature. If not a dos boot sector then error out.
*
- * NOTE: 2048 is a maximum sector size in current...
+ * NOTE: 8192 is a magic size that works for ffs.
*/
- error = bread(devvp, 0, 2048, NOCRED, &bp);
+ error = bread(devvp, 0, 8192, NOCRED, &bp);
if (error)
goto error_exit;
bp->b_flags |= B_AGE;
@@ -606,12 +604,12 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp, struct thread *td)
pmp->pm_maxcluster = clusters - 1;
}
-
if (FAT12(pmp))
- pmp->pm_fatblocksize = 3 * pmp->pm_BytesPerSec;
+ pmp->pm_fatblocksize = 3 * 512;
else
- pmp->pm_fatblocksize = MSDOSFS_DFLTBSIZE;
-
+ pmp->pm_fatblocksize = PAGE_SIZE;
+ pmp->pm_fatblocksize = roundup(pmp->pm_fatblocksize,
+ pmp->pm_BytesPerSec);
pmp->pm_fatblocksec = pmp->pm_fatblocksize / DEV_BSIZE;
pmp->pm_bnshift = ffs(DEV_BSIZE) - 1;
OpenPOWER on IntegriCloud