diff --git a/apfs.h b/apfs.h index 566cd78..b2bb117 100644 --- a/apfs.h +++ b/apfs.h @@ -30,6 +30,13 @@ static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags #define lockdep_assert_held_write(l) ((void)(l)) #endif +/* Compatibility wrapper around submit_bh() */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) +#define apfs_submit_bh(op, op_flags, bh) submit_bh(op, op_flags, bh) +#else +#define apfs_submit_bh(op, op_flags, bh) submit_bh(op | op_flags, bh) +#endif + #define APFS_IOC_SET_DFLT_PFK _IOW('@', 0x80, struct apfs_wrapped_crypto_state) #define APFS_IOC_SET_DIR_CLASS _IOW('@', 0x81, u32) #define APFS_IOC_SET_PFK _IOW('@', 0x82, struct apfs_wrapped_crypto_state) diff --git a/inode.c b/inode.c index ce21b5e..2211288 100644 --- a/inode.c +++ b/inode.c @@ -475,7 +475,7 @@ static int apfs_write_begin(struct file *file, struct address_space *mapping, get_bh(bh); lock_buffer(bh); bh->b_end_io = end_buffer_read_sync; - submit_bh(REQ_OP_READ, 0, bh); + apfs_submit_bh(REQ_OP_READ, 0, bh); wait_on_buffer(bh); if (!buffer_uptodate(bh)) { err = -EIO; diff --git a/transaction.c b/transaction.c index 54fb029..e00e96d 100644 --- a/transaction.c +++ b/transaction.c @@ -602,7 +602,7 @@ static int apfs_transaction_commit_nx(struct super_block *sb) clear_buffer_dirty(bh); lock_buffer(bh); bh->b_end_io = apfs_end_buffer_write_sync; - submit_bh(REQ_OP_WRITE, REQ_SYNC, bh); + apfs_submit_bh(REQ_OP_WRITE, REQ_SYNC, bh); } err = apfs_checkpoint_end(sb); if (err) diff --git a/xattr.c b/xattr.c index 4e2dac6..e15e85b 100644 --- a/xattr.c +++ b/xattr.c @@ -155,7 +155,7 @@ static int apfs_xattr_extents_read(struct inode *parent, get_bh(bh); lock_buffer(bh); bh->b_end_io = end_buffer_read_sync; - submit_bh(REQ_OP_READ, 0, bh); + apfs_submit_bh(REQ_OP_READ, 0, bh); } } for (i = 0; i < blkcnt; i++) {