Subject: uvm & flushing
To: None <tech-kern@netbsd.org>
From: Bill Studenmund <wrstuden@nas.nasa.gov>
List: tech-kern
Date: 12/06/1999 17:18:26
As part of the data migration work I'm doing, I've run into a few uvm
problems.
The problem is keeping uvm in sync with our archiving (backing up to
tape). When we begin archiving a file, we want to make sure that we flush
all dirty buffers out to disk. I think I know how to do this (sample code
below).
When we finish archiving, if we're marking the file as non-resident, we
want to blow away all of the relevant uvm pages. I think I also know how
to do this.
What I don't know how to do is to test and see if there are dirty pages
before blowing them away. I spoke w/ Jason, and he suggested posting here.
:-)
So what would we need to add? Something like a count of dirty pages
assosciated with the vnode? How would I access it?
Take care,
Bill
P.S. do these code snippents look right?
We have the vnode locked. To flush all pages:
struct uvm_object *uobj = vp;
simple_lock(&uobj->vmobjlock);
uvn_flush(uobj, 0, 0, PGO_ALLPAGES | PGO_CLEANIT | PGO_SYNCIO);
simple_unlock(&uobj->vmobjlock);
To blow away all pages:
struct uvm_object *uobj = vp;
simple_lock(&uobj->vmobjlock);
uvn_flush(uobj, 0, 0, PGO_ALLPAGES | PGO_FREE);
simple_unlock(&uobj->vmobjlock);
??