Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 02 Jun 2005 09:43:32 +0200
From:      Alexander Leidinger <Alexander@Leidinger.net>
To:        Don Lewis <truckman@FreeBSD.org>
Cc:        phk@phk.freebsd.dk, current@FreeBSD.org
Subject:   Re: [RFC] [PATCH] VM & VFS changes
Message-ID:  <20050602094332.949xldwlwk4c8k4g@netchild.homeip.net>
In-Reply-To: <200506020637.j526bqXO002547@gw.catspoiler.org>
References:  <200506020637.j526bqXO002547@gw.catspoiler.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Don Lewis <truckman@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!!





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050602094332.949xldwlwk4c8k4g>