[source] zram-swap: CONFIG_PROCD_ZRAM_TMPFS compatibility

LEDE Commits lede-commits at lists.infradead.org
Sun Sep 4 22:31:15 PDT 2016


blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/f362dc154d776630fd0c02062b50e9f02d57476f

commit f362dc154d776630fd0c02062b50e9f02d57476f
Author: Conn O'Griofa <connogriofa at gmail.com>
AuthorDate: Sun Jul 24 17:18:39 2016 +0100

    zram-swap: CONFIG_PROCD_ZRAM_TMPFS compatibility
    
    Enable CONFIG_PROCD_ZRAM_TMPFS compatibility via two changes to list_cpu_idx():
    * detect if /tmp is being used by /dev/zram0; if yes, offset initial value by 1 to skip first zram device.
    * hot-add /dev/zram1, if not already present.
    
    Signed-off-by: Conn O'Griofa >connogriofa at gmail.com>
---
 package/system/zram-swap/files/zram.init | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init
index 23de915..431e47c 100644
--- a/package/system/zram-swap/files/zram.init
+++ b/package/system/zram-swap/files/zram.init
@@ -71,8 +71,17 @@ zram_reset()
 
 list_cpu_idx()
 {
-	local line i=0
-
+	# Offset by 1 if /dev/zram0 is in use by /tmp
+	if [ "$(mount | grep /dev/zram0)" ]; then
+		local line i=1
+		# Hot-add new ZRAM device (if necessary)
+		if [ ! -b /dev/zram1 ]; then 
+			cat /sys/class/zram-control/hot_add
+		fi
+	else
+		local line i=0
+	fi
+	
 	while read line; do {
 		case "$line" in
 			[Pp]rocessor*)



More information about the lede-commits mailing list