diff mbox series

[ACT,1/2] ubuntu_zfs_xfs_generic: Cherrypick build fix for 5.15 kernels

Message ID 20220121144939.2065081-2-dimitri.ledkov@canonical.com
State New
Headers show
Series ubuntu_zfs_xfs_generic: Fix build for v5.15 kernels | expand

Commit Message

Dimitri John Ledkov Jan. 21, 2022, 2:49 p.m. UTC
ubuntu_zfs_xfs_generic uses old snapshots of xfs tests & fio
repositories. v5.15 has dropped raw support, thus cherry-picking patch
from more recent fio to unbreak the build. Overall xfs tests are
pinned to a version from 2019. Separately, an upgrade to a more recent
snapshot of tests is needed.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
---
 ...75557e632efb506836bc1709789e615c9094.patch | 118 ++++++++++++++++++
 .../ubuntu_zfs_xfs_generic.py                 |   2 +
 2 files changed, 120 insertions(+)
 create mode 100644 ubuntu_zfs_xfs_generic/382975557e632efb506836bc1709789e615c9094.patch
diff mbox series

Patch

diff --git a/ubuntu_zfs_xfs_generic/382975557e632efb506836bc1709789e615c9094.patch b/ubuntu_zfs_xfs_generic/382975557e632efb506836bc1709789e615c9094.patch
new file mode 100644
index 0000000000..8f09a0394a
--- /dev/null
+++ b/ubuntu_zfs_xfs_generic/382975557e632efb506836bc1709789e615c9094.patch
@@ -0,0 +1,118 @@ 
+From 382975557e632efb506836bc1709789e615c9094 Mon Sep 17 00:00:00 2001
+From: Eric Sandeen <esandeen@redhat.com>
+Date: Tue, 3 Aug 2021 10:23:35 -0700
+Subject: fio: remove raw device support
+
+As of Linux kernel commit 603e4922f1c ("remove the raw driver"),
+linux/raw.h is gone, and raw device support no longer exists.
+Because of this, fio can no longer build against the current Linux
+kernel headers.
+
+So, remove raw device support from fio as well.
+
+Signed-off-by: Eric Sandeen <sandeen@redhat.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+---
+ diskutil.c    | 10 +++-------
+ fio.1         |  4 +---
+ os/os-linux.h | 32 --------------------------------
+ os/os.h       |  4 ----
+ 4 files changed, 4 insertions(+), 46 deletions(-)
+
+diff --git a/diskutil.c b/diskutil.c
+index 0051a7a0..ace7af3d 100644
+--- a/diskutil.c
++++ b/diskutil.c
+@@ -166,14 +166,10 @@ static int get_device_numbers(char *file_name, int *maj, int *min)
+ 		if (S_ISBLK(st.st_mode)) {
+ 			majdev = major(st.st_rdev);
+ 			mindev = minor(st.st_rdev);
+-		} else if (S_ISCHR(st.st_mode)) {
+-			majdev = major(st.st_rdev);
+-			mindev = minor(st.st_rdev);
+-			if (fio_lookup_raw(st.st_rdev, &majdev, &mindev))
+-				return -1;
+-		} else if (S_ISFIFO(st.st_mode))
++		} else if (S_ISCHR(st.st_mode) ||
++			   S_ISFIFO(st.st_mode)) {
+ 			return -1;
+-		else {
++		} else {
+ 			majdev = major(st.st_dev);
+ 			mindev = minor(st.st_dev);
+ 		}
+diff --git a/os/os-linux.h b/os/os-linux.h
+index f7137abe..16ed5258 100644
+--- a/os/os-linux.h
++++ b/os/os-linux.h
+@@ -14,7 +14,6 @@
+ #include <errno.h>
+ #include <sched.h>
+ #include <linux/unistd.h>
+-#include <linux/raw.h>
+ #include <linux/major.h>
+ #include <linux/fs.h>
+ #include <scsi/sg.h>
+@@ -41,7 +40,6 @@
+ #define FIO_HAVE_IOSCHED_SWITCH
+ #define FIO_HAVE_ODIRECT
+ #define FIO_HAVE_HUGETLB
+-#define FIO_HAVE_RAWBIND
+ #define FIO_HAVE_BLKTRACE
+ #define FIO_HAVE_CL_SIZE
+ #define FIO_HAVE_CGROUPS
+@@ -178,36 +176,6 @@ static inline unsigned long long os_phys_mem(void)
+ 	return (unsigned long long) pages * (unsigned long long) pagesize;
+ }
+ 
+-static inline int fio_lookup_raw(dev_t dev, int *majdev, int *mindev)
+-{
+-	struct raw_config_request rq;
+-	int fd;
+-
+-	if (major(dev) != RAW_MAJOR)
+-		return 1;
+-
+-	/*
+-	 * we should be able to find /dev/rawctl or /dev/raw/rawctl
+-	 */
+-	fd = open("/dev/rawctl", O_RDONLY);
+-	if (fd < 0) {
+-		fd = open("/dev/raw/rawctl", O_RDONLY);
+-		if (fd < 0)
+-			return 1;
+-	}
+-
+-	rq.raw_minor = minor(dev);
+-	if (ioctl(fd, RAW_GETBIND, &rq) < 0) {
+-		close(fd);
+-		return 1;
+-	}
+-
+-	close(fd);
+-	*majdev = rq.block_major;
+-	*mindev = rq.block_minor;
+-	return 0;
+-}
+-
+ #ifdef O_NOATIME
+ #define FIO_O_NOATIME	O_NOATIME
+ #else
+diff --git a/os/os.h b/os/os.h
+index e47d3d97..17daf91d 100644
+--- a/os/os.h
++++ b/os/os.h
+@@ -157,10 +157,6 @@ extern int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu);
+ #define OS_RAND_MAX			RAND_MAX
+ #endif
+ 
+-#ifndef FIO_HAVE_RAWBIND
+-#define fio_lookup_raw(dev, majdev, mindev)	1
+-#endif
+-
+ #ifndef FIO_PREFERRED_ENGINE
+ #define FIO_PREFERRED_ENGINE	"psync"
+ #endif
+-- 
+cgit v1.2.3
+
diff --git a/ubuntu_zfs_xfs_generic/ubuntu_zfs_xfs_generic.py b/ubuntu_zfs_xfs_generic/ubuntu_zfs_xfs_generic.py
index 6fc0d2ee76..f2224ce40b 100644
--- a/ubuntu_zfs_xfs_generic/ubuntu_zfs_xfs_generic.py
+++ b/ubuntu_zfs_xfs_generic/ubuntu_zfs_xfs_generic.py
@@ -107,6 +107,8 @@  class ubuntu_zfs_xfs_generic(test.test):
         os.chdir(os.path.join(self.srcdir, 'xfstests-bld', 'fio'))
         print("Patching fio: fix linker issues with modern gcc")
         utils.system('patch -p1 < %s/0008-Fix-linker-issues-by-making-tsc_reliable-a-weak-refe.patch' % self.bindir)
+        print("Patch out raw support")
+        utils.system('patch -p1 < %s/382975557e632efb506836bc1709789e615c9094.patch' % self.bindir)
 
 #       os.chdir(os.path.join(self.srcdir, 'xfstests-bld'))
 #       print("getting xfs tests source")