Skip to content

Commit 4ad89b8

Browse files
arter97ersascape
authored andcommitted
init.rc: use /sys/class/block instead of /sys/devices/virtual/block
/sys/class/block covers all of dm-[0-9], sd[a-z], mmcblk[0-9]. Use it instead of /sys/devices/virtual/block, which only covers dm devices. This allows f2fs tunings to be applied more reliably regardless of how the userdata partition is set up. Test: Confirm entries under /dev/sys aren't dangling and cp_interval, gc_urgent_sleep_time, iostat_enable and discard_max_bytes are all set up properly under FBE, FDE and unencrypted. Change-Id: I089af5bc068445f33919df6659671e50456d49f9 Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
1 parent d002bed commit 4ad89b8

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

rootdir/init.rc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,13 +1022,13 @@ on boot
10221022
chown root system /sys/block/zram0/writeback
10231023
chmod 0664 /sys/block/zram0/writeback
10241024

1025-
# to access F2FS sysfs on dm-<num> directly
1025+
# to access F2FS userdata partition sysfs directly
10261026
mkdir /dev/sys/fs/by-name 0755 system system
10271027
symlink /sys/fs/f2fs/${dev.mnt.dev.data} /dev/sys/fs/by-name/userdata
10281028

1029-
# to access dm-<num> sysfs
1029+
# to access userdata device sysfs
10301030
mkdir /dev/sys/block/by-name 0755 system system
1031-
symlink /sys/devices/virtual/block/${dev.mnt.dev.data} /dev/sys/block/by-name/userdata
1031+
symlink /sys/class/block/${dev.mnt.blk.data} /dev/sys/block/by-name/userdata
10321032

10331033
# F2FS tuning. Set cp_interval larger than dirty_expire_centisecs, 30 secs,
10341034
# to avoid power consumption when system becomes mostly idle. Be careful
@@ -1039,8 +1039,7 @@ on boot
10391039
write /dev/sys/fs/by-name/userdata/iostat_enable 1
10401040

10411041
# limit discard size to 128MB in order to avoid long IO latency
1042-
# for filesystem tuning first (dm or sda)
1043-
# Note that, if dm-<num> is used, sda/mmcblk0 should be tuned in vendor/init.rc
1042+
# for filesystem tuning first
10441043
write /dev/sys/block/by-name/userdata/queue/discard_max_bytes 134217728
10451044

10461045
# Permissions for System Server and daemons.

0 commit comments

Comments
 (0)