Add upstream patch for DAX / vNVDIMM support.

This commit is contained in:
Richard W.M. Jones 2016-05-17 16:23:33 +01:00
parent 7c8a2fdf46
commit f69129dcba
2 changed files with 83 additions and 1 deletions

View File

@ -0,0 +1,75 @@
From b4131cefc55ae41862a426bed83aa87c8362866b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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

View File

@ -23,7 +23,7 @@
Summary: Tool for creating supermin appliances Summary: Tool for creating supermin appliances
Name: supermin Name: supermin
Version: 5.1.16 Version: 5.1.16
Release: 2%{?dist} Release: 3%{?dist}
License: GPLv2+ License: GPLv2+
%if 0%{?rhel} >= 7 %if 0%{?rhel} >= 7
@ -33,6 +33,10 @@ ExclusiveArch: x86_64
URL: http://people.redhat.com/~rjones/supermin/ URL: http://people.redhat.com/~rjones/supermin/
Source0: http://libguestfs.org/download/supermin/%{name}-%{version}.tar.gz 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/pod2man
BuildRequires: /usr/bin/pod2html BuildRequires: /usr/bin/pod2html
BuildRequires: rpm BuildRequires: rpm
@ -155,6 +159,9 @@ make check || {
%changelog %changelog
* Tue May 17 2016 Richard W.M. Jones <rjones@redhat.com> - 5.1.16-3
- Add upstream patch for DAX / vNVDIMM support.
* Wed Apr 27 2016 Richard W.M. Jones <rjones@redhat.com> - 5.1.16-2 * Wed Apr 27 2016 Richard W.M. Jones <rjones@redhat.com> - 5.1.16-2
- New upstream version 5.1.16. - New upstream version 5.1.16.
- Drop all patches since they are upstream. - Drop all patches since they are upstream.