From fe9b86cf0b7a453c772a2756389fda91c12c3fab Mon Sep 17 00:00:00 2001 From: kato Date: Sat, 27 Sep 1997 13:40:20 +0000 Subject: 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 --- sys/gnu/ext2fs/ext2_vfsops.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'sys/gnu/ext2fs/ext2_vfsops.c') diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c index 7aef5f6..11d1b33 100644 --- a/sys/gnu/ext2fs/ext2_vfsops.c +++ b/sys/gnu/ext2fs/ext2_vfsops.c @@ -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 -- cgit v1.1