Subject: Re: uvm & flushing
To: Bill Studenmund <wrstuden@nas.nasa.gov>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 12/07/1999 22:57:57
presumably, once you start the archiving process, you'd prevent the
creation of new dirty pages so that your archive copy remains valid.
if there are any dirty pages when you're about to mark the file
non-resident, those pages would not be in the archived version,
so flushing them to disk at this point wouldn't help much.
(I'm making some guesses about how your system works, so if what
I'm saying doesn't make any sense then I've no doubt guessed wrong.)

-Chuck


On Mon, Dec 06, 1999 at 05:18:26PM -0800, Bill Studenmund wrote:
> 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);
> 
> ??