bio_opf |= REQ_OP_WRITE;
if (iter->flags & IOMAP_ATOMIC_HW) {
+ /*
+ * Ensure that the mapping covers the full write
+ * length, otherwise it won't be submitted as a single
+ * bio, which is required to use hardware atomics.
+ */
if (length != iter->len)
return -EINVAL;
bio_opf |= REQ_ATOMIC;
n = bio->bi_iter.bi_size;
if (WARN_ON_ONCE((bio_opf & REQ_ATOMIC) && n != length)) {
/*
- * This bio should have covered the complete length,
+ * An atomic write bio must cover the complete length,
* which it doesn't, so error. We may need to zero out
* the tail (complete FS block), similar to when
* bio_iov_iter_get_pages() returns an error, above.