blk-merge.c (4d633062c1c0794a6b3836b7b55afba4599736e8) | blk-merge.c (48d7727cae1209235700ed90f8f11426027b333b) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Functions related to segment and merge handling 4 */ 5#include <linux/kernel.h> 6#include <linux/module.h> 7#include <linux/bio.h> 8#include <linux/blkdev.h> --- 433 unchanged lines hidden (view full) --- 442 return 1; 443 444 bio_get_last_bvec(bio, &end_bv); 445 bio_get_first_bvec(nxt, &nxt_bv); 446 447 return biovec_phys_mergeable(q, &end_bv, &nxt_bv); 448} 449 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Functions related to segment and merge handling 4 */ 5#include <linux/kernel.h> 6#include <linux/module.h> 7#include <linux/bio.h> 8#include <linux/blkdev.h> --- 433 unchanged lines hidden (view full) --- 442 return 1; 443 444 bio_get_last_bvec(bio, &end_bv); 445 bio_get_first_bvec(nxt, &nxt_bv); 446 447 return biovec_phys_mergeable(q, &end_bv, &nxt_bv); 448} 449 |
450static struct scatterlist *blk_next_sg(struct scatterlist **sg, | 450static inline struct scatterlist *blk_next_sg(struct scatterlist **sg, |
451 struct scatterlist *sglist) 452{ 453 if (!*sg) 454 return sglist; 455 456 /* 457 * If the driver previously mapped a shorter list, we could see a 458 * termination bit prematurely unless it fully inits the sg table --- 48 unchanged lines hidden (view full) --- 507 if ((*sg)->length + nbytes > queue_max_segment_size(q)) 508 goto new_segment; 509 if (!biovec_phys_mergeable(q, bvprv, bvec)) 510 goto new_segment; 511 512 (*sg)->length += nbytes; 513 } else { 514new_segment: | 451 struct scatterlist *sglist) 452{ 453 if (!*sg) 454 return sglist; 455 456 /* 457 * If the driver previously mapped a shorter list, we could see a 458 * termination bit prematurely unless it fully inits the sg table --- 48 unchanged lines hidden (view full) --- 507 if ((*sg)->length + nbytes > queue_max_segment_size(q)) 508 goto new_segment; 509 if (!biovec_phys_mergeable(q, bvprv, bvec)) 510 goto new_segment; 511 512 (*sg)->length += nbytes; 513 } else { 514new_segment: |
515 (*nsegs) += blk_bvec_map_sg(q, bvec, sglist, sg); | 515 if (bvec->bv_offset + bvec->bv_len <= PAGE_SIZE) { 516 *sg = blk_next_sg(sg, sglist); 517 sg_set_page(*sg, bvec->bv_page, nbytes, bvec->bv_offset); 518 (*nsegs) += 1; 519 } else 520 (*nsegs) += blk_bvec_map_sg(q, bvec, sglist, sg); |
516 } 517 *bvprv = *bvec; 518} 519 520static inline int __blk_bvec_map_sg(struct request_queue *q, struct bio_vec bv, 521 struct scatterlist *sglist, struct scatterlist **sg) 522{ 523 *sg = sglist; --- 442 unchanged lines hidden --- | 521 } 522 *bvprv = *bvec; 523} 524 525static inline int __blk_bvec_map_sg(struct request_queue *q, struct bio_vec bv, 526 struct scatterlist *sglist, struct scatterlist **sg) 527{ 528 *sg = sglist; --- 442 unchanged lines hidden --- |