Whamcloud - gitweb
LU-15544 osd-ldiskfs: Update bio_set_dev and BIO_MAX_VECS 35/49135/5
authorShaun Tancheff <shaun.tancheff@hpe.com>
Fri, 11 Nov 2022 08:19:53 +0000 (02:19 -0600)
committerOleg Drokin <green@whamcloud.com>
Tue, 6 Dec 2022 02:44:14 +0000 (02:44 +0000)
Linux commit v5.11-rc5-9-g309dca309fc3
  block: store a block_device pointer in struct bio
created bio_set_dev macro and
Linux commit v5.15-rc6-127-gcf6d6238cdd3
  block: turn macro helpers into inline functions
change the macro to an inline function for bio_set_dev.
This change tests for bio_set_dev and provides one, if one
is not provided by the kernel.

Linux commit v5.12-rc1-20-ga8affc03a9b3
   block: rename BIO_MAX_PAGES to BIO_MAX_VECS
This change provide a fallback for older kernels when
BIO_MAX_VECS is not defined.

Linux commit v5.11-rc4-8-g5857c9209ce5
  mm: Mark anonymous struct field of 'struct vm_fault' as 'const'
Breaks and exisiting configure test for vm_fault.address
This changes the configure test for vm_fault.address so it does
not fail due to address being const

Test-Parameters: trivial
HPE-bug-id: LUS-10744
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I06d3bf60e32b969e1e635e378cbd1ee36293165c
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49135
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-ldiskfs/osd_io.c

index b359045..355e7af 100644 (file)
@@ -1993,8 +1993,9 @@ LB_CHECK_COMPILE([if 'struct vm_fault' replaced virtual_address with address fie
 vm_fault_address, [
        #include <linux/mm.h>
 ],[
-       unsigned long vaddr = ((struct vm_fault *)0)->address;
-       (void)vaddr;
+               struct vm_fault vmf = { 0 };
+               unsigned long addr = (unsigned long)vmf.address;
+               (void)addr;
 ],[
        AC_DEFINE(HAVE_VM_FAULT_ADDRESS, 1,
                [virtual_address has been replaced by address field])
@@ -2686,6 +2687,35 @@ EXTRA_KCFLAGS="$tmp_flags"
 ]) # LC_FSCRYPT_IS_NOKEY_NAME
 
 #
+# LC_BIO_SET_DEV
+#
+# Linux: v5.11-rc5-9-g309dca309fc3
+#   block: store a block_device pointer in struct bio
+# created bio_set_dev macro
+# Linux: v5.15-rc6-127-gcf6d6238cdd3
+#   block: turn macro helpers into inline functions
+# created inline function(s).
+#
+# Only provide a bio_set_dev it is is not proveded by the kernel
+#
+AC_DEFUN([LC_BIO_SET_DEV], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+       LB_CHECK_COMPILE([if 'bio_set_dev' is available],
+       [bio_set_dev], [
+               #include <linux/bio.h>
+       ],[
+               struct bio *bio = NULL;
+               struct block_device *bdev = NULL;
+
+               bio_set_dev(bio, bdev);
+       ],[
+               AC_DEFINE(HAVE_BIO_SET_DEV, 1, ['bio_set_dev' is available])
+       ])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LC_BIO_SET_DEV
+
+#
 # LC_HAVE_USER_NAMESPACE_ARG
 #
 # kernel 5.12 commit 549c7297717c32ee53f156cd949e055e601f67bb
@@ -2924,11 +2954,14 @@ AC_DEFUN([LC_PROG_LINUX], [
        # 5.7
        LC_FSCRYPT_DUMMY_CONTEXT_ENABLED
 
+       # 5.9
+       LC_HAVE_ITER_FILE_SPLICE_WRITE
+
        # 5.10
        LC_FSCRYPT_IS_NOKEY_NAME
 
-       # 5.10
-       LC_HAVE_ITER_FILE_SPLICE_WRITE
+       # 5.11
+       LC_BIO_SET_DEV
 
        # 5.12
        LC_HAVE_USER_NAMESPACE_ARG
index 1145b87..44c52ec 100644 (file)
@@ -1498,7 +1498,10 @@ bool bio_integrity_enabled(struct bio *bio);
 # define bio_get_dev(bio)      ((bio)->bi_bdev)
 # define bio_get_disk(bio)     (bio_get_dev(bio)->bd_disk)
 # define bio_get_queue(bio)    bdev_get_queue(bio_get_dev(bio))
-# define bio_set_dev(bio, bdev) (bio_get_dev(bio) = (bdev))
+
+# ifndef HAVE_BIO_SET_DEV
+#  define bio_set_dev(bio, bdev) (bio_get_dev(bio) = (bdev))
+# endif
 #else
 # define bio_get_disk(bio)     ((bio)->bi_disk)
 # define bio_get_queue(bio)    (bio_get_disk(bio)->queue)
index 8b03d37..82651ef 100644 (file)
@@ -476,6 +476,14 @@ static void osd_mark_page_io_done(struct osd_iobuf *iobuf,
        }
 }
 
+/*
+ * Linux v5.12-rc1-20-ga8affc03a9b3
+ *  block: rename BIO_MAX_PAGES to BIO_MAX_VECS
+ */
+#ifndef BIO_MAX_VECS
+#define BIO_MAX_VECS   BIO_MAX_PAGES
+#endif
+
 static int osd_do_bio(struct osd_device *osd, struct inode *inode,
                      struct osd_iobuf *iobuf, sector_t start_blocks,
                      sector_t count)
@@ -597,7 +605,8 @@ static int osd_do_bio(struct osd_device *osd, struct inode *inode,
 
                        bio_start_page_idx = page_idx;
                        /* allocate new bio */
-                       bio = bio_alloc(GFP_NOIO, min(BIO_MAX_PAGES,
+                       bio = bio_alloc(GFP_NOIO, min_t(unsigned short,
+                                       BIO_MAX_VECS,
                                        (block_idx_end - block_idx +
                                         blocks_left_page - 1)));
                        if (bio == NULL) {