summaryrefslogtreecommitdiffstats
path: root/sys/gnu/ext2fs/ext2_vfsops.c
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/gnu/ext2fs/ext2_vfsops.c
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/gnu/ext2fs/ext2_vfsops.c')
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c18
1 files changed, 16 insertions, 2 deletions
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
OpenPOWER on IntegriCloud