Subject: Re: RFC patch for genfs
To: None <tech-kern@netbsd.org>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 01/10/2006 22:05:03
this is fine, though if you're going to use the page cache for
directories you might as well allow using it for symlinks too.
-Chuck
On Wed, Jan 11, 2006 at 04:00:28AM +0100, Reinoud Zandijk wrote:
> Dear folks,
>
> i'd like to patch genfs with the following patch to allow it to serve
> directories as well as files. If noone objects i'll be committing it soon.
>
> Note that it doesn't change current behaviour.
>
> Index: genfs_vnops.c
> ===================================================================
> RCS file: /cvsroot/src/sys/miscfs/genfs/genfs_vnops.c,v
> retrieving revision 1.120
> diff -u -r1.120 genfs_vnops.c
> --- genfs_vnops.c 11 Jan 2006 00:46:54 -0000 1.120
> +++ genfs_vnops.c 11 Jan 2006 02:57:28 -0000
> @@ -464,7 +464,7 @@
> UVMHIST_LOG(ubchist, "vp %p off 0x%x/%x count %d",
> vp, ap->a_offset >> 32, ap->a_offset, *ap->a_count);
>
> - KASSERT(vp->v_type == VREG || vp->v_type == VBLK);
> + KASSERT(vp->v_type == VREG || vp->v_type == VDIR || vp->v_type ==
> VBLK);
>
> /* XXXUBC temp limit */
> if (*ap->a_count > MAX_READ_PAGES) {
> @@ -502,7 +502,7 @@
> /* uobj is locked */
>
> if ((flags & PGO_NOTIMESTAMP) == 0 &&
> - (vp->v_type == VREG ||
> + (vp->v_type != VBLK ||
> (vp->v_mount->mnt_flag & MNT_NODEVMTIME) == 0)) {
> int updflags = 0;
>
> @@ -543,7 +543,7 @@
> * leave space in the page array for a whole block.
> */
>
> - if (vp->v_type == VREG) {
> + if (vp->v_type != VBLK) {
> fs_bshift = vp->v_mount->mnt_fs_bshift;
> dev_bshift = vp->v_mount->mnt_dev_bshift;
> } else {
> @@ -1362,7 +1362,7 @@
> }
>
> if (modified && (vp->v_flag & VWRITEMAPDIRTY) != 0 &&
> - (vp->v_type == VREG ||
> + (vp->v_type != VBLK ||
> (vp->v_mount->mnt_flag & MNT_NODEVMTIME) == 0)) {
> GOP_MARKUPDATE(vp, GOP_UPDATE_MODIFIED);
> }
> @@ -1426,7 +1426,7 @@
> vp, pgs, npages, flags);
>
> GOP_SIZE(vp, vp->v_size, &eof, GOP_SIZE_WRITE);
> - if (vp->v_type == VREG) {
> + if (vp->v_type != VBLK) {
> fs_bshift = vp->v_mount->mnt_fs_bshift;
> dev_bshift = vp->v_mount->mnt_dev_bshift;
> } else {
> -------------------------
>
> With regards,
> Reinoud
>