block: add blk_rq_aligned helper function
This adds blk_rq_aligned helper function to see if alignment and padding requirement is satisfied for DMA transfer. This also converts blk_rq_map_kern and __blk_rq_map_user to use the helper function. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
committed by
Jens Axboe
parent
4d8ab62e08
commit
879040742c
@ -899,6 +899,13 @@ static inline int queue_dma_alignment(struct request_queue *q)
|
||||
return q ? q->dma_alignment : 511;
|
||||
}
|
||||
|
||||
static inline int blk_rq_aligned(struct request_queue *q, void *addr,
|
||||
unsigned int len)
|
||||
{
|
||||
unsigned int alignment = queue_dma_alignment(q) | q->dma_pad_mask;
|
||||
return !((unsigned long)addr & alignment) && !(len & alignment);
|
||||
}
|
||||
|
||||
/* assumes size > 256 */
|
||||
static inline unsigned int blksize_bits(unsigned int size)
|
||||
{
|
||||
|
Reference in New Issue
Block a user