|
|
c431b2 |
From b4131cefc55ae41862a426bed83aa87c8362866b Mon Sep 17 00:00:00 2001
|
|
|
c431b2 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
c431b2 |
Date: Mon, 16 May 2016 18:55:33 +0100
|
|
|
c431b2 |
Subject: [PATCH 1/7] Add support for a DAX root filesystem.
|
|
|
c431b2 |
|
|
|
c431b2 |
With these changes you can provide an ext4 root filesystem on a
|
|
|
c431b2 |
virtual NVDIMM. The filesystem will be mounted using DAX, so files
|
|
|
c431b2 |
are directly read, mmapped etc from the underlying host file, saving
|
|
|
c431b2 |
guest memory both directly and in the guest page cache.
|
|
|
c431b2 |
---
|
|
|
c431b2 |
init/init.c | 19 ++++++++++++++++---
|
|
|
c431b2 |
src/ext2_initrd.ml | 4 ++++
|
|
|
c431b2 |
2 files changed, 20 insertions(+), 3 deletions(-)
|
|
|
c431b2 |
|
|
|
c431b2 |
diff --git a/init/init.c b/init/init.c
|
|
|
c431b2 |
index 3014de2..106be02 100644
|
|
|
c431b2 |
--- a/init/init.c
|
|
|
c431b2 |
+++ b/init/init.c
|
|
|
c431b2 |
@@ -154,11 +154,14 @@ main ()
|
|
|
c431b2 |
*/
|
|
|
c431b2 |
char *root, *path;
|
|
|
c431b2 |
size_t len;
|
|
|
c431b2 |
+ int dax = 0;
|
|
|
c431b2 |
root = strstr (cmdline, "root=");
|
|
|
c431b2 |
if (root) {
|
|
|
c431b2 |
root += 5;
|
|
|
c431b2 |
if (strncmp (root, "/dev/", 5) == 0)
|
|
|
c431b2 |
root += 5;
|
|
|
c431b2 |
+ if (strncmp (root, "pmem", 4) == 0)
|
|
|
c431b2 |
+ dax = 1;
|
|
|
c431b2 |
len = strcspn (root, " ");
|
|
|
c431b2 |
root[len] = '\0';
|
|
|
c431b2 |
|
|
|
c431b2 |
@@ -243,10 +246,20 @@ main ()
|
|
|
c431b2 |
exit (EXIT_FAILURE);
|
|
|
c431b2 |
}
|
|
|
c431b2 |
|
|
|
c431b2 |
+ /* Construct the filesystem mount options. */
|
|
|
c431b2 |
+ const char *mount_options = "";
|
|
|
c431b2 |
+ if (dax)
|
|
|
c431b2 |
+ mount_options = "dax";
|
|
|
c431b2 |
+
|
|
|
c431b2 |
/* Mount new root and chroot to it. */
|
|
|
c431b2 |
- if (!quiet)
|
|
|
c431b2 |
- fprintf (stderr, "supermin: mounting new root on /root\n");
|
|
|
c431b2 |
- if (mount ("/dev/root", "/root", "ext2", MS_NOATIME, "") == -1) {
|
|
|
c431b2 |
+ if (!quiet) {
|
|
|
c431b2 |
+ fprintf (stderr, "supermin: mounting new root on /root");
|
|
|
c431b2 |
+ if (mount_options[0] != '\0')
|
|
|
c431b2 |
+ fprintf (stderr, " (%s)", mount_options);
|
|
|
c431b2 |
+ fprintf (stderr, "\n");
|
|
|
c431b2 |
+ }
|
|
|
c431b2 |
+ if (mount ("/dev/root", "/root", "ext2", MS_NOATIME,
|
|
|
c431b2 |
+ mount_options) == -1) {
|
|
|
c431b2 |
perror ("mount: /root");
|
|
|
c431b2 |
exit (EXIT_FAILURE);
|
|
|
c431b2 |
}
|
|
|
c431b2 |
diff --git a/src/ext2_initrd.ml b/src/ext2_initrd.ml
|
|
|
c431b2 |
index 55a38d0..d4a4e2f 100644
|
|
|
c431b2 |
--- a/src/ext2_initrd.ml
|
|
|
c431b2 |
+++ b/src/ext2_initrd.ml
|
|
|
c431b2 |
@@ -45,6 +45,10 @@ let kmods = [
|
|
|
c431b2 |
"crc*.ko*";
|
|
|
c431b2 |
"libcrc*.ko*";
|
|
|
c431b2 |
"ibmvscsic.ko*";
|
|
|
c431b2 |
+ "libnvdimm.ko*";
|
|
|
c431b2 |
+ "nd_pmem.ko*";
|
|
|
c431b2 |
+ "nd_btt.ko*";
|
|
|
c431b2 |
+ "nfit.ko*";
|
|
|
c431b2 |
]
|
|
|
c431b2 |
|
|
|
c431b2 |
(* A blacklist of kmods which match the above patterns, but which we
|
|
|
c431b2 |
--
|
|
|
c431b2 |
2.7.4
|
|
|
c431b2 |
|