[994] in NetBSD-Development

home help back first fref pref prev next nref lref last post

vnode_pager_flush.

daemon@ATHENA.MIT.EDU (Michael T. Stolarchuk)
Thu Aug 31 13:07:01 1995

To: jtkohl@MIT.EDU
Cc: honey@citi.umich.edu, little-work@citi.umich.edu,
        mts@terminator.rs.itd.umich.edu, netbsd-afs@MIT.EDU
Date: Thu, 31 Aug 1995 13:06:38 -0400
From: "Michael T. Stolarchuk" <mts@terminator.rs.itd.umich.edu>


Oops, I'm not quite right about that code for vnode_pager_flush,
and I've got several different symptions I ought to describe...

It seems that if there are no references to the existing vnode
then vnode_pager_uncache get the entry out of the cache.

If there IS an entry in existance, then the vnode_pager_cache
won't be able to uncache the entry, and instead the pages
need to be flushed.

If the pages need to be flushed, then you need to know the SIZE
of the thing to flush, and you MAY need to reset the 
vnp_size (since that describes the size of the paged vnode
in memory)... That means you can't set the size until after
the call for FetchStatus...  It also means you don't want
to use vnode_pager_setsize, since that understands to flush
the range of pages only where the file has grown...

So, here's a second attempt... the way I'm doing, looks like
it may not be the last ....

diff afs/afs_nbsd_subr.c ../../../src/afs/afs_nbsd_subr.c
399,402d398
< /*
< ** vnode_pager_flush
< ** flush any pages from the vnode cache... Really borrowed from vnode_pager_setsize...
< */
404,434d399
< #include      <vm/vnode_pager.h>
< 
< vnode_pager_flush(vp, len)
<       struct vnode * vp;
<       unsigned len;
< {
<     vn_pager_t vnp;
<     vm_object_t object;
<     vm_pager_t pager;
< 
<     if (vnode_pager_uncache(vp))
<       return; /* first try uncaching the data */
< 
<     pager = (vm_pager_t)vp->v_vmdata;
<     if (pager == 0)
<       return;
<     vnp = (vn_pager_t)pager->pg_data;
<     object = vm_object_lookup(pager);
< 
<     if (object) {
<       vm_object_lock(object)
<       vm_object_page_remove(object, 0, vnp->vnp_size );
<       if (len) {
<           vnp->vnp_size = len;
<       }
<       vm_object_unlock(object);
<       vm_object_deallocate(object);
<     }
< }

Since the size has to be passed in (if its known), then
the calls to vnode_pager_flush need to pass tvc->m.Length
when its value is known...

Oh, and since size is also being passed to this thing,
and its resetting the size of the object, I don't think
its named right ... vnode_pager_flushSize or something
like that may be much more correct...


btw: have you also posted your diffs in /afs/transarc.com for
the release which you man unmount?

mts.

home help back first fref pref prev next nref lref last post