#include <linux/bit_spinlock.h>
#include <linux/pagevec.h>
#include <trace/events/block.h>
+#include <linux/fscrypt.h> /* for CONFIG_CRYPTO_DISKCIPHER_DEBUG */
static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
/* Uhhuh. We've got a bio that straddles the device size! */
truncated_bytes = bio->bi_iter.bi_size - (maxsector << 9);
+ /*
+ * The bio contains more than one segment which spans EOD, just return
+ * and let IO layer turn it into an EIO
+ */
+ if (truncated_bytes > bvec->bv_len)
+ return;
+
/* Truncate the bio.. */
bio->bi_iter.bi_size -= truncated_bytes;
bvec->bv_len -= truncated_bytes;
op_flags |= REQ_PRIO;
bio_set_op_attrs(bio, op, op_flags);
+ crypto_diskcipher_debug(BLK_BH, op_flags);
+ if (bio->bi_opf & REQ_CRYPT)
+ bio->bi_aux_private = bh->b_private;
submit_bio(bio);
return 0;
}