Date: Wed, 24 Sep 1997 23:39:04 +0900 From: KATO Takenori <kato@migmatite.eps.nagoya-u.ac.jp> To: phk@critter.freebsd.dk Cc: current@freebsd.org Subject: Re: Daily SNAPshots at current.freebsd.org shut down for now. Message-ID: <199709241439.XAA04074@gneiss.eps.nagoya-u.ac.jp> In-Reply-To: Your message of "Wed, 24 Sep 1997 12:25:31 %2B0200" References: <1237.875096731@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
> I would suggest you make a mount option for it so you can decide for
> other filesystems if you want clustering or not.
I don't have enough time, so what I can do now is to add vnconfig
option to disable clustering. (I also think mount option is good
mechanism and I need it to use union fs safely.)
Followings is patch to add vnconfig option. New option is `n'.
Please review.
---------- BEGIN ---------
diff -arcN sys.old/dev/vn/vn.c sys/dev/vn/vn.c
*** sys.old/dev/vn/vn.c Wed Sep 24 20:27:51 1997
--- sys/dev/vn/vn.c Wed Sep 24 22:41:09 1997
***************
*** 407,413 ****
struct nameidata nd;
int error;
u_long *f;
!
IFOPT(vn,VN_FOLLOW)
printf("vnioctl(0x%lx, 0x%x, %p, 0x%x, %p): unit %d\n",
--- 407,413 ----
struct nameidata nd;
int error;
u_long *f;
! u_long vflag = 0;
IFOPT(vn,VN_FOLLOW)
printf("vnioctl(0x%lx, 0x%x, %p, 0x%x, %p): unit %d\n",
***************
*** 415,420 ****
--- 415,421 ----
switch (cmd) {
case VNIOCATTACH:
+ case VNIOCATTACHNCLUSTER:
case VNIOCDETACH:
case VNIOCGSET:
case VNIOCGCLEAR:
***************
*** 446,451 ****
--- 447,455 ----
f = (u_long*)data;
switch (cmd) {
+ case VNIOCATTACHNCLUSTER:
+ vflag = VNOCLUSTER;
+ /* FALLTHROUGH */
case VNIOCATTACH:
if (vn->sc_flags & VNF_INITED)
return(EBUSY);
***************
*** 467,472 ****
--- 471,477 ----
}
VOP_UNLOCK(nd.ni_vp);
vn->sc_vp = nd.ni_vp;
+ vn->sc_vp->v_flag |= vflag;
vn->sc_size = btodb(vattr.va_size); /* note truncation */
error = vnsetcred(vn, p->p_ucred);
if (error) {
diff -arcN sys.old/gnu/ext2fs/ext2_readwrite.c sys/gnu/ext2fs/ext2_readwrite.c
*** sys.old/gnu/ext2fs/ext2_readwrite.c Wed Sep 24 20:27:46 1997
--- sys/gnu/ext2fs/ext2_readwrite.c Wed Sep 24 22:44:01 1997
***************
*** 112,118 ****
if (lblktosize(fs, nextlbn) >= ip->i_size)
error = bread(vp, lbn, size, NOCRED, &bp);
! else if (doclusterread)
error = cluster_read(vp,
ip->i_size, lbn, size, NOCRED, &bp);
else if (lbn - 1 == vp->v_lastr) {
--- 112,118 ----
if (lblktosize(fs, nextlbn) >= ip->i_size)
error = bread(vp, lbn, size, NOCRED, &bp);
! else if (doclusterread && !(vp->v_flag & VNOCLUSTER))
error = cluster_read(vp,
ip->i_size, lbn, size, NOCRED, &bp);
else if (lbn - 1 == vp->v_lastr) {
***************
*** 284,290 ****
if (ioflag & IO_SYNC) {
(void)bwrite(bp);
} else if (xfersize + blkoffset == fs->s_frag_size) {
! if (doclusterwrite) {
#if defined(__FreeBSD__)
bp->b_flags |= B_CLUSTEROK;
#endif
--- 284,290 ----
if (ioflag & IO_SYNC) {
(void)bwrite(bp);
} else if (xfersize + blkoffset == fs->s_frag_size) {
! if (doclusterwrite && !(vp->v_flag & VNOCLUSTER)) {
#if defined(__FreeBSD__)
bp->b_flags |= B_CLUSTEROK;
#endif
diff -arcN sys.old/isofs/cd9660/cd9660_vnops.c sys/isofs/cd9660/cd9660_vnops.c
*** sys.old/isofs/cd9660/cd9660_vnops.c Wed Sep 24 20:27:09 1997
--- sys/isofs/cd9660/cd9660_vnops.c Wed Sep 24 22:44:40 1997
***************
*** 341,347 ****
n = diff;
size = iso_blksize(imp, ip, lbn);
rablock = lbn + 1;
! if (doclusterread) {
if (iso_lblktosize(imp, rablock) <= ip->i_size)
error = cluster_read(vp, ip->i_size,
lbn, size, NOCRED, &bp);
--- 341,347 ----
n = diff;
size = iso_blksize(imp, ip, lbn);
rablock = lbn + 1;
! if (doclusterread && !(vp->v_flag & VNOCLUSTER)) {
if (iso_lblktosize(imp, rablock) <= ip->i_size)
error = cluster_read(vp, ip->i_size,
lbn, size, NOCRED, &bp);
diff -arcN sys.old/sys/vnioctl.h sys/sys/vnioctl.h
*** sys.old/sys/vnioctl.h Wed Sep 24 20:26:36 1997
--- sys/sys/vnioctl.h Wed Sep 24 23:24:18 1997
***************
*** 66,71 ****
--- 66,73 ----
#define VNIOCGCLEAR _IOWR('F', 3, u_long ) /* reset --//-- */
#define VNIOCUSET _IOWR('F', 4, u_long ) /* set unit option */
#define VNIOCUCLEAR _IOWR('F', 5, u_long ) /* reset --//-- */
+ #define VNIOCATTACHNCLUSTER _IOWR('F', 6, struct vn_ioctl)
+ /* attach file, disable cluster read/write */
#define VN_LABELS 0x1 /* Use disk(/slice) labels */
#define VN_FOLLOW 0x2 /* Debug flow in vn driver */
diff -arcN sys.old/sys/vnode.h sys/sys/vnode.h
*** sys.old/sys/vnode.h Wed Sep 24 20:26:36 1997
--- sys/sys/vnode.h Wed Sep 24 22:37:44 1997
***************
*** 111,129 ****
/*
* Vnode flags.
*/
! #define VROOT 0x0001 /* root of its file system */
! #define VTEXT 0x0002 /* vnode is a pure text prototype */
! #define VSYSTEM 0x0004 /* vnode being used by kernel */
! #define VOLOCK 0x0008 /* vnode is locked waiting for an object */
! #define VOWANT 0x0010 /* a process is waiting for VOLOCK */
! #define VXLOCK 0x0100 /* vnode is locked to change underlying type */
! #define VXWANT 0x0200 /* process is waiting for vnode */
! #define VBWAIT 0x0400 /* waiting for output to complete */
! #define VALIASED 0x0800 /* vnode has an alias */
! #define VDIROP 0x1000 /* LFS: vnode is involved in a directory op */
! #define VVMIO 0x2000 /* VMIO flag */
! #define VNINACT 0x4000 /* LFS: skip ufs_inactive() in lfs_vunref */
! #define VAGE 0x8000 /* Insert vnode at head of free list */
/*
* Vnode attributes. A field value of VNOVAL represents a field whose value
--- 111,130 ----
/*
* Vnode flags.
*/
! #define VROOT 0x00001 /* root of its file system */
! #define VTEXT 0x00002 /* vnode is a pure text prototype */
! #define VSYSTEM 0x00004 /* vnode being used by kernel */
! #define VOLOCK 0x00008 /* vnode is locked waiting for an object */
! #define VOWANT 0x00010 /* a process is waiting for VOLOCK */
! #define VXLOCK 0x00100 /* vnode is locked to change underlying type */
! #define VXWANT 0x00200 /* process is waiting for vnode */
! #define VBWAIT 0x00400 /* waiting for output to complete */
! #define VALIASED 0x00800 /* vnode has an alias */
! #define VDIROP 0x01000 /* LFS: vnode is involved in a directory op */
! #define VVMIO 0x02000 /* VMIO flag */
! #define VNINACT 0x04000 /* LFS: skip ufs_inactive() in lfs_vunref */
! #define VAGE 0x08000 /* Insert vnode at head of free list */
! #define VNOCLUSTER 0x10000 /* disable cluster read / write */
/*
* Vnode attributes. A field value of VNOVAL represents a field whose value
diff -arcN sys.old/ufs/ufs/ufs_readwrite.c sys/ufs/ufs/ufs_readwrite.c
*** sys.old/ufs/ufs/ufs_readwrite.c Wed Sep 24 20:26:34 1997
--- sys/ufs/ufs/ufs_readwrite.c Wed Sep 24 22:45:48 1997
***************
*** 120,126 ****
#else
if (lblktosize(fs, nextlbn) >= ip->i_size)
error = bread(vp, lbn, size, NOCRED, &bp);
! else if (doclusterread)
error = cluster_read(vp,
ip->i_size, lbn, size, NOCRED, &bp);
else if (lbn - 1 == vp->v_lastr) {
--- 120,126 ----
#else
if (lblktosize(fs, nextlbn) >= ip->i_size)
error = bread(vp, lbn, size, NOCRED, &bp);
! else if (doclusterread && !(vp->v_flag & VNOCLUSTER))
error = cluster_read(vp,
ip->i_size, lbn, size, NOCRED, &bp);
else if (lbn - 1 == vp->v_lastr) {
***************
*** 286,292 ****
if (ioflag & IO_SYNC) {
(void)bwrite(bp);
} else if (xfersize + blkoffset == fs->fs_bsize) {
! if (doclusterwrite) {
bp->b_flags |= B_CLUSTEROK;
cluster_write(bp, ip->i_size);
} else {
--- 286,292 ----
if (ioflag & IO_SYNC) {
(void)bwrite(bp);
} else if (xfersize + blkoffset == fs->fs_bsize) {
! if (doclusterwrite && !(vp->v_flag & VNOCLUSTER)) {
bp->b_flags |= B_CLUSTEROK;
cluster_write(bp, ip->i_size);
} else {
diff -arcN usr.sbin/vnconfig.old/vnconfig.8 usr.sbin/vnconfig/vnconfig.8
*** usr.sbin/vnconfig.old/vnconfig.8 Wed Sep 24 20:42:31 1997
--- usr.sbin/vnconfig/vnconfig.8 Wed Sep 24 22:52:53 1997
***************
*** 81,86 ****
--- 81,88 ----
.Fl c .
.It Fl d
Disables (if possible) the specified feature.
+ .It Fl n
+ Disables cluster read and write.
.It Fl u
Disables and ``unconfigures'' the device.
.It Fl v
diff -arcN usr.sbin/vnconfig.old/vnconfig.c usr.sbin/vnconfig/vnconfig.c
*** usr.sbin/vnconfig.old/vnconfig.c Wed Sep 24 20:42:31 1997
--- usr.sbin/vnconfig/vnconfig.c Wed Sep 24 22:52:13 1997
***************
*** 68,73 ****
--- 68,74 ----
#define VN_IGNORE 0x80
#define VN_SET 0x100
#define VN_RESET 0x200
+ #define VN_NOCLUSTER 0x400
int nvndisks;
***************
*** 158,163 ****
--- 159,169 ----
verbose++;
break;
+ /* disable cluster read / write */
+ case 'n':
+ flags |= VN_NOCLUSTER;
+ break;
+
default:
fprintf(stderr, "invalid option '%c'\n", optopt);
usage();
***************
*** 259,271 ****
* Configure the device
*/
if (flags & VN_CONFIG) {
! rv = ioctl(fileno(f), VNIOCATTACH, &vnio);
! if (rv) {
! perror("VNIOCATTACH");
! flags &= ~VN_ENABLE;
! } else if (verbose)
! printf("%s: %d bytes on %s\n",
! dev, vnio.vn_size, file);
}
/*
* Set an option
--- 265,287 ----
* Configure the device
*/
if (flags & VN_CONFIG) {
! if (flags & VN_NOCLUSTER) {
! rv = ioctl(fileno(f), VNIOCATTACHNCLUSTER, &vnio);
! if (rv) {
! perror("VNIOCATTACHNCLUSTER");
! flags &= ~VN_ENABLE;
! } else if (verbose)
! printf("%s: %d bytes on %s\n",
! dev, vnio.vn_size, file);
! } else {
! rv = ioctl(fileno(f), VNIOCATTACH, &vnio);
! if (rv) {
! perror("VNIOCATTACH");
! flags &= ~VN_ENABLE;
! } else if (verbose)
! printf("%s: %d bytes on %s\n",
! dev, vnio.vn_size, file);
! }
}
/*
* Set an option
---------- END ---------
----
KATO Takenori <kato@ganko.eps.nagoya-u.ac.jp>
Dept. Earth Planet. Sci., Nagoya Univ., Nagoya, 464-01, Japan
PGP public key: finger kato@eclogite.eps.nagoya-u.ac.jp
------------------- Powered by FreeBSD(98) -------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709241439.XAA04074>
