Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

blk-integrity: enable p2p source and destination

Set the extraction flags to allow p2p pages for the metadata buffer if
the block device allows it. Similar to data payloads, ensure the bio
does not use merging if we see a p2p page.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Keith Busch and committed by
Jens Axboe
05ceea5d b475272f

+17 -4
+17 -4
block/bio-integrity.c
··· 230 230 } 231 231 232 232 static unsigned int bvec_from_pages(struct bio_vec *bvec, struct page **pages, 233 - int nr_vecs, ssize_t bytes, ssize_t offset) 233 + int nr_vecs, ssize_t bytes, ssize_t offset, 234 + bool *is_p2p) 234 235 { 235 236 unsigned int nr_bvecs = 0; 236 237 int i, j; ··· 252 251 bytes -= next; 253 252 } 254 253 254 + if (is_pci_p2pdma_page(pages[i])) 255 + *is_p2p = true; 256 + 255 257 bvec_set_page(&bvec[nr_bvecs], pages[i], size, offset); 256 258 offset = 0; 257 259 nr_bvecs++; ··· 268 264 struct request_queue *q = bdev_get_queue(bio->bi_bdev); 269 265 struct page *stack_pages[UIO_FASTIOV], **pages = stack_pages; 270 266 struct bio_vec stack_vec[UIO_FASTIOV], *bvec = stack_vec; 267 + iov_iter_extraction_t extraction_flags = 0; 271 268 size_t offset, bytes = iter->count; 269 + bool copy, is_p2p = false; 272 270 unsigned int nr_bvecs; 273 271 int ret, nr_vecs; 274 - bool copy; 275 272 276 273 if (bio_integrity(bio)) 277 274 return -EINVAL; ··· 291 286 292 287 copy = iov_iter_alignment(iter) & 293 288 blk_lim_dma_alignment_and_pad(&q->limits); 294 - ret = iov_iter_extract_pages(iter, &pages, bytes, nr_vecs, 0, &offset); 289 + 290 + if (blk_queue_pci_p2pdma(q)) 291 + extraction_flags |= ITER_ALLOW_P2PDMA; 292 + 293 + ret = iov_iter_extract_pages(iter, &pages, bytes, nr_vecs, 294 + extraction_flags, &offset); 295 295 if (unlikely(ret < 0)) 296 296 goto free_bvec; 297 297 298 - nr_bvecs = bvec_from_pages(bvec, pages, nr_vecs, bytes, offset); 298 + nr_bvecs = bvec_from_pages(bvec, pages, nr_vecs, bytes, offset, 299 + &is_p2p); 299 300 if (pages != stack_pages) 300 301 kvfree(pages); 301 302 if (nr_bvecs > queue_max_integrity_segments(q)) 302 303 copy = true; 304 + if (is_p2p) 305 + bio->bi_opf |= REQ_NOMERGE; 303 306 304 307 if (copy) 305 308 ret = bio_integrity_copy_user(bio, bvec, nr_bvecs, bytes);