Clustered read and write are switched at mount-option level.
1. Clustered I/O is switched by the MNT_NOCLUSTERR and MNT_NOCLUSTERW bits of the mnt_flag. The sysctl variables, vfs.foo.doclusterread and vfs.foo.doclusterwrite are deleted. Only mount option can control clustered I/O from userland. 2. When foofs_mount mounts block device, foofs_mount checks D_CLUSTERR and D_CLUSTERW bits of the d_flags member in the block device switch table. If D_NOCLUSTERR / D_NOCLUSTERW are set, MNT_NOCLUSTERR / MNT_NOCLUSTERW bits will be set. In this case, MNT_NOCLUSTERR and MNT_NOCLUSTERW cannot be cleared from userland. 3. Vnode driver disables both clustered read and write. 4. Union filesystem disables clutered write. Reviewed by: bde
This commit is contained in:
parent
c143dd2c94
commit
f067b60f38
@ -38,7 +38,7 @@
|
||||
* from: Utah Hdr: vn.c 1.13 94/04/02
|
||||
*
|
||||
* from: @(#)vn.c 8.6 (Berkeley) 4/1/94
|
||||
* $Id: vn.c,v 1.48 1997/06/14 13:56:09 bde Exp $
|
||||
* $Id: vn.c,v 1.49 1997/08/14 13:44:19 kato Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -101,8 +101,8 @@ static d_strategy_t vnstrategy;
|
||||
#define BDEV_MAJOR 15
|
||||
static struct cdevsw vn_cdevsw;
|
||||
static struct bdevsw vn_bdevsw =
|
||||
{ vnopen, vnclose, vnstrategy, vnioctl, /*15*/
|
||||
vndump, vnsize, D_DISK, "vn", &vn_cdevsw, -1 };
|
||||
{ vnopen, vnclose, vnstrategy, vnioctl, /*15*/
|
||||
vndump, vnsize, D_DISK | D_NOCLUSTERRW, "vn", &vn_cdevsw, -1 };
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
|
||||
* $Id: cd9660_vfsops.c,v 1.27 1997/08/16 19:15:00 wollman Exp $
|
||||
* $Id: cd9660_vfsops.c,v 1.28 1997/09/07 16:20:42 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -183,9 +183,11 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
int error;
|
||||
struct iso_mnt *imp = 0;
|
||||
|
||||
if ((mp->mnt_flag & MNT_ROOTFS) != 0)
|
||||
if ((mp->mnt_flag & MNT_ROOTFS) != 0) {
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
return (iso_mountroot(mp, p));
|
||||
|
||||
}
|
||||
if ((error = copyin(data, (caddr_t)&args, sizeof (struct iso_args))))
|
||||
return (error);
|
||||
|
||||
@ -195,9 +197,13 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
/*
|
||||
* If updating, check whether changing from read-only to
|
||||
* read/write; if there is no device name, that's all we do.
|
||||
* Disallow clearing MNT_NOCLUSTERR flag, if block device requests.
|
||||
*/
|
||||
if (mp->mnt_flag & MNT_UPDATE) {
|
||||
imp = VFSTOISOFS(mp);
|
||||
if (bdevsw[major(imp->im_devvp->v_rdev)]->d_flags &
|
||||
D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (args.fspec == 0)
|
||||
return (vfs_export(mp, &imp->im_export, &args.export));
|
||||
}
|
||||
@ -218,9 +224,11 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
vrele(devvp);
|
||||
return ENXIO;
|
||||
}
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0)
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0) {
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
error = iso_mountfs(devvp, mp, p, &args);
|
||||
else {
|
||||
} else {
|
||||
if (devvp != imp->im_devvp)
|
||||
error = EINVAL; /* needs translation */
|
||||
else
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95
|
||||
* $Id: cd9660_vnops.c,v 1.38 1997/09/14 02:57:43 peter Exp $
|
||||
* $Id: cd9660_vnops.c,v 1.39 1997/09/21 04:22:40 dyson Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -80,17 +80,6 @@ static int cd9660_strategy __P((struct vop_strategy_args *));
|
||||
static int cd9660_print __P((struct vop_print_args *));
|
||||
static int cd9660_islocked __P((struct vop_islocked_args *));
|
||||
|
||||
/*
|
||||
* Sysctl values for the cd9660 filesystem.
|
||||
*/
|
||||
#define CD9660_CLUSTERREAD 1 /* cluster reading enabled */
|
||||
#define CD9660_MAXID 2 /* number of valid cd9660 ids */
|
||||
|
||||
#define CD9660_NAMES { \
|
||||
{0, 0}, \
|
||||
{ "doclusterread", CTLTYPE_INT}, \
|
||||
}
|
||||
|
||||
/*
|
||||
* Setattr call. Only allowed for block and character special devices.
|
||||
*/
|
||||
@ -299,11 +288,6 @@ cd9660_getattr(ap)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int cd9660_doclusterread = 1;
|
||||
SYSCTL_NODE(_vfs, MOUNT_CD9660, cd9660, CTLFLAG_RW, 0, "CD9660 filesystem");
|
||||
SYSCTL_INT(_vfs_cd9660, CD9660_CLUSTERREAD, doclusterread,
|
||||
CTLFLAG_RW, &cd9660_doclusterread, 0, "");
|
||||
|
||||
/*
|
||||
* Vnode op for reading.
|
||||
*/
|
||||
@ -344,7 +328,7 @@ cd9660_read(ap)
|
||||
n = diff;
|
||||
size = blksize(imp, ip, lbn);
|
||||
rablock = lbn + 1;
|
||||
if (cd9660_doclusterread) {
|
||||
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
|
||||
if (lblktosize(imp, rablock) <= ip->i_size)
|
||||
error = cluster_read(vp, (off_t)ip->i_size,
|
||||
lbn, size, NOCRED, uio->uio_resid,
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
|
||||
* $Id: spec_vnops.c,v 1.41 1997/09/02 20:06:12 bde Exp $
|
||||
* $Id: spec_vnops.c,v 1.42 1997/09/14 02:58:02 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -176,7 +176,8 @@ spec_open(ap)
|
||||
*/
|
||||
if (securelevel >= 2
|
||||
&& cdevsw[maj]->d_bdev
|
||||
&& cdevsw[maj]->d_bdev->d_flags == D_DISK)
|
||||
&& (cdevsw[maj]->d_bdev->d_flags & D_TYPEMASK) ==
|
||||
D_DISK)
|
||||
return (EPERM);
|
||||
/*
|
||||
* When running in secure mode, do not allow opens
|
||||
@ -220,7 +221,8 @@ spec_open(ap)
|
||||
* opens for writing of any disk block devices.
|
||||
*/
|
||||
if (securelevel >= 2 && ap->a_cred != FSCRED &&
|
||||
(ap->a_mode & FWRITE) && bdevsw[maj]->d_flags == D_DISK)
|
||||
(ap->a_mode & FWRITE) &&
|
||||
(bdevsw[maj]->d_flags & D_TYPEMASK) == D_DISK)
|
||||
return (EPERM);
|
||||
/*
|
||||
* Do not allow opens of block devices that are
|
||||
@ -422,7 +424,8 @@ spec_ioctl(ap)
|
||||
|
||||
case VBLK:
|
||||
if (ap->a_command == 0 && (int)ap->a_data == B_TAPE)
|
||||
if (bdevsw[major(dev)]->d_flags == D_TAPE)
|
||||
if ((bdevsw[major(dev)]->d_flags & D_TYPEMASK) ==
|
||||
D_TAPE)
|
||||
return (0);
|
||||
else
|
||||
return (1);
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)union_vfsops.c 8.20 (Berkeley) 5/20/95
|
||||
* $Id: union_vfsops.c,v 1.18 1997/08/02 14:32:29 bde Exp $
|
||||
* $Id: union_vfsops.c,v 1.19 1997/08/16 19:15:22 wollman Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -102,6 +102,11 @@ union_mount(mp, path, data, ndp, p)
|
||||
printf("union_mount(mp = %x)\n", mp);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Disable clustered write, otherwise system becomes unstable.
|
||||
*/
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
|
||||
/*
|
||||
* Update is a no-op
|
||||
*/
|
||||
|
@ -42,19 +42,6 @@
|
||||
#ifndef _SYS_GNU_EXT2FS_EXT2_EXTERN_H_
|
||||
#define _SYS_GNU_EXT2FS_EXT2_EXTERN_H_
|
||||
|
||||
/*
|
||||
* Sysctl values for the ext2fs filesystem.
|
||||
*/
|
||||
#define EXT2FS_CLUSTERREAD 1 /* cluster reading enabled */
|
||||
#define EXT2FS_CLUSTERWRITE 2 /* cluster writing enable */
|
||||
#define EXT2FS_MAXID 3 /* number of valid ext2fs ids */
|
||||
|
||||
#define EXT2FS_NAMES {\
|
||||
{0, 0}, \
|
||||
{ "doclusterread", CTLTYPE_INT }, \
|
||||
{ "doculsterwrite", CTLTYPE_INT }, \
|
||||
}
|
||||
|
||||
struct dinode;
|
||||
struct ext2_inode;
|
||||
struct inode;
|
||||
|
@ -112,7 +112,7 @@ READ(ap)
|
||||
|
||||
if (lblktosize(fs, nextlbn) >= ip->i_size)
|
||||
error = bread(vp, lbn, size, NOCRED, &bp);
|
||||
else if (ext2_doclusterread)
|
||||
else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0)
|
||||
error = cluster_read(vp,
|
||||
ip->i_size, lbn, size, NOCRED,
|
||||
uio->uio_resid, (ap->a_ioflag >> 16), &bp);
|
||||
@ -277,7 +277,7 @@ WRITE(ap)
|
||||
if (ioflag & IO_SYNC) {
|
||||
(void)bwrite(bp);
|
||||
} else if (xfersize + blkoffset == fs->s_frag_size) {
|
||||
if (ext2_doclusterwrite) {
|
||||
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) {
|
||||
#if defined(__FreeBSD__)
|
||||
bp->b_flags |= B_CLUSTEROK;
|
||||
#endif
|
||||
|
@ -149,6 +149,10 @@ ext2_mountroot()
|
||||
bzero((char *)mp, (u_long)sizeof(struct mount));
|
||||
mp->mnt_op = &ext2fs_vfsops;
|
||||
mp->mnt_flag = MNT_RDONLY;
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
if (error = ext2_mountfs(rootvp, mp, p)) {
|
||||
bsd_free(mp, M_MOUNT);
|
||||
return (error);
|
||||
@ -206,11 +210,17 @@ ext2_mount(mp, path, data, ndp, p)
|
||||
/*
|
||||
* If updating, check whether changing from read-only to
|
||||
* read/write; if there is no device name, that's all we do.
|
||||
* Disallow clearing MNT_NOCLUSTERR and MNT_NOCLUSTERW flags,
|
||||
* if block device requests.
|
||||
*/
|
||||
if (mp->mnt_flag & MNT_UPDATE) {
|
||||
ump = VFSTOUFS(mp);
|
||||
fs = ump->um_e2fs;
|
||||
error = 0;
|
||||
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
if (fs->s_rd_only == 0 && (mp->mnt_flag & MNT_RDONLY)) {
|
||||
flags = WRITECLOSE;
|
||||
if (mp->mnt_flag & MNT_FORCE)
|
||||
@ -255,9 +265,13 @@ ext2_mount(mp, path, data, ndp, p)
|
||||
vrele(devvp);
|
||||
return (ENXIO);
|
||||
}
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0)
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0) {
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
error = ext2_mountfs(devvp, mp, p);
|
||||
else {
|
||||
} else {
|
||||
if (devvp != ump->um_devvp)
|
||||
error = EINVAL; /* needs translation */
|
||||
else
|
||||
|
@ -237,17 +237,6 @@ static struct vnodeopv_desc ext2fs_fifoop_opv_desc =
|
||||
VNODEOP_SET(ext2fs_fifoop_opv_desc);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enabling cluster read/write operations.
|
||||
*/
|
||||
static int ext2_doclusterread = 1;
|
||||
static int ext2_doclusterwrite = 1;
|
||||
SYSCTL_NODE(_vfs, MOUNT_EXT2FS, ext2fs, CTLFLAG_RW, 0, "EXT2FS filesystem");
|
||||
SYSCTL_INT(_vfs_ext2fs, EXT2FS_CLUSTERREAD, doclusterread,
|
||||
CTLFLAG_RW, &ext2_doclusterread, 0, "");
|
||||
SYSCTL_INT(_vfs_ext2fs, EXT2FS_CLUSTERWRITE, doclusterwrite,
|
||||
CTLFLAG_RW, &ext2_doclusterwrite, 0, "");
|
||||
|
||||
#include <gnu/ext2fs/ext2_readwrite.c>
|
||||
|
||||
/*
|
||||
|
@ -42,19 +42,6 @@
|
||||
#ifndef _SYS_GNU_EXT2FS_EXT2_EXTERN_H_
|
||||
#define _SYS_GNU_EXT2FS_EXT2_EXTERN_H_
|
||||
|
||||
/*
|
||||
* Sysctl values for the ext2fs filesystem.
|
||||
*/
|
||||
#define EXT2FS_CLUSTERREAD 1 /* cluster reading enabled */
|
||||
#define EXT2FS_CLUSTERWRITE 2 /* cluster writing enable */
|
||||
#define EXT2FS_MAXID 3 /* number of valid ext2fs ids */
|
||||
|
||||
#define EXT2FS_NAMES {\
|
||||
{0, 0}, \
|
||||
{ "doclusterread", CTLTYPE_INT }, \
|
||||
{ "doculsterwrite", CTLTYPE_INT }, \
|
||||
}
|
||||
|
||||
struct dinode;
|
||||
struct ext2_inode;
|
||||
struct inode;
|
||||
|
@ -112,7 +112,7 @@ READ(ap)
|
||||
|
||||
if (lblktosize(fs, nextlbn) >= ip->i_size)
|
||||
error = bread(vp, lbn, size, NOCRED, &bp);
|
||||
else if (ext2_doclusterread)
|
||||
else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0)
|
||||
error = cluster_read(vp,
|
||||
ip->i_size, lbn, size, NOCRED,
|
||||
uio->uio_resid, (ap->a_ioflag >> 16), &bp);
|
||||
@ -277,7 +277,7 @@ WRITE(ap)
|
||||
if (ioflag & IO_SYNC) {
|
||||
(void)bwrite(bp);
|
||||
} else if (xfersize + blkoffset == fs->s_frag_size) {
|
||||
if (ext2_doclusterwrite) {
|
||||
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) {
|
||||
#if defined(__FreeBSD__)
|
||||
bp->b_flags |= B_CLUSTEROK;
|
||||
#endif
|
||||
|
@ -149,6 +149,10 @@ ext2_mountroot()
|
||||
bzero((char *)mp, (u_long)sizeof(struct mount));
|
||||
mp->mnt_op = &ext2fs_vfsops;
|
||||
mp->mnt_flag = MNT_RDONLY;
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
if (error = ext2_mountfs(rootvp, mp, p)) {
|
||||
bsd_free(mp, M_MOUNT);
|
||||
return (error);
|
||||
@ -206,11 +210,17 @@ ext2_mount(mp, path, data, ndp, p)
|
||||
/*
|
||||
* If updating, check whether changing from read-only to
|
||||
* read/write; if there is no device name, that's all we do.
|
||||
* Disallow clearing MNT_NOCLUSTERR and MNT_NOCLUSTERW flags,
|
||||
* if block device requests.
|
||||
*/
|
||||
if (mp->mnt_flag & MNT_UPDATE) {
|
||||
ump = VFSTOUFS(mp);
|
||||
fs = ump->um_e2fs;
|
||||
error = 0;
|
||||
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
if (fs->s_rd_only == 0 && (mp->mnt_flag & MNT_RDONLY)) {
|
||||
flags = WRITECLOSE;
|
||||
if (mp->mnt_flag & MNT_FORCE)
|
||||
@ -255,9 +265,13 @@ ext2_mount(mp, path, data, ndp, p)
|
||||
vrele(devvp);
|
||||
return (ENXIO);
|
||||
}
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0)
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0) {
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
error = ext2_mountfs(devvp, mp, p);
|
||||
else {
|
||||
} else {
|
||||
if (devvp != ump->um_devvp)
|
||||
error = EINVAL; /* needs translation */
|
||||
else
|
||||
|
@ -237,17 +237,6 @@ static struct vnodeopv_desc ext2fs_fifoop_opv_desc =
|
||||
VNODEOP_SET(ext2fs_fifoop_opv_desc);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enabling cluster read/write operations.
|
||||
*/
|
||||
static int ext2_doclusterread = 1;
|
||||
static int ext2_doclusterwrite = 1;
|
||||
SYSCTL_NODE(_vfs, MOUNT_EXT2FS, ext2fs, CTLFLAG_RW, 0, "EXT2FS filesystem");
|
||||
SYSCTL_INT(_vfs_ext2fs, EXT2FS_CLUSTERREAD, doclusterread,
|
||||
CTLFLAG_RW, &ext2_doclusterread, 0, "");
|
||||
SYSCTL_INT(_vfs_ext2fs, EXT2FS_CLUSTERWRITE, doclusterwrite,
|
||||
CTLFLAG_RW, &ext2_doclusterwrite, 0, "");
|
||||
|
||||
#include <gnu/ext2fs/ext2_readwrite.c>
|
||||
|
||||
/*
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
|
||||
* $Id: cd9660_vfsops.c,v 1.27 1997/08/16 19:15:00 wollman Exp $
|
||||
* $Id: cd9660_vfsops.c,v 1.28 1997/09/07 16:20:42 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -183,9 +183,11 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
int error;
|
||||
struct iso_mnt *imp = 0;
|
||||
|
||||
if ((mp->mnt_flag & MNT_ROOTFS) != 0)
|
||||
if ((mp->mnt_flag & MNT_ROOTFS) != 0) {
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
return (iso_mountroot(mp, p));
|
||||
|
||||
}
|
||||
if ((error = copyin(data, (caddr_t)&args, sizeof (struct iso_args))))
|
||||
return (error);
|
||||
|
||||
@ -195,9 +197,13 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
/*
|
||||
* If updating, check whether changing from read-only to
|
||||
* read/write; if there is no device name, that's all we do.
|
||||
* Disallow clearing MNT_NOCLUSTERR flag, if block device requests.
|
||||
*/
|
||||
if (mp->mnt_flag & MNT_UPDATE) {
|
||||
imp = VFSTOISOFS(mp);
|
||||
if (bdevsw[major(imp->im_devvp->v_rdev)]->d_flags &
|
||||
D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (args.fspec == 0)
|
||||
return (vfs_export(mp, &imp->im_export, &args.export));
|
||||
}
|
||||
@ -218,9 +224,11 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
vrele(devvp);
|
||||
return ENXIO;
|
||||
}
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0)
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0) {
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
error = iso_mountfs(devvp, mp, p, &args);
|
||||
else {
|
||||
} else {
|
||||
if (devvp != imp->im_devvp)
|
||||
error = EINVAL; /* needs translation */
|
||||
else
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95
|
||||
* $Id: cd9660_vnops.c,v 1.38 1997/09/14 02:57:43 peter Exp $
|
||||
* $Id: cd9660_vnops.c,v 1.39 1997/09/21 04:22:40 dyson Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -80,17 +80,6 @@ static int cd9660_strategy __P((struct vop_strategy_args *));
|
||||
static int cd9660_print __P((struct vop_print_args *));
|
||||
static int cd9660_islocked __P((struct vop_islocked_args *));
|
||||
|
||||
/*
|
||||
* Sysctl values for the cd9660 filesystem.
|
||||
*/
|
||||
#define CD9660_CLUSTERREAD 1 /* cluster reading enabled */
|
||||
#define CD9660_MAXID 2 /* number of valid cd9660 ids */
|
||||
|
||||
#define CD9660_NAMES { \
|
||||
{0, 0}, \
|
||||
{ "doclusterread", CTLTYPE_INT}, \
|
||||
}
|
||||
|
||||
/*
|
||||
* Setattr call. Only allowed for block and character special devices.
|
||||
*/
|
||||
@ -299,11 +288,6 @@ cd9660_getattr(ap)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int cd9660_doclusterread = 1;
|
||||
SYSCTL_NODE(_vfs, MOUNT_CD9660, cd9660, CTLFLAG_RW, 0, "CD9660 filesystem");
|
||||
SYSCTL_INT(_vfs_cd9660, CD9660_CLUSTERREAD, doclusterread,
|
||||
CTLFLAG_RW, &cd9660_doclusterread, 0, "");
|
||||
|
||||
/*
|
||||
* Vnode op for reading.
|
||||
*/
|
||||
@ -344,7 +328,7 @@ cd9660_read(ap)
|
||||
n = diff;
|
||||
size = blksize(imp, ip, lbn);
|
||||
rablock = lbn + 1;
|
||||
if (cd9660_doclusterread) {
|
||||
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
|
||||
if (lblktosize(imp, rablock) <= ip->i_size)
|
||||
error = cluster_read(vp, (off_t)ip->i_size,
|
||||
lbn, size, NOCRED, uio->uio_resid,
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: kern_conf.c,v 1.20 1997/09/21 22:14:54 julian Exp $
|
||||
* $Id: kern_conf.c,v 1.21 1997/09/21 22:20:12 julian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -198,10 +198,12 @@ bdevsw_add_generic(int bdev, int cdev, struct bdevsw *bdevsw)
|
||||
/*
|
||||
* XXX hack alert.
|
||||
*/
|
||||
if (isdisk(makedev(bdev, 0), VBLK) && bdevsw->d_flags != D_DISK) {
|
||||
if (isdisk(makedev(bdev, 0), VBLK) &&
|
||||
(bdevsw->d_flags & D_TYPEMASK) != D_DISK) {
|
||||
printf("bdevsw_add_generic: adding D_DISK flag for device %d\n",
|
||||
bdev);
|
||||
bdevsw->d_flags = D_DISK;
|
||||
bdevsw->d_flags &= ~D_TYPEMASK;
|
||||
bdevsw->d_flags |= D_DISK;
|
||||
}
|
||||
cdevsw_make(bdevsw);
|
||||
dev = makedev(cdev, 0);
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
|
||||
* $Id: vfs_syscalls.c,v 1.72 1997/09/21 04:23:03 dyson Exp $
|
||||
* $Id: vfs_syscalls.c,v 1.73 1997/09/24 07:46:54 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -253,10 +253,11 @@ mount(p, uap, retval)
|
||||
else if (mp->mnt_flag & MNT_RDONLY)
|
||||
mp->mnt_flag |= MNT_WANTRDWR;
|
||||
mp->mnt_flag &=~ (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV |
|
||||
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME);
|
||||
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME |
|
||||
MNT_NOCLUSTERR | MNT_NOCLUSTERW);
|
||||
mp->mnt_flag |= SCARG(uap, flags) & (MNT_NOSUID | MNT_NOEXEC |
|
||||
MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE |
|
||||
MNT_NOATIME);
|
||||
MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW);
|
||||
/*
|
||||
* Mount the filesystem.
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
|
||||
* $Id: vfs_syscalls.c,v 1.72 1997/09/21 04:23:03 dyson Exp $
|
||||
* $Id: vfs_syscalls.c,v 1.73 1997/09/24 07:46:54 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -253,10 +253,11 @@ mount(p, uap, retval)
|
||||
else if (mp->mnt_flag & MNT_RDONLY)
|
||||
mp->mnt_flag |= MNT_WANTRDWR;
|
||||
mp->mnt_flag &=~ (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV |
|
||||
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME);
|
||||
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME |
|
||||
MNT_NOCLUSTERR | MNT_NOCLUSTERW);
|
||||
mp->mnt_flag |= SCARG(uap, flags) & (MNT_NOSUID | MNT_NOEXEC |
|
||||
MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE |
|
||||
MNT_NOATIME);
|
||||
MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW);
|
||||
/*
|
||||
* Mount the filesystem.
|
||||
*/
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
|
||||
* $Id: spec_vnops.c,v 1.41 1997/09/02 20:06:12 bde Exp $
|
||||
* $Id: spec_vnops.c,v 1.42 1997/09/14 02:58:02 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -176,7 +176,8 @@ spec_open(ap)
|
||||
*/
|
||||
if (securelevel >= 2
|
||||
&& cdevsw[maj]->d_bdev
|
||||
&& cdevsw[maj]->d_bdev->d_flags == D_DISK)
|
||||
&& (cdevsw[maj]->d_bdev->d_flags & D_TYPEMASK) ==
|
||||
D_DISK)
|
||||
return (EPERM);
|
||||
/*
|
||||
* When running in secure mode, do not allow opens
|
||||
@ -220,7 +221,8 @@ spec_open(ap)
|
||||
* opens for writing of any disk block devices.
|
||||
*/
|
||||
if (securelevel >= 2 && ap->a_cred != FSCRED &&
|
||||
(ap->a_mode & FWRITE) && bdevsw[maj]->d_flags == D_DISK)
|
||||
(ap->a_mode & FWRITE) &&
|
||||
(bdevsw[maj]->d_flags & D_TYPEMASK) == D_DISK)
|
||||
return (EPERM);
|
||||
/*
|
||||
* Do not allow opens of block devices that are
|
||||
@ -422,7 +424,8 @@ spec_ioctl(ap)
|
||||
|
||||
case VBLK:
|
||||
if (ap->a_command == 0 && (int)ap->a_data == B_TAPE)
|
||||
if (bdevsw[major(dev)]->d_flags == D_TAPE)
|
||||
if ((bdevsw[major(dev)]->d_flags & D_TYPEMASK) ==
|
||||
D_TAPE)
|
||||
return (0);
|
||||
else
|
||||
return (1);
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)union_vfsops.c 8.20 (Berkeley) 5/20/95
|
||||
* $Id: union_vfsops.c,v 1.18 1997/08/02 14:32:29 bde Exp $
|
||||
* $Id: union_vfsops.c,v 1.19 1997/08/16 19:15:22 wollman Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -102,6 +102,11 @@ union_mount(mp, path, data, ndp, p)
|
||||
printf("union_mount(mp = %x)\n", mp);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Disable clustered write, otherwise system becomes unstable.
|
||||
*/
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
|
||||
/*
|
||||
* Update is a no-op
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)conf.h 8.5 (Berkeley) 1/9/95
|
||||
* $Id: conf.h,v 1.34 1997/02/22 09:44:58 peter Exp $
|
||||
* $Id: conf.h,v 1.35 1997/09/14 02:25:40 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CONF_H_
|
||||
@ -85,6 +85,15 @@ typedef int l_modem_t __P((struct tty *tp, int flag));
|
||||
#define D_DISK 2
|
||||
#define D_TTY 3
|
||||
|
||||
#define D_TYPEMASK 0xffff
|
||||
|
||||
/*
|
||||
* Flags for d_flags.
|
||||
*/
|
||||
#define D_NOCLUSTERR 0x10000 /* disables cluter read */
|
||||
#define D_NOCLUSTERW 0x20000 /* disables cluster write */
|
||||
#define D_NOCLUSTERRW (D_NOCLUSTERR | D_NOCLUSTERW)
|
||||
|
||||
/*
|
||||
* Block device switch table
|
||||
*/
|
||||
@ -95,7 +104,7 @@ struct bdevsw {
|
||||
d_ioctl_t *d_ioctl;
|
||||
d_dump_t *d_dump;
|
||||
d_psize_t *d_psize;
|
||||
int d_flags;
|
||||
u_int d_flags;
|
||||
char *d_name; /* name of the driver e.g. audio */
|
||||
struct cdevsw *d_cdev; /* cross pointer to the cdev */
|
||||
int d_maj; /* the major number we were assigned */
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)conf.h 8.5 (Berkeley) 1/9/95
|
||||
* $Id: conf.h,v 1.34 1997/02/22 09:44:58 peter Exp $
|
||||
* $Id: conf.h,v 1.35 1997/09/14 02:25:40 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CONF_H_
|
||||
@ -85,6 +85,15 @@ typedef int l_modem_t __P((struct tty *tp, int flag));
|
||||
#define D_DISK 2
|
||||
#define D_TTY 3
|
||||
|
||||
#define D_TYPEMASK 0xffff
|
||||
|
||||
/*
|
||||
* Flags for d_flags.
|
||||
*/
|
||||
#define D_NOCLUSTERR 0x10000 /* disables cluter read */
|
||||
#define D_NOCLUSTERW 0x20000 /* disables cluster write */
|
||||
#define D_NOCLUSTERRW (D_NOCLUSTERR | D_NOCLUSTERW)
|
||||
|
||||
/*
|
||||
* Block device switch table
|
||||
*/
|
||||
@ -95,7 +104,7 @@ struct bdevsw {
|
||||
d_ioctl_t *d_ioctl;
|
||||
d_dump_t *d_dump;
|
||||
d_psize_t *d_psize;
|
||||
int d_flags;
|
||||
u_int d_flags;
|
||||
char *d_name; /* name of the driver e.g. audio */
|
||||
struct cdevsw *d_cdev; /* cross pointer to the cdev */
|
||||
int d_maj; /* the major number we were assigned */
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)mount.h 8.21 (Berkeley) 5/20/95
|
||||
* $Id: mount.h,v 1.45 1997/08/16 19:16:12 wollman Exp $
|
||||
* $Id: mount.h,v 1.46 1997/09/16 14:44:24 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MOUNT_H_
|
||||
@ -166,6 +166,8 @@ struct mount {
|
||||
#define MNT_UNION 0x00000020 /* union with underlying filesystem */
|
||||
#define MNT_ASYNC 0x00000040 /* file system written asynchronously */
|
||||
#define MNT_NOATIME 0x10000000 /* Disable update of file access times */
|
||||
#define MNT_NOCLUSTERR 0x40000000 /* Disable cluster read */
|
||||
#define MNT_NOCLUSTERW 0x80000000 /* Disable cluster read */
|
||||
|
||||
/*
|
||||
* exported mount flags.
|
||||
@ -189,9 +191,10 @@ struct mount {
|
||||
* Mask of flags that are visible to statfs()
|
||||
*/
|
||||
#define MNT_VISFLAGMASK (MNT_RDONLY|MNT_SYNCHRONOUS|MNT_NOEXEC|MNT_NOSUID| \
|
||||
MNT_NODEV|MNT_UNION|MNT_ASYNC|MNT_EXRDONLY|MNT_EXPORTED| \
|
||||
MNT_DEFEXPORTED|MNT_EXPORTANON|MNT_EXKERB|MNT_LOCAL| \
|
||||
MNT_USER|MNT_QUOTA|MNT_ROOTFS|MNT_NOATIME)
|
||||
MNT_NODEV|MNT_UNION|MNT_ASYNC|MNT_EXRDONLY| \
|
||||
MNT_EXPORTED|MNT_DEFEXPORTED|MNT_EXPORTANON| \
|
||||
MNT_EXKERB|MNT_LOCAL|MNT_USER|MNT_QUOTA|MNT_ROOTFS| \
|
||||
MNT_NOATIME|MNT_NOCLUSTERR|MNT_NOCLUSTERW)
|
||||
|
||||
/*
|
||||
* External filesystem control flags.
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ffs_extern.h 8.6 (Berkeley) 3/30/95
|
||||
* $Id: ffs_extern.h,v 1.15 1997/02/22 09:47:02 peter Exp $
|
||||
* $Id: ffs_extern.h,v 1.16 1997/08/16 19:16:19 wollman Exp $
|
||||
*/
|
||||
|
||||
#ifndef _UFS_FFS_EXTERN_H
|
||||
@ -40,16 +40,14 @@
|
||||
/*
|
||||
* Sysctl values for the fast filesystem.
|
||||
*/
|
||||
#define FFS_CLUSTERREAD 1 /* cluster reading enabled */
|
||||
#define FFS_CLUSTERWRITE 2 /* cluster writing enabled */
|
||||
#define FFS_REALLOCBLKS 3 /* block reallocation enabled */
|
||||
#define FFS_ASYNCFREE 4 /* asynchronous block freeing enabled */
|
||||
#define FFS_MAXID 5 /* number of valid ffs ids */
|
||||
|
||||
#define FFS_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "doclusterread", CTLTYPE_INT }, \
|
||||
{ "doclusterwrite", CTLTYPE_INT }, \
|
||||
{ 0, 0 }, \
|
||||
{ 0, 0 }, \
|
||||
{ "doreallocblks", CTLTYPE_INT }, \
|
||||
{ "doasyncfree", CTLTYPE_INT }, \
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95
|
||||
* $Id: ffs_vfsops.c,v 1.54 1997/09/02 20:06:46 bde Exp $
|
||||
* $Id: ffs_vfsops.c,v 1.55 1997/09/07 16:20:59 bde Exp $
|
||||
*/
|
||||
|
||||
#include "opt_quota.h"
|
||||
@ -44,6 +44,7 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/malloc.h>
|
||||
@ -155,9 +156,10 @@ ffs_mount( mp, path, data, ndp, p)
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* Attempt mount
|
||||
*/
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
if( ( err = ffs_mountfs(rootvp, mp, p)) != 0) {
|
||||
/* fs specific cleanup (if any)*/
|
||||
goto error_1;
|
||||
@ -181,11 +183,17 @@ ffs_mount( mp, path, data, ndp, p)
|
||||
/*
|
||||
* If updating, check whether changing from read-only to
|
||||
* read/write; if there is no device name, that's all we do.
|
||||
* Disallow clearing MNT_NOCLUSTERR and MNT_NOCLUSTERW flags,
|
||||
* if block device requests.
|
||||
*/
|
||||
if (mp->mnt_flag & MNT_UPDATE) {
|
||||
ump = VFSTOUFS(mp);
|
||||
fs = ump->um_fs;
|
||||
err = 0;
|
||||
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
|
||||
flags = WRITECLOSE;
|
||||
if (mp->mnt_flag & MNT_FORCE)
|
||||
@ -275,6 +283,11 @@ ffs_mount( mp, path, data, ndp, p)
|
||||
********************
|
||||
*/
|
||||
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
|
||||
/*
|
||||
* Since this is a new mount, we want the names for
|
||||
* the device and the mount point copied in. If an
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95
|
||||
* $Id: ffs_vnops.c,v 1.28 1997/09/02 20:06:46 bde Exp $
|
||||
* $Id: ffs_vnops.c,v 1.29 1997/09/14 02:58:05 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -239,17 +239,7 @@ VNODEOP_SET(ffs_vnodeop_opv_desc);
|
||||
VNODEOP_SET(ffs_specop_opv_desc);
|
||||
VNODEOP_SET(ffs_fifoop_opv_desc);
|
||||
|
||||
/*
|
||||
* Enabling cluster read/write operations.
|
||||
*/
|
||||
static int ffs_doclusterread = 1;
|
||||
static int ffs_doclusterwrite = 1;
|
||||
|
||||
SYSCTL_NODE(_vfs, MOUNT_UFS, ffs, CTLFLAG_RW, 0, "FFS filesystem");
|
||||
SYSCTL_INT(_vfs_ffs, FFS_CLUSTERREAD, doclusterread,
|
||||
CTLFLAG_RW, &ffs_doclusterread, 0, "");
|
||||
SYSCTL_INT(_vfs_ffs, FFS_CLUSTERWRITE, doclusterwrite,
|
||||
CTLFLAG_RW, &ffs_doclusterwrite, 0, "");
|
||||
|
||||
#include <ufs/ufs/ufs_readwrite.c>
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_readwrite.c 8.11 (Berkeley) 5/8/95
|
||||
* $Id: ufs_readwrite.c,v 1.29 1997/03/22 06:53:44 bde Exp $
|
||||
* $Id: ufs_readwrite.c,v 1.30 1997/08/25 08:18:39 kato Exp $
|
||||
*/
|
||||
|
||||
#ifdef LFS_READWRITE
|
||||
@ -123,7 +123,7 @@ READ(ap)
|
||||
#else
|
||||
if (lblktosize(fs, nextlbn) >= ip->i_size)
|
||||
error = bread(vp, lbn, size, NOCRED, &bp);
|
||||
else if (ffs_doclusterread)
|
||||
else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0)
|
||||
error = cluster_read(vp, ip->i_size, lbn,
|
||||
size, NOCRED, uio->uio_resid, seqcount, &bp);
|
||||
else if (lbn - 1 == vp->v_lastr) {
|
||||
@ -281,7 +281,7 @@ WRITE(ap)
|
||||
if (ioflag & IO_SYNC) {
|
||||
(void)bwrite(bp);
|
||||
} else if (xfersize + blkoffset == fs->fs_bsize) {
|
||||
if (ffs_doclusterwrite) {
|
||||
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) {
|
||||
bp->b_flags |= B_CLUSTEROK;
|
||||
cluster_write(bp, ip->i_size);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user