PDA

View Full Version : [PATCH] cloop: Add suspend feature



Fabianx
02-02-2007, 06:08 AM
Hi,

long time no post.

I just sent a message to debian-knoppix.

The implemented idea is to do:

# cp necessary files to ramdisk or load them into the block-layer cache
# load k3b first and also load cdrecord then into cache.
# then ...

cloop_suspend /dev/cloop
eject /cdrom
# put other CD in and burn it for example
# ...
# eject other cd
eject /cdrom
# mount it again
mount /cdrom
# Resume cloop
losetup /dev/cloop /cdrom/KNOPPIX/KNOPPIX

While in suspend mode all accesses are answered via kernel cache. If a file / dir is not in cache, the corresponding application is blocked until cloop resumes again.

Ideas? Comments?

cu

Fabian

PS: See: http://lists.debian.org/debian-knoppix/2007/02/msg00001.html for patch and more information ...

jef
02-22-2007, 06:39 PM
I haven't tried it yet, but from the citation at the end of your post it seems workable and useable, if potentially pitfall-full.

Having also need to do this my workaround was to use the toram cheat (effectively caching the entire disk)... thus no danger of blocked X-processes etc... but this was essentially a hardware solution (requiring me to install more RAM) and now that the new RAM is installed, having a low-resource way to do this (at least the lower runlevels) will be useful.

Another workaround has been to stop booting before the any /dev/cloops are allocated...
load just the things I need, etc, into ramdisk, eject the CD, burn one, and then continue booting. No X that way either, of course, and also less elegant than suspending
the device

Having a few more spare cloop devices than just eight would help too
:wink:

Fabianx
03-30-2007, 10:42 PM
I haven't tried it yet, but from the citation at the end of your post it seems workable and useable, if potentially pitfall-full.


Okay, it works now as explained from Knoppix 5.2:

Here is a small script sniplet:



#!/bin/sh

echo "Please start now all apps you'll need for doing what you want while the Knoppix-CD is ejected."
echo " (including just running cdrecord/growisofs once if you are burning a CD/DVD)"
echo "Press any key to continue."
read -n1

eject --help >/dev/null 2>&1
cloop_suspend >/dev/null 2>&1
losetup >/dev/null 2>&1

while true
do
echo "Suspending cloop interfaces ..."
[ -f /cdrom/KNOPPIX/KNOPPIX2 ] && cloop_suspend /dev/cloop2
cloop_suspend /dev/cloop0
echo "Ejecting /cdrom ..."
eject /cdrom
echo "Please take the CD/DVD out of your drive, burn your CD/DVD, put it back in and press a key."
read -n1
echo "Re-Mouting /cdrom ..."
mount /dev/cdrom /cdrom || continue
echo "Awakening suspended cloop interfaces ..."
losetup /dev/cloop0 /cdrom/KNOPPIX/KNOPPIX || continue
if [ -f /cdrom/KNOPPIX/KNOPPIX2 ]
then
losetup /dev/cloop2 /cdrom/KNOPPIX/KNOPPIX2 || continue
fi
break
done

echo "All setup again. Thanks for using this program."


cu

Fabian