Re: Reclaim space from unused ramdisk?

2005-07-27 Thread Jan Engelhardt
>>It ships with util-linux.  Weird that a distro would omit it.
>
>Euh, is it already included in util-linux-2.12q?

I hate me. It was not in $PATH (/sbin).



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-27 Thread Jan Engelhardt
>> >> }
>> >
>> >hmm, yes.  That's a special-case in the ramdisk driver.
>> >The command `blockdev --flushbufs /dev/ram0' should have the same effect.
>> 
>> Interesting. Command not found, here. URL?
>
>It ships with util-linux.  Weird that a distro would omit it.

Don't look at me, look at SUSE.

Euh, is it already included in util-linux-2.12q?


Jan Engelhardt
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-27 Thread Andrew Morton
Jan Engelhardt <[EMAIL PROTECTED]> wrote:
>
> >> }
> >> 
> >
> >hmm, yes.  That's a special-case in the ramdisk driver.
> >
> >The command `blockdev --flushbufs /dev/ram0' should have the same effect.
> 
> Interesting. Command not found, here. URL?
> 

It ships with util-linux.  Weird that a distro would omit it.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-27 Thread Jan Engelhardt
>> }
>> 
>
>hmm, yes.  That's a special-case in the ramdisk driver.
>
>The command `blockdev --flushbufs /dev/ram0' should have the same effect.

Interesting. Command not found, here. URL?



Jan Engelhardt
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-27 Thread Andrew Morton
Jan Engelhardt <[EMAIL PROTECTED]> wrote:
>
> >I wonder if it would be possible to somehow reclaim space that has
> >been previously reserved for a ramdisk without rebooting.
> 
> free_ramdisk.c:
> 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> 
> int main(int argc, const char **argv) {
> int eax = 0;
> while(*argv != NULL) {
> int fd = open(*argv, O_RDWR);
> if(fd < 0) {
> fprintf(stderr, "Warning: Cannot open %s: %s\n",
>  *argv, strerror(errno));
> if(eax == 0) { eax = errno; }
> continue;
> }
> ioctl(fd, BLKFLSBUF, 0);
> close(fd);
> ++argv;
> }
> return eax == 0;
> }
> 

hmm, yes.  That's a special-case in the ramdisk driver.

The command `blockdev --flushbufs /dev/ram0' should have the same effect.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-27 Thread Jan Engelhardt
>I wonder if it would be possible to somehow reclaim space that has
>been previously reserved for a ramdisk without rebooting.

free_ramdisk.c:

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

int main(int argc, const char **argv) {
int eax = 0;
while(*argv != NULL) {
int fd = open(*argv, O_RDWR);
if(fd < 0) {
fprintf(stderr, "Warning: Cannot open %s: %s\n",
 *argv, strerror(errno));
if(eax == 0) { eax = errno; }
continue;
}
ioctl(fd, BLKFLSBUF, 0);
close(fd);
++argv;
}
return eax == 0;
}

//eof


>How difficult would this be to write?


Jan Engelhardt
-- 
| Alphagate Systems, http://alphagate.hopto.org/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-27 Thread Jan Engelhardt
I wonder if it would be possible to somehow reclaim space that has
been previously reserved for a ramdisk without rebooting.

free_ramdisk.c:

#include sys/ioctl.h
#include sys/mount.h
#include sys/stat.h
#include sys/types.h
#include errno.h
#include fcntl.h
#include stdio.h
#include string.h
#include unistd.h

int main(int argc, const char **argv) {
int eax = 0;
while(*argv != NULL) {
int fd = open(*argv, O_RDWR);
if(fd  0) {
fprintf(stderr, Warning: Cannot open %s: %s\n,
 *argv, strerror(errno));
if(eax == 0) { eax = errno; }
continue;
}
ioctl(fd, BLKFLSBUF, 0);
close(fd);
++argv;
}
return eax == 0;
}

//eof


How difficult would this be to write?


Jan Engelhardt
-- 
| Alphagate Systems, http://alphagate.hopto.org/
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-27 Thread Andrew Morton
Jan Engelhardt [EMAIL PROTECTED] wrote:

 I wonder if it would be possible to somehow reclaim space that has
 been previously reserved for a ramdisk without rebooting.
 
 free_ramdisk.c:
 
 #include sys/ioctl.h
 #include sys/mount.h
 #include sys/stat.h
 #include sys/types.h
 #include errno.h
 #include fcntl.h
 #include stdio.h
 #include string.h
 #include unistd.h
 
 int main(int argc, const char **argv) {
 int eax = 0;
 while(*argv != NULL) {
 int fd = open(*argv, O_RDWR);
 if(fd  0) {
 fprintf(stderr, Warning: Cannot open %s: %s\n,
  *argv, strerror(errno));
 if(eax == 0) { eax = errno; }
 continue;
 }
 ioctl(fd, BLKFLSBUF, 0);
 close(fd);
 ++argv;
 }
 return eax == 0;
 }
 

hmm, yes.  That's a special-case in the ramdisk driver.

