diff --git a/0001-Add-support-for-a-DAX-root-filesystem.patch b/0001-Add-support-for-a-DAX-root-filesystem.patch new file mode 100644 index 0000000..ea41364 --- /dev/null +++ b/0001-Add-support-for-a-DAX-root-filesystem.patch @@ -0,0 +1,75 @@ +From b4131cefc55ae41862a426bed83aa87c8362866b Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 16 May 2016 18:55:33 +0100 +Subject: [PATCH] Add support for a DAX root filesystem. + +With these changes you can provide an ext4 root filesystem on a +virtual NVDIMM. The filesystem will be mounted using DAX, so files +are directly read, mmapped etc from the underlying host file, saving +guest memory both directly and in the guest page cache. +--- + init/init.c | 19 ++++++++++++++++--- + src/ext2_initrd.ml | 4 ++++ + 2 files changed, 20 insertions(+), 3 deletions(-) + +diff --git a/init/init.c b/init/init.c +index 3014de2..106be02 100644 +--- a/init/init.c ++++ b/init/init.c +@@ -154,11 +154,14 @@ main () + */ + char *root, *path; + size_t len; ++ int dax = 0; + root = strstr (cmdline, "root="); + if (root) { + root += 5; + if (strncmp (root, "/dev/", 5) == 0) + root += 5; ++ if (strncmp (root, "pmem", 4) == 0) ++ dax = 1; + len = strcspn (root, " "); + root[len] = '\0'; + +@@ -243,10 +246,20 @@ main () + exit (EXIT_FAILURE); + } + ++ /* Construct the filesystem mount options. */ ++ const char *mount_options = ""; ++ if (dax) ++ mount_options = "dax"; ++ + /* Mount new root and chroot to it. */ +- if (!quiet) +- fprintf (stderr, "supermin: mounting new root on /root\n"); +- if (mount ("/dev/root", "/root", "ext2", MS_NOATIME, "") == -1) { ++ if (!quiet) { ++ fprintf (stderr, "supermin: mounting new root on /root"); ++ if (mount_options[0] != '\0') ++ fprintf (stderr, " (%s)", mount_options); ++ fprintf (stderr, "\n"); ++ } ++ if (mount ("/dev/root", "/root", "ext2", MS_NOATIME, ++ mount_options) == -1) { + perror ("mount: /root"); + exit (EXIT_FAILURE); + } +diff --git a/src/ext2_initrd.ml b/src/ext2_initrd.ml +index 55a38d0..d4a4e2f 100644 +--- a/src/ext2_initrd.ml ++++ b/src/ext2_initrd.ml +@@ -45,6 +45,10 @@ let kmods = [ + "crc*.ko*"; + "libcrc*.ko*"; + "ibmvscsic.ko*"; ++ "libnvdimm.ko*"; ++ "nd_pmem.ko*"; ++ "nd_btt.ko*"; ++ "nfit.ko*"; + ] + + (* A blacklist of kmods which match the above patterns, but which we +-- +2.7.4 + diff --git a/supermin.spec b/supermin.spec index 2ecbe49..268ca90 100644 --- a/supermin.spec +++ b/supermin.spec @@ -23,7 +23,7 @@ Summary: Tool for creating supermin appliances Name: supermin Version: 5.1.16 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ %if 0%{?rhel} >= 7 @@ -33,6 +33,10 @@ ExclusiveArch: x86_64 URL: http://people.redhat.com/~rjones/supermin/ Source0: http://libguestfs.org/download/supermin/%{name}-%{version}.tar.gz +# Add support for DAX root filesystem using vNVDIMM. +# Upstream commit b4131cefc55ae41862a426bed83aa87c8362866b. +Patch0001: 0001-Add-support-for-a-DAX-root-filesystem.patch + BuildRequires: /usr/bin/pod2man BuildRequires: /usr/bin/pod2html BuildRequires: rpm @@ -155,6 +159,9 @@ make check || { %changelog +* Tue May 17 2016 Richard W.M. Jones - 5.1.16-3 +- Add upstream patch for DAX / vNVDIMM support. + * Wed Apr 27 2016 Richard W.M. Jones - 5.1.16-2 - New upstream version 5.1.16. - Drop all patches since they are upstream.