[systemd-devel] [PATCH] readahead: ARM: fix rotational media detection for MMC

alison_chaiken at mentor.com alison_chaiken at mentor.com
Tue May 13 04:49:38 PDT 2014


From: Alison Chaiken <alison_chaiken at mentor.com>

The ARM runtime reports the major device type associated with
/proc/self/mountinfo as MMC_BLOCK_MAJOR, causing on_ssd() in
readahead-common.c to return false.   on_ssd() should return true, as
MMC like SSD is not rotational.

Signed-off-by: Alison Chaiken <alison_chaiken at mentor.com>
---
 src/readahead/readahead-common.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/readahead/readahead-common.c b/src/readahead/readahead-common.c
index 49679fc..4d1788a 100644
--- a/src/readahead/readahead-common.c
+++ b/src/readahead/readahead-common.c
@@ -27,6 +27,7 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 #include <unistd.h>
+#include <linux/major.h>
 
 #include "log.h"
 #include "readahead-common.h"
@@ -72,6 +73,12 @@ int fs_on_ssd(const char *p) {
         if (stat(p, &st) < 0)
                 return -errno;
 
+#ifdef __arm__
+        if (major(st.st_dev) == MMC_BLOCK_MAJOR) {
+                log_info("readahead: MMC is non-rotating.");
+                return true;
+        }
+#endif
         if (major(st.st_dev) == 0) {
                 _cleanup_fclose_ FILE *f = NULL;
                 int mount_id;
-- 
1.9.1



More information about the systemd-devel mailing list