From c30172210ff335f3b3410a8fee241ce543698a18 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 17 Oct 2023 11:53:17 -0700 Subject: [PATCH] Use blk_opf_t to pass bio op flags Compat is back to unsigned int. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 8 ++++++++ kmod/src/block.c | 6 +++--- kmod/src/kernelcompat.h | 5 +++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 352f2671..75058633 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -258,3 +258,11 @@ endif ifneq (,$(shell grep 'static inline const char .xattr_prefix' include/linux/xattr.h)) ccflags-y += -DKC_XATTR_HANDLER_NAME=1 endif + +# +# v5.19-rc4-96-g342a72a33407 +# +# Adds `typedef __u32 __bitwise blk_opf_t` to aid flag checking +ifneq (,$(shell grep 'typedef __u32 __bitwise blk_opf_t' include/linux/blk_types.h)) +ccflags-y += -DKC_HAVE_BLK_OPF_T=1 +endif diff --git a/kmod/src/block.c b/kmod/src/block.c index 50f16d99..08acc05e 100644 --- a/kmod/src/block.c +++ b/kmod/src/block.c @@ -437,7 +437,7 @@ static void block_remove_all(struct super_block *sb) * possible. Final freeing, verifying checksums, and unlinking errored * blocks are all done by future users of the blocks. */ -static void block_end_io(struct super_block *sb, unsigned int opf, +static void block_end_io(struct super_block *sb, blk_opf_t opf, struct block_private *bp, int err) { DECLARE_BLOCK_INFO(sb, binf); @@ -477,7 +477,7 @@ static void KC_DECLARE_BIO_END_IO(block_bio_end_io, struct bio *bio) * Kick off IO for a single block. */ static int block_submit_bio(struct super_block *sb, struct block_private *bp, - unsigned int opf) + blk_opf_t opf) { struct scoutfs_sb_info *sbi = SCOUTFS_SB(sb); struct bio *bio = NULL; @@ -1200,7 +1200,7 @@ static void KC_DECLARE_BIO_END_IO(sm_block_bio_end_io, struct bio *bio) * only layer that sees the full block buffer so we pass the calculated * crc to the caller for them to check in their context. */ -static int sm_block_io(struct super_block *sb, struct block_device *bdev, unsigned int opf, +static int sm_block_io(struct super_block *sb, struct block_device *bdev, blk_opf_t opf, u64 blkno, struct scoutfs_block_header *hdr, size_t len, __le32 *blk_crc) { struct scoutfs_block_header *pg_hdr; diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 32124829..6f2a8b07 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -273,4 +273,9 @@ ssize_t kc_generic_file_buffered_write(struct kiocb *iocb, const struct iovec *i #define generic_file_buffered_write kc_generic_file_buffered_write #endif +#ifndef KC_HAVE_BLK_OPF_T +/* typedef __u32 __bitwise blk_opf_t; */ +typedef unsigned int blk_opf_t; +#endif + #endif