diff mbox

[LEDE-DEV] generic: prefer tmpfs over ramfs

Message ID 1490597532-87971-1-git-send-email-thomas@reifferscheid.org
State Changes Requested
Delegated to: John Crispin
Headers show

Commit Message

Thomas Reifferscheid March 27, 2017, 6:52 a.m. UTC
The patch prefers tmpfs over ramfs adjusting the code to comply with
the kernel docs. Details:

ramfs and tmpfs:
----------------

One downside of ramfs is you can keep writing data into it until you
fill up all memory, and the VM can't free it because the VM thinks that
files should get written to backing store (rather than swap space), but
ramfs hasn't got any backing store.  Because of this, only root (or a
trusted user) should be allowed write access to a ramfs mount.

A ramfs derivative called tmpfs was created to add size limits, and the
ability to write the data to swap space.  Normal users can be allowed
write access to tmpfs mounts.  See Documentation/filesystems/tmpfs.txt
for more information.

rootfs:
----------------
If CONFIG_TMPFS is enabled, rootfs will use tmpfs instead of ramfs by
default.  To force ramfs, add "rootfstype=ramfs" to the kernel command
line.

Fixes: The inability of diskfree of getting the size or usage
information for rootfs when on initramfs kernels.

Signed-off-by: Thomas Reifferscheid <thomas@reifferscheid.org>
---
 .../linux/generic/patches-4.9/495-use-tmpfs-over-ramfs.patch  | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 target/linux/generic/patches-4.9/495-use-tmpfs-over-ramfs.patch
diff mbox

Patch

diff --git a/target/linux/generic/patches-4.9/495-use-tmpfs-over-ramfs.patch b/target/linux/generic/patches-4.9/495-use-tmpfs-over-ramfs.patch
new file mode 100644
index 0000000..6474ccd
--- /dev/null
+++ b/target/linux/generic/patches-4.9/495-use-tmpfs-over-ramfs.patch
@@ -0,0 +1,11 @@ 
+--- kernel/init/do_mounts.c.orig	2017-03-22 17:15:52.587772894 +0100
++++ kernel/init/do_mounts.c	2017-03-22 17:52:50.343828875 +0100
+@@ -659,7 +659,7 @@
+ 		return err;
+ 
+ 	if (IS_ENABLED(CONFIG_TMPFS) && !saved_root_name[0] &&
+-		(!root_fs_names || strstr(root_fs_names, "tmpfs"))) {
++		(!root_fs_names || !strstr(root_fs_names, "ramfs"))) {
+ 		err = shmem_init();
+ 		is_tmpfs = true;
+ 	} else {