Skip to contentSkip to conversation

block queue dma alignment zero

PATCH New Pete Wyckoff 1 participant 1 message Mar 1, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block queue dma alignment zero

Make queue_dma_alignment return 0 if it was specifically set to
0. Set it to the default 511 to keep the old behavior when it was not explicitly set. This permits devices with no particular alignment restrictions to use direct IO from arbitrary addresses.

---
 block/ll_rw_blk.c      |    2 ++
 include/linux/blkdev.h |    7 +------
 2 files changed, 3 insertions(+), 6 deletions(-)
block/ll_rw_blk.c +2 -0
index fb67897..ef1d1a8 100644
@@ -1925,6 +1925,8 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
 	blk_queue_max_hw_segments(q, MAX_HW_SEGMENTS);
 	blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
 
+	blk_queue_dma_alignment(q, 511);
+
 	/*
 	 * all done
 	 */
include/linux/blkdev.h +1 -6
index 36a6eac..f416c2a 100644
@@ -819,12 +819,7 @@ static inline int bdev_hardsect_size(struct block_device *bdev)
 
 static inline int queue_dma_alignment(request_queue_t *q)
 {
-	int retval = 511;
-
-	if (q && q->dma_alignment)
-		retval = q->dma_alignment;
-
-	return retval;
+	return q ? q->dma_alignment : 511;
 }
 
 /* assumes size > 256 */
Signature · 1 line
1.5.0.2