The command `blockdev --flushbufs /dev/ram0' should have the same effect.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-27 Thread Jan Engelhardt
 }
 

hmm, yes.  That's a special-case in the ramdisk driver.

The command `blockdev --flushbufs /dev/ram0' should have the same effect.

Interesting. Command not found, here. URL?



Jan Engelhardt
-- 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-27 Thread Andrew Morton
Jan Engelhardt [EMAIL PROTECTED] wrote:

  }
  
 
 hmm, yes.  That's a special-case in the ramdisk driver.
 
 The command `blockdev --flushbufs /dev/ram0' should have the same effect.
 
 Interesting. Command not found, here. URL?
 

It ships with util-linux.  Weird that a distro would omit it.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-27 Thread Jan Engelhardt
  }
 
 hmm, yes.  That's a special-case in the ramdisk driver.
 The command `blockdev --flushbufs /dev/ram0' should have the same effect.
 
 Interesting. Command not found, here. URL?

It ships with util-linux.  Weird that a distro would omit it.

Don't look at me, look at SUSE.

Euh, is it already included in util-linux-2.12q?


Jan Engelhardt
-- 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-27 Thread Jan Engelhardt
It ships with util-linux.  Weird that a distro would omit it.

Euh, is it already included in util-linux-2.12q?

I hate me. It was not in $PATH (/sbin).



-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-26 Thread Marc Ballarin
On Tue, 26 Jul 2005 15:16:58 -0700
Mike Mohr <[EMAIL PROTECTED]> wrote:

> I wonder if it would be possible to somehow reclaim space that has
> been previously reserved for a ramdisk without rebooting.  I read the
> ramdisk docs in the latest kernel source and it seems that it is not
> currently possible.  However, the kernel keeps track of the memory
> allocated for said ramdisks; would it not be possible with root (or
> even kernel) permissions to remove the flag that prevents the VM
> subsystem from reclaiming that space?  I realize that rot permissions
> may not be high enough.  In that case, could a module be written that
> takes a device name as a parameter then uses it to look up the
> reserved memory that device uses, then resets the necessary flag and
> finally unloads itself?  It would have to check that the filesystem
> was unmounted, of course.
> 
> How difficult would this be to write?

Hi,

ramfs (always there) and tmpfs (optional) already do this.
tmpfs can be swapped out, ramfs always uses physical memory.

mount -t ramfs none /mnt/blah
mount -t tmpfs none /mnt/blah

Regards
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Reclaim space from unused ramdisk?

2005-07-26 Thread Mike Mohr
I wonder if it would be possible to somehow reclaim space that has
been previously reserved for a ramdisk without rebooting.  I read the
ramdisk docs in the latest kernel source and it seems that it is not
currently possible.  However, the kernel keeps track of the memory
allocated for said ramdisks; would it not be possible with root (or
even kernel) permissions to remove the flag that prevents the VM
subsystem from reclaiming that space?  I realize that rot permissions
may not be high enough.  In that case, could a module be written that
takes a device name as a parameter then uses it to look up the
reserved memory that device uses, then resets the necessary flag and
finally unloads itself?  It would have to check that the filesystem
was unmounted, of course.

How difficult would this be to write?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Reclaim space from unused ramdisk?

2005-07-26 Thread Mike Mohr
I wonder if it would be possible to somehow reclaim space that has
been previously reserved for a ramdisk without rebooting.  I read the
ramdisk docs in the latest kernel source and it seems that it is not
currently possible.  However, the kernel keeps track of the memory
allocated for said ramdisks; would it not be possible with root (or
even kernel) permissions to remove the flag that prevents the VM
subsystem from reclaiming that space?  I realize that rot permissions
may not be high enough.  In that case, could a module be written that
takes a device name as a parameter then uses it to look up the
reserved memory that device uses, then resets the necessary flag and
finally unloads itself?  It would have to check that the filesystem
was unmounted, of course.

How difficult would this be to write?
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Reclaim space from unused ramdisk?

2005-07-26 Thread Marc Ballarin
On Tue, 26 Jul 2005 15:16:58 -0700
Mike Mohr [EMAIL PROTECTED] wrote:

 I wonder if it would be possible to somehow reclaim space that has
 been previously reserved for a ramdisk without rebooting.  I read the
 ramdisk docs in the latest kernel source and it seems that it is not
 currently possible.  However, the kernel keeps track of the memory
 allocated for said ramdisks; would it not be possible with root (or
 even kernel) permissions to remove the flag that prevents the VM
 subsystem from reclaiming that space?  I realize that rot permissions
 may not be high enough.  In that case, could a module be written that
 takes a device name as a parameter then uses it to look up the
 reserved memory that device uses, then resets the necessary flag and
 finally unloads itself?  It would have to check that the filesystem
 was unmounted, of course.
 
 How difficult would this be to write?

Hi,

ramfs (always there) and tmpfs (optional) already do this.
tmpfs can be swapped out, ramfs always uses physical memory.

mount -t ramfs none /mnt/blah
mount -t tmpfs none /mnt/blah

Regards
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/