summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>1997-09-27 13:40:20 +0000
committerkato <kato@FreeBSD.org>1997-09-27 13:40:20 +0000
commitfe9b86cf0b7a453c772a2756389fda91c12c3fab (patch)
treee695260038ca9665181b5b5c99ae6fa77fba443a /sys/ufs
parent31e1d6ad00b9d8f39549115d4ef76fbee62e9748 (diff)
downloadFreeBSD-src-fe9b86cf0b7a453c772a2756389fda91c12c3fab.zip
FreeBSD-src-fe9b86cf0b7a453c772a2756389fda91c12c3fab.tar.gz
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
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_extern.h8
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c21
-rw-r--r--sys/ufs/ffs/ffs_vnops.c12
-rw-r--r--sys/ufs/ufs/ufs_readwrite.c6
4 files changed, 24 insertions, 23 deletions
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h
index 5c6a519..8fd7d70 100644
--- a/sys/ufs/ffs/ffs_extern.h
+++ b/sys/ufs/ffs/ffs_extern.h
@@ -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 }, \
}
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index a835da5..c0dae9a 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -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
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index a546fb8..084e3a9 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -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>
diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c
index c598833..929a289 100644
--- a/sys/ufs/ufs/ufs_readwrite.c
+++ b/sys/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 {
OpenPOWER on IntegriCloud