summaryrefslogtreecommitdiffstats
path: root/sys/gnu/fs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/gnu/fs')
-rw-r--r--sys/gnu/fs/ext2fs/ext2_extern.h13
-rw-r--r--sys/gnu/fs/ext2fs/ext2_readwrite.c4
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c18
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vnops.c11
4 files changed, 18 insertions, 28 deletions
diff --git a/sys/gnu/fs/ext2fs/ext2_extern.h b/sys/gnu/fs/ext2fs/ext2_extern.h
index 277106b..4c32799 100644
--- a/sys/gnu/fs/ext2fs/ext2_extern.h
+++ b/sys/gnu/fs/ext2fs/ext2_extern.h
@@ -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;
diff --git a/sys/gnu/fs/ext2fs/ext2_readwrite.c b/sys/gnu/fs/ext2fs/ext2_readwrite.c
index e28cd0a..986bc14 100644
--- a/sys/gnu/fs/ext2fs/ext2_readwrite.c
+++ b/sys/gnu/fs/ext2fs/ext2_readwrite.c
@@ -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
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index 7aef5f6..11d1b33 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/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
diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c
index 583164b..94fe0a7 100644
--- a/sys/gnu/fs/ext2fs/ext2_vnops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vnops.c
@@ -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>
/*
OpenPOWER on IntegriCloud