Re: Reclaim space from unused ramdisk?

From: Andrew Morton (akpm_at_osdl.org)
Date: 07/27/05

  • Next message: Pavel Machek: "Re: [swsusp] encrypt suspend data for easy wiping"
    Date:	Tue, 26 Jul 2005 23:56:24 -0700
    To: Jan Engelhardt <jengelh@linux01.gwdg.de>
    
    

    Jan Engelhardt <jengelh@linux01.gwdg.de> 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 majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Pavel Machek: "Re: [swsusp] encrypt suspend data for easy wiping"

    Relevant Pages

    • Reclaim space from unused ramdisk?
      ... I wonder if it would be possible to somehow reclaim space that has ... been previously reserved for a ramdisk without rebooting. ... the kernel keeps track of the memory ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: BOOT_CS
      ... >>Anyone happen to know of any legitimate reason not to reload %cs in ... Care to export where the bottom of the page ... putting the ramdisk in the "most incorrect" position is simply wrong. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Next step with LinuxBIOS
      ... the kernel get 682k. ... boot from Net.. ... the small program in ramdisk or initramfs...? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] skip initramfs check
      ... But I think it is feasible to simply move the ramdisk ... detection and unpacking inside the ramfs state machine. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: IBM HDAPS things are looking up (was: Re: [Hdaps-devel] Re: [ltp] IBM HDAPS Someone interested?
      ... >reasons. ... Taking computer for a jog playing mp3s from ramdisk is ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)