diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-08-28 02:05:58 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-10-09 02:56:11 -0400 |
commit | 879040742cf09f2360a9ac41846288707e4e567c (patch) | |
tree | 7768750efd0d8ef28a183f8cd781b0c878212795 /include/linux/blkdev.h | |
parent | 4d8ab62e087d9300883b82c2662e73e6eef803a3 (diff) |
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>
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r-- | include/linux/blkdev.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 358ac423ed2f..9c2549260427 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -899,6 +899,13 @@ static inline int queue_dma_alignment(struct request_queue *q) | |||
899 | return q ? q->dma_alignment : 511; | 899 | return q ? q->dma_alignment : 511; |
900 | } | 900 | } |
901 | 901 | ||
902 | static inline int blk_rq_aligned(struct request_queue *q, void *addr, | ||
903 | unsigned int len) | ||
904 | { | ||
905 | unsigned int alignment = queue_dma_alignment(q) | q->dma_pad_mask; | ||
906 | return !((unsigned long)addr & alignment) && !(len & alignment); | ||
907 | } | ||
908 | |||
902 | /* assumes size > 256 */ | 909 | /* assumes size > 256 */ |
903 | static inline unsigned int blksize_bits(unsigned int size) | 910 | static inline unsigned int blksize_bits(unsigned int size) |
904 | { | 911 | { |