block: add support for limiting gaps in SG lists
Another restriction inherited for NVMe - those devices don't support SG lists that have "gaps" in them. Gaps refers to cases where the previous SG entry doesn't end on a page boundary. For NVMe, all SG entries must start at offset 0 (except the first) and end on a page boundary (except the last). Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
		
					parent
					
						
							
								3a4b0eda8e
							
						
					
				
			
			
				commit
				
					
						66cb45aa41
					
				
			
		
					 4 changed files with 28 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -186,6 +186,15 @@ static inline void *bio_data(struct bio *bio)
 | 
			
		|||
#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \
 | 
			
		||||
	__BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q)))
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Check if adding a bio_vec after bprv with offset would create a gap in
 | 
			
		||||
 * the SG list. Most drivers don't care about this, but some do.
 | 
			
		||||
 */
 | 
			
		||||
static inline bool bvec_gap_to_prev(struct bio_vec *bprv, unsigned int offset)
 | 
			
		||||
{
 | 
			
		||||
	return offset || ((bprv->bv_offset + bprv->bv_len) & (PAGE_SIZE - 1));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define bio_io_error(bio) bio_endio((bio), -EIO)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue