aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-07-04 03:30:03 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-07-04 03:52:13 -0400
commit27f8221af406e43b529a5425bc99c9b1e9bdf521 (patch)
tree6e847b9359327449b77d4b6350cc9d44fd9208b6
parent2610324fcacf38a24b630090ebcb802538763187 (diff)
block: add blk_queue_update_dma_pad
This adds blk_queue_update_dma_pad to prevent LLDs from overwriting the dma pad mask wrongly (we added blk_queue_update_dma_alignment due to the same reason). This also converts libata to use blk_queue_update_dma_pad instead of blk_queue_dma_pad. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Tejun Heo <htejun@gmail.com> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--block/blk-settings.c24
-rw-r--r--drivers/ata/libata-scsi.c3
-rw-r--r--include/linux/blkdev.h1
3 files changed, 23 insertions, 5 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 8dd86418f35d..dfc77012843f 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -302,11 +302,10 @@ EXPORT_SYMBOL(blk_queue_stack_limits);
302 * @q: the request queue for the device 302 * @q: the request queue for the device
303 * @mask: pad mask 303 * @mask: pad mask
304 * 304 *
305 * Set pad mask. Direct IO requests are padded to the mask specified. 305 * Set dma pad mask.
306 * 306 *
307 * Appending pad buffer to a request modifies ->data_len such that it 307 * Appending pad buffer to a request modifies the last entry of a
308 * includes the pad buffer. The original requested data length can be 308 * scatter list such that it includes the pad buffer.
309 * obtained using blk_rq_raw_data_len().
310 **/ 309 **/
311void blk_queue_dma_pad(struct request_queue *q, unsigned int mask) 310void blk_queue_dma_pad(struct request_queue *q, unsigned int mask)
312{ 311{
@@ -315,6 +314,23 @@ void blk_queue_dma_pad(struct request_queue *q, unsigned int mask)
315EXPORT_SYMBOL(blk_queue_dma_pad); 314EXPORT_SYMBOL(blk_queue_dma_pad);
316 315
317/** 316/**
317 * blk_queue_update_dma_pad - update pad mask
318 * @q: the request queue for the device
319 * @mask: pad mask
320 *
321 * Update dma pad mask.
322 *
323 * Appending pad buffer to a request modifies the last entry of a
324 * scatter list such that it includes the pad buffer.
325 **/
326void blk_queue_update_dma_pad(struct request_queue *q, unsigned int mask)
327{
328 if (mask > q->dma_pad_mask)
329 q->dma_pad_mask = mask;
330}
331EXPORT_SYMBOL(blk_queue_update_dma_pad);
332
333/**
318 * blk_queue_dma_drain - Set up a drain buffer for excess dma. 334 * blk_queue_dma_drain - Set up a drain buffer for excess dma.
319 * @q: the request queue for the device 335 * @q: the request queue for the device
320 * @dma_drain_needed: fn which returns non-zero if drain is necessary 336 * @dma_drain_needed: fn which returns non-zero if drain is necessary
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 57a43649a461..499ccc628d81 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -885,7 +885,8 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
885 /* set the min alignment and padding */ 885 /* set the min alignment and padding */
886 blk_queue_update_dma_alignment(sdev->request_queue, 886 blk_queue_update_dma_alignment(sdev->request_queue,
887 ATA_DMA_PAD_SZ - 1); 887 ATA_DMA_PAD_SZ - 1);
888 blk_queue_dma_pad(sdev->request_queue, ATA_DMA_PAD_SZ - 1); 888 blk_queue_update_dma_pad(sdev->request_queue,
889 ATA_DMA_PAD_SZ - 1);
889 890
890 /* configure draining */ 891 /* configure draining */
891 buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL); 892 buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index e04c4ac8a7cf..1ffd8bfdc4c9 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -776,6 +776,7 @@ extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
776extern void blk_queue_hardsect_size(struct request_queue *, unsigned short); 776extern void blk_queue_hardsect_size(struct request_queue *, unsigned short);
777extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); 777extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
778extern void blk_queue_dma_pad(struct request_queue *, unsigned int); 778extern void blk_queue_dma_pad(struct request_queue *, unsigned int);
779extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int);
779extern int blk_queue_dma_drain(struct request_queue *q, 780extern int blk_queue_dma_drain(struct request_queue *q,
780 dma_drain_needed_fn *dma_drain_needed, 781 dma_drain_needed_fn *dma_drain_needed,
781 void *buf, unsigned int size); 782 void *buf, unsigned int size);