]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
UBUNTU: SAUCE: add workarounds to enable ZFS for 4.14
authorColin Ian King <colin.king@canonical.com>
Mon, 6 Nov 2017 17:23:55 +0000 (17:23 +0000)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 29 Jan 2018 13:45:00 +0000 (07:45 -0600)
Currently there are no upstream compat workarounds for 4.14 so for
the moment use some workarounds that enable ZFS to build on 4.14.
I added pre-v4.14 #ifdefs so these patches are compatible with the
userspace dkms ZFS/SPL source. Passes the ZFS kernel team autotest
regression tests.

This should all be superceeded once 7.3.0 lands in Bionic and we
have the official 4.14 compat fixes.

Also enable ZFS in debian/rules

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
spl/include/sys/vmsystm.h
zfs/module/zfs/vdev_disk.c
zfs/module/zfs/zvol.c

index 9d334fe0a16e7bcf04bbdb61be80eaedf596f651..edc0b38249b24e6eb7d6e9b0c14fa959000664d7 100644 (file)
 #include <linux/swap.h>
 #include <linux/highmem.h>
 #include <linux/vmalloc.h>
+#include <linux/version.h>
 #include <sys/types.h>
 #include <asm/uaccess.h>
 
 #define        membar_producer()               smp_wmb()
 #define        physmem                         totalram_pages
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
 #define        freemem                 (nr_free_pages() + \
                                global_page_state(NR_INACTIVE_FILE) + \
                                global_page_state(NR_INACTIVE_ANON) + \
                                global_page_state(NR_SLAB_RECLAIMABLE))
+#else
+#define        freemem                 (nr_free_pages() + \
+                               global_zone_page_state(NR_INACTIVE_FILE) + \
+                               global_zone_page_state(NR_INACTIVE_ANON) + \
+                               global_zone_page_state(NR_SLAB_RECLAIMABLE))
+#endif
 
 #define        xcopyin(from, to, size)         copy_from_user(to, from, size)
 #define        xcopyout(from, to, size)        copy_to_user(to, from, size)
index 33eba20a4a15e40bb1edb841943f50469f0157a8..9968b0379cf532b18aa27477b30e168627f710f9 100644 (file)
@@ -574,7 +574,11 @@ retry:
                /* Matching put called by vdev_disk_physio_completion */
                vdev_disk_dio_get(dr);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
                dr->dr_bio[i]->bi_bdev = bdev;
+#else
+               bio_set_dev(dr->dr_bio[i], bdev);
+#endif
                BIO_BI_SECTOR(dr->dr_bio[i]) = bio_offset >> 9;
                dr->dr_bio[i]->bi_end_io = vdev_disk_physio_completion;
                dr->dr_bio[i]->bi_private = dr;
@@ -650,7 +654,11 @@ vdev_disk_io_flush(struct block_device *bdev, zio_t *zio)
 
        bio->bi_end_io = vdev_disk_io_flush_completion;
        bio->bi_private = zio;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
        bio->bi_bdev = bdev;
+#else
+       bio_set_dev(bio, bdev);
+#endif
        zio->io_delay = jiffies_64;
        bio_set_flush(bio);
        vdev_submit_bio(bio);
index cfdc709864ef19001b2aff8341da3099d3037d73..e03130cfaa9044962f29d99043ef4cc908973e55 100644 (file)
@@ -52,6 +52,7 @@
 #include <sys/spa_impl.h>
 #include <sys/zvol.h>
 #include <linux/blkdev_compat.h>
+#include <linux/version.h>
 
 unsigned int zvol_inhibit_dev = 0;
 unsigned int zvol_major = ZVOL_MAJOR;
@@ -614,7 +615,11 @@ zvol_log_write(zvol_state_t *zv, dmu_tx_t *tx, uint64_t offset,
 static int
 zvol_write(struct bio *bio)
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
        zvol_state_t *zv = bio->bi_bdev->bd_disk->private_data;
+#else
+       zvol_state_t *zv = bio->bi_disk->private_data;
+#endif
        uint64_t offset = BIO_BI_SECTOR(bio) << 9;
        uint64_t size = BIO_BI_SIZE(bio);
        int error = 0;
@@ -664,7 +669,11 @@ out:
 static int
 zvol_discard(struct bio *bio)
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
        zvol_state_t *zv = bio->bi_bdev->bd_disk->private_data;
+#else
+       zvol_state_t *zv = bio->bi_disk->private_data;
+#endif
        uint64_t start = BIO_BI_SECTOR(bio) << 9;
        uint64_t size = BIO_BI_SIZE(bio);
        uint64_t end = start + size;
@@ -706,7 +715,11 @@ zvol_discard(struct bio *bio)
 static int
 zvol_read(struct bio *bio)
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
        zvol_state_t *zv = bio->bi_bdev->bd_disk->private_data;
+#else
+       zvol_state_t *zv = bio->bi_disk->private_data;
+#endif
        uint64_t offset = BIO_BI_SECTOR(bio) << 9;
        uint64_t len = BIO_BI_SIZE(bio);
        int error;