svn commit: r319735 - in head: sbin/mount_msdosfs sys/conf sys/fs/msdosfs sys/modules/msdosfs
Konstantin Belousov
kib at FreeBSD.org
Fri Jun 9 12:06:24 UTC 2017
Author: kib
Date: Fri Jun 9 12:06:22 2017
New Revision: 319735
URL: https://svnweb.freebsd.org/changeset/base/319735
Log:
Remove msdosfs -o large support.
Its purpose was to translate the values for msdosfs inode numbers,
which is calculated from the msdosfs structures describing the file,
into the range representable by 32bit ino_t. The translation acted
for filesystems larger than 128Gb, it reserved the range 0xf0000000
(FILENO_FIRST_DYN) to UINT32_MAX and remembered some arbitrary
translation of ino >= FILENO_FIRST_DYN into this range. It consumed
memory that could be only freed by unmount, and the translation was
not stable across remounts.
With ino_t type extended to 64 bit, there is no such issue and values
can be returned without compaction to 32bit. That is, for the native
environments, the translation layer is not necessary and adds
significant undeserved code complexity. For compat ABIs which use
32bit ino_t, the vfs.ino64_trunc_error sysctl provides some measures
to soften the failure mode when inode numbers truncation is not safe.
Discussed with: bde
Sponsored by: The FreeBSD Foundation
Deleted:
head/sys/fs/msdosfs/msdosfs_fileno.c
Modified:
head/sbin/mount_msdosfs/mount_msdosfs.8
head/sys/conf/files
head/sys/fs/msdosfs/msdosfs_vfsops.c
head/sys/fs/msdosfs/msdosfs_vnops.c
head/sys/fs/msdosfs/msdosfsmount.h
head/sys/modules/msdosfs/Makefile
Modified: head/sbin/mount_msdosfs/mount_msdosfs.8
==============================================================================
--- head/sbin/mount_msdosfs/mount_msdosfs.8 Fri Jun 9 11:17:08 2017 (r319734)
+++ head/sbin/mount_msdosfs/mount_msdosfs.8 Fri Jun 9 12:06:22 2017 (r319735)
@@ -30,7 +30,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 3, 2017
+.Dd May 28, 2017
.Dt MOUNT_MSDOSFS 8
.Os
.Sh NAME
@@ -73,11 +73,6 @@ as described in
.Xr mount 8 .
The following MSDOS file system-specific options are available:
.Bl -tag -width indent
-.It Cm large
-Support file systems larger than 128 gigabytes at the expense
-of 32 bytes of kernel memory for each file on disk.
-This memory will not be reclaimed until the file system has
-been unmounted.
.It Cm longnames
Force Windows 95 long filenames to be visible.
.It Cm shortnames
Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files Fri Jun 9 11:17:08 2017 (r319734)
+++ head/sys/conf/files Fri Jun 9 12:06:22 2017 (r319735)
@@ -3323,7 +3323,6 @@ fs/fuse/fuse_vnops.c optional fuse
fs/msdosfs/msdosfs_conv.c optional msdosfs
fs/msdosfs/msdosfs_denode.c optional msdosfs
fs/msdosfs/msdosfs_fat.c optional msdosfs
-fs/msdosfs/msdosfs_fileno.c optional msdosfs
fs/msdosfs/msdosfs_iconv.c optional msdosfs_iconv
fs/msdosfs/msdosfs_lookup.c optional msdosfs
fs/msdosfs/msdosfs_vfsops.c optional msdosfs
Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_vfsops.c Fri Jun 9 11:17:08 2017 (r319734)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.c Fri Jun 9 12:06:22 2017 (r319735)
@@ -82,7 +82,7 @@ static const char *msdosfs_opts[] = {
"async", "noatime", "noclusterr", "noclusterw",
"export", "force", "from", "sync",
"cs_dos", "cs_local", "cs_win", "dirmask",
- "gid", "kiconv", "large", "longname",
+ "gid", "kiconv", "longname",
"longnames", "mask", "shortname", "shortnames",
"uid", "win95", "nowin95",
NULL
@@ -242,17 +242,6 @@ msdosfs_mount(struct mount *mp)
*/
if (mp->mnt_flag & MNT_UPDATE) {
pmp = VFSTOMSDOSFS(mp);
- if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0)) {
- /*
- * Forbid export requests if filesystem has
- * MSDOSFS_LARGEFS flag set.
- */
- if ((pmp->pm_flags & MSDOSFS_LARGEFS) != 0) {
- vfs_mount_error(mp,
- "MSDOSFS_LARGEFS flag set, cannot export");
- return (EOPNOTSUPP);
- }
- }
if (!(pmp->pm_flags & MSDOSFSMNT_RONLY) &&
vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) {
error = VFS_SYNC(mp, MNT_WAIT);
@@ -467,20 +456,6 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp)
S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR;
/*
- * Experimental support for large MS-DOS filesystems.
- * WARNING: This uses at least 32 bytes of kernel memory (which is not
- * reclaimed until the FS is unmounted) for each file on disk to map
- * between the 32-bit inode numbers used by VFS and the 64-bit
- * pseudo-inode numbers used internally by msdosfs. This is only
- * safe to use in certain controlled situations (e.g. read-only FS
- * with less than 1 million files).
- * Since the mappings do not persist across unmounts (or reboots), these
- * filesystems are not suitable for exporting through NFS, or any other
- * application that requires fixed inode numbers.
- */
- vfs_flagopt(mp->mnt_optnew, "large", &pmp->pm_flags, MSDOSFS_LARGEFS);
-
- /*
* Compute several useful quantities from the bpb in the
* bootsector. Copy in the dos 5 variant of the bpb then fix up
* the fields that are different between dos 5 and dos 3.3.
@@ -521,20 +496,6 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp)
pmp->pm_HiddenSects = getushort(b33->bpbHiddenSecs);
pmp->pm_HugeSectors = pmp->pm_Sectors;
}
- if (!(pmp->pm_flags & MSDOSFS_LARGEFS)) {
- if (pmp->pm_HugeSectors > 0xffffffff /
- (pmp->pm_BytesPerSec / sizeof(struct direntry)) + 1) {
- /*
- * We cannot deal currently with this size of disk
- * due to fileid limitations (see msdosfs_getattr and
- * msdosfs_readdir)
- */
- error = EINVAL;
- vfs_mount_error(mp,
- "Disk too big, try '-o large' mount option");
- goto error_exit;
- }
- }
if (pmp->pm_RootDirEnts == 0) {
if (pmp->pm_FATsecs
@@ -745,11 +706,8 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp)
mp->mnt_kern_flag |= MNTK_USES_BCACHE | MNTK_NO_IOPF;
MNT_IUNLOCK(mp);
- if (pmp->pm_flags & MSDOSFS_LARGEFS)
- msdosfs_fileno_init(mp);
+ return (0);
- return 0;
-
error_exit:
if (bp)
brelse(bp);
@@ -835,8 +793,6 @@ msdosfs_unmount(struct mount *mp, int mntflags)
vrele(pmp->pm_devvp);
dev_rel(pmp->pm_dev);
free(pmp->pm_inusemap, M_MSDOSFSFAT);
- if (pmp->pm_flags & MSDOSFS_LARGEFS)
- msdosfs_fileno_free(mp);
lockdestroy(&pmp->pm_fatlock);
free(pmp, M_MSDOSFSMNT);
mp->mnt_data = NULL;
Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_vnops.c Fri Jun 9 11:17:08 2017 (r319734)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c Fri Jun 9 12:06:22 2017 (r319735)
@@ -284,12 +284,8 @@ msdosfs_getattr(struct vop_getattr_args *ap)
fileid = (uint64_t)roottobn(pmp, 0) * dirsperblk;
fileid += (uoff_t)dep->de_diroffset / sizeof(struct direntry);
}
+ vap->va_fileid = fileid;
- if (pmp->pm_flags & MSDOSFS_LARGEFS)
- vap->va_fileid = msdosfs_fileno_map(pmp->pm_mountp, fileid);
- else
- vap->va_fileid = (long)fileid;
-
mode = S_IRWXU|S_IRWXG|S_IRWXO;
vap->va_mode = mode &
(ap->a_vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask);
@@ -1472,7 +1468,6 @@ msdosfs_readdir(struct vop_readdir_args *ap)
int blsize;
long on;
u_long cn;
- uint64_t fileno;
u_long dirsperblk;
long bias = 0;
daddr_t bn, lbn;
@@ -1543,20 +1538,9 @@ msdosfs_readdir(struct vop_readdir_args *ap)
if (offset < bias) {
for (n = (int)offset / sizeof(struct direntry);
n < 2; n++) {
- if (FAT32(pmp))
- fileno = (uint64_t)cntobn(pmp,
- pmp->pm_rootdirblk)
- * dirsperblk;
- else
- fileno = 1;
- if (pmp->pm_flags & MSDOSFS_LARGEFS) {
- dirbuf.d_fileno =
- msdosfs_fileno_map(pmp->pm_mountp,
- fileno);
- } else {
-
- dirbuf.d_fileno = (uint32_t)fileno;
- }
+ dirbuf.d_fileno = FAT32(pmp) ?
+ (uint64_t)cntobn(pmp, pmp->pm_rootdirblk) *
+ dirsperblk : 1;
dirbuf.d_type = DT_DIR;
switch (n) {
case 0:
@@ -1661,31 +1645,24 @@ msdosfs_readdir(struct vop_readdir_args *ap)
* msdosfs_getattr.
*/
if (dentp->deAttributes & ATTR_DIRECTORY) {
- fileno = getushort(dentp->deStartCluster);
- if (FAT32(pmp))
- fileno |= getushort(dentp->deHighClust) << 16;
- /* if this is the root directory */
- if (fileno == MSDOSFSROOT)
- if (FAT32(pmp))
- fileno = (uint64_t)cntobn(pmp,
- pmp->pm_rootdirblk)
- * dirsperblk;
- else
- fileno = 1;
+ cn = getushort(dentp->deStartCluster);
+ if (FAT32(pmp)) {
+ cn |= getushort(dentp->deHighClust) <<
+ 16;
+ if (cn == MSDOSFSROOT)
+ cn = pmp->pm_rootdirblk;
+ }
+ if (cn == MSDOSFSROOT && !FAT32(pmp))
+ dirbuf.d_fileno = 1;
else
- fileno = (uint64_t)cntobn(pmp, fileno) *
+ dirbuf.d_fileno = cntobn(pmp, cn) *
dirsperblk;
dirbuf.d_type = DT_DIR;
} else {
- fileno = (uoff_t)offset /
+ dirbuf.d_fileno = (uoff_t)offset /
sizeof(struct direntry);
dirbuf.d_type = DT_REG;
}
- if (pmp->pm_flags & MSDOSFS_LARGEFS) {
- dirbuf.d_fileno =
- msdosfs_fileno_map(pmp->pm_mountp, fileno);
- } else
- dirbuf.d_fileno = (uint32_t)fileno;
if (chksum != winChksum(dentp->deName)) {
dirbuf.d_namlen = dos2unixfn(dentp->deName,
Modified: head/sys/fs/msdosfs/msdosfsmount.h
==============================================================================
--- head/sys/fs/msdosfs/msdosfsmount.h Fri Jun 9 11:17:08 2017 (r319734)
+++ head/sys/fs/msdosfs/msdosfsmount.h Fri Jun 9 12:06:22 2017 (r319735)
@@ -108,10 +108,7 @@ struct msdosfsmount {
void *pm_w2u; /* Unicode->Local iconv handle */
void *pm_u2d; /* Unicode->DOS iconv handle */
void *pm_d2u; /* DOS->Local iconv handle */
- uint32_t pm_nfileno; /* next 32-bit fileno */
- RB_HEAD(msdosfs_filenotree, msdosfs_fileno)
- pm_filenos; /* 64<->32-bit fileno mapping */
- struct lock pm_fatlock; /* lockmgr protecting allocations and rb tree */
+ struct lock pm_fatlock; /* lockmgr protecting allocations */
};
/*
@@ -216,10 +213,6 @@ struct msdosfs_fileno {
? roottobn((pmp), (dirofs)) \
: cntobn((pmp), (dirclu)))
-void msdosfs_fileno_init(struct mount *);
-void msdosfs_fileno_free(struct mount *);
-uint32_t msdosfs_fileno_map(struct mount *, uint64_t);
-
#define MSDOSFS_LOCK_MP(pmp) \
lockmgr(&(pmp)->pm_fatlock, LK_EXCLUSIVE, NULL)
#define MSDOSFS_UNLOCK_MP(pmp) \
@@ -261,7 +254,6 @@ struct msdosfs_args {
#define MSDOSFSMNT_RONLY 0x80000000 /* mounted read-only */
#define MSDOSFSMNT_WAITONFAT 0x40000000 /* mounted synchronous */
#define MSDOSFS_FATMIRROR 0x20000000 /* FAT is mirrored */
-#define MSDOSFS_LARGEFS 0x10000000 /* perform fileno mapping */
#define MSDOSFS_FSIMOD 0x01000000
#endif /* !_MSDOSFS_MSDOSFSMOUNT_H_ */
Modified: head/sys/modules/msdosfs/Makefile
==============================================================================
--- head/sys/modules/msdosfs/Makefile Fri Jun 9 11:17:08 2017 (r319734)
+++ head/sys/modules/msdosfs/Makefile Fri Jun 9 12:06:22 2017 (r319735)
@@ -4,7 +4,7 @@
KMOD= msdosfs
SRCS= vnode_if.h \
- msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_fileno.c \
+ msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c \
msdosfs_lookup.c msdosfs_vfsops.c msdosfs_vnops.c
EXPORT_SYMS= msdosfs_iconv
More information about the svn-src-all
mailing list