[RFC] [PATCH] VM & VFS changes

Alexander Leidinger Alexander at Leidinger.net
Thu Jun 2 07:43:46 GMT 2005


Don Lewis <truckman at FreeBSD.org> wrote:

>>>>> Wouldn't a loop like the following be enough?
>>>>> while swap
>>>>>     umount unbusy-FS
>>>>>     swap-off swap
>>>>>
>>>>> This assumes that swap-off doesn't turns off the swap if it isn't 
>>>>> able to put
>>>>> everything back into other swap or physical RAM areas.

> I think this can be unwound in one pass if a list of the dependency
> pairs is kept and then properly sorted before processing.  The types of
> dependencies are:
> 	md depends on file system (vnode backed md)
> 	md depends on swap (swap backed file system)
> 	file system depends on md (md backed file system)
> 	swap depends on md (swap on an md)
> 	file system depends on file system (mount relationship)
> First undo any dependencies that ultimately depend on swap, unconfigure
> the swap devices, and finally undo any dependencies that swap depended
> on.

I still don't understand why my approach above doesn't solve this problem.

A FS is busy when something is still open. So if the FS is used as a
container for swap, the FS is busy and it isn't supposed to be umounted. If
a md is configured on the swap area you want to disable with swap-off, my
above description allows the call to fail. Since the md/swap/FS part is
cycle-free, we have an upper bound of sum(#md)+sum(#swap)+sum(#FS)
iterations (actually it's less than that, but my point is: a linear number
of iterations with an upper bound) of this loop. When the loop finishes, no
swap is enabled anymore. -> Goal reached.

What am I overlooking?

Bye,
Alexander.

-- 
http://www.Leidinger.net  Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org     netchild @ FreeBSD.org  : PGP ID = 72077137
Hiccuping & trembling into the WASTE DUMPS of New Jersey like some
drunken CABBAGE PATCH DOLL, coughing in line at FIORUCCI'S!!




More information about the freebsd-current mailing list