]) # LDISKFS_AC_PATCH_PROGRAM
#
+# LB_HAVE_BVEC_ITER_ALL
+#
+# kernel 5.1 commit 6dc4f100c175dd0511ae8674786e7c9006cdfbfa
+# block: allow bio_for_each_segment_all() to iterate over multi-page bvec
+#
+AC_DEFUN([LB_HAVE_BVEC_ITER_ALL], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if bvec_iter_all exists for multi-page bvec iternation],
+ext4fs_dirhash, [
+ #include <linux/bvec.h>
+],[
+ struct bvec_iter_all iter;
+ (void)iter;
+],[
+ AC_DEFINE(HAVE_BVEC_ITER_ALL, 1,
+ [if bvec_iter_all exists for multi-page bvec iternation])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LB_HAVE_BVEC_ITER_ALL
+
+#
# LB_CONFIG_LDISKFS
#
AC_DEFUN([LB_CONFIG_LDISKFS], [
LB_EXT4_HAVE_INFO_DQUOT
LB_EXT4_HAVE_I_CRYPT_INFO
LB_LDISKFS_IGET_HAS_FLAGS_ARG
+ LB_HAVE_BVEC_ITER_ALL
AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
extern int ldiskfs_pdo;
+#ifdef HAVE_BVEC_ITER_ALL
+#define DECLARE_BVEC_ITER_ALL(iter) struct bvec_iter_all iter
+#else
+#define DECLARE_BVEC_ITER_ALL(iter) int iter
+#endif
+
#ifndef HAVE_VFS_SETXATTR
#define osd_setxattr(dentry, inode, name, buf, len, flag) \
((inode)->i_op->setxattr(dentry, name, buf, len, flag))
ldiskfs_journal_start(inode, type, nblocks)
# define osd_transaction_size(dev) \
(osd_journal(dev)->j_max_transaction_buffers / 2)
-#else
+#else /* ! defined LDISKFS_HT_MISC */
# define LDISKFS_HT_MISC 0
# define osd_journal_start_sb(sb, type, nblock) \
ldiskfs_journal_start_sb(sb, nblock)
{
#endif
struct osd_iobuf *iobuf = bio->bi_private;
- int iter;
struct bio_vec *bvl;
/* CAVEAT EMPTOR: possibly in IRQ context
/* the check is outside of the cycle for performance reason -bzzz */
if (!bio_data_dir(bio)) {
- bio_for_each_segment_all(bvl, bio, iter) {
+ DECLARE_BVEC_ITER_ALL(iter_all);
+
+ bio_for_each_segment_all(bvl, bio, iter_all) {
if (likely(error == 0))
SetPageUptodate(bvl_to_page(bvl));
LASSERT(PageLocked(bvl_to_page(bvl)));
static void bio_integrity_fault_inject(struct bio *bio)
{
struct bio_vec *bvec;
- int i;
+ DECLARE_BVEC_ITER_ALL(iter_all);
void *kaddr;
char *addr;
- bio_for_each_segment_all(bvec, bio, i) {
+ bio_for_each_segment_all(bvec, bio, iter_all) {
struct page *page = bvec->bv_page;
kaddr = kmap(page);
bip->bip_vec->bv_offset;
struct bio_vec *bv;
sector_t sector = bio_start_sector(bio);
- unsigned int i, sectors, total;
+ unsigned int sectors, total;
+ DECLARE_BVEC_ITER_ALL(iter_all);
__u16 *expected_guard;
int rc;
total = 0;
- bio_for_each_segment_all(bv, bio, i) {
+ bio_for_each_segment_all(bv, bio, iter_all) {
lnb = iobuf->dr_lnbs[index];
expected_guard = lnb->lnb_guards;
sectors = bv->bv_len / sector_size;