From 8a78362c4eefc1deddbefe2c7f38aabbc2429d6b Mon Sep 17 00:00:00 2001 From: "Martin K. Petersen" Date: Fri, 26 Feb 2010 00:20:39 -0500 Subject: block: Consolidate phys_segment and hw_segment limits Except for SCSI no device drivers distinguish between physical and hardware segment limits. Consolidate the two into a single segment limit. Signed-off-by: Martin K. Petersen Signed-off-by: Jens Axboe --- drivers/block/DAC960.c | 2 +- drivers/block/cciss.c | 5 +---- drivers/block/cpqarray.c | 5 +---- drivers/block/drbd/drbd_nl.c | 3 +-- drivers/block/paride/pf.c | 3 +-- drivers/block/pktcdvd.c | 4 ++-- drivers/block/ps3disk.c | 3 +-- drivers/block/ps3vram.c | 3 +-- drivers/block/sunvdc.c | 3 +-- drivers/block/sx8.c | 3 +-- drivers/block/ub.c | 3 +-- drivers/block/viodasd.c | 3 +-- drivers/block/xen-blkfront.c | 3 +-- 13 files changed, 14 insertions(+), 29 deletions(-) (limited to 'drivers/block') diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 1c0cd35..459f1bc 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c @@ -2534,7 +2534,7 @@ static bool DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller) blk_queue_bounce_limit(RequestQueue, Controller->BounceBufferLimit); RequestQueue->queuedata = Controller; blk_queue_max_hw_segments(RequestQueue, Controller->DriverScatterGatherLimit); - blk_queue_max_phys_segments(RequestQueue, Controller->DriverScatterGatherLimit); + blk_queue_max_segments(RequestQueue, Controller->DriverScatterGatherLimit); blk_queue_max_hw_sectors(RequestQueue, Controller->MaxBlocksPerCommand); disk->queue = RequestQueue; sprintf(disk->disk_name, "rd/c%dd%d", Controller->ControllerNumber, n); diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 030e52d..a29e694 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -1797,10 +1797,7 @@ static int cciss_add_disk(ctlr_info_t *h, struct gendisk *disk, blk_queue_bounce_limit(disk->queue, h->pdev->dma_mask); /* This is a hardware imposed limit. */ - blk_queue_max_hw_segments(disk->queue, h->maxsgentries); - - /* This is a limit in the driver and could be eliminated. */ - blk_queue_max_phys_segments(disk->queue, h->maxsgentries); + blk_queue_max_segments(disk->queue, h->maxsgentries); blk_queue_max_hw_sectors(disk->queue, h->cciss_max_sectors); diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 6422651..91d1163 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c @@ -448,11 +448,8 @@ static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev) blk_queue_bounce_limit(q, hba[i]->pci_dev->dma_mask); /* This is a hardware imposed limit. */ - blk_queue_max_hw_segments(q, SG_MAX); + blk_queue_max_segments(q, SG_MAX); - /* This is a driver limit and could be eliminated. */ - blk_queue_max_phys_segments(q, SG_MAX); - init_timer(&hba[i]->timer); hba[i]->timer.expires = jiffies + IDA_TIMER; hba[i]->timer.data = (unsigned long)hba[i]; diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 9b55e64..4df3b40 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -710,8 +710,7 @@ void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int max_seg_s) __mu max_seg_s = min(queue_max_sectors(b) * queue_logical_block_size(b), max_seg_s); blk_queue_max_hw_sectors(q, max_seg_s >> 9); - blk_queue_max_phys_segments(q, max_segments ? max_segments : MAX_PHYS_SEGMENTS); - blk_queue_max_hw_segments(q, max_segments ? max_segments : MAX_HW_SEGMENTS); + blk_queue_max_segments(q, max_segments ? max_segments : BLK_MAX_SEGMENTS); blk_queue_max_segment_size(q, max_seg_s); blk_queue_logical_block_size(q, 512); blk_queue_segment_boundary(q, PAGE_SIZE-1); diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index ea54ea3..ddb4f9a 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c @@ -956,8 +956,7 @@ static int __init pf_init(void) return -ENOMEM; } - blk_queue_max_phys_segments(pf_queue, cluster); - blk_queue_max_hw_segments(pf_queue, cluster); + blk_queue_max_segments(pf_queue, cluster); for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) { struct gendisk *disk = pf->disk; diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 6e1daa24..b72935b 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -950,14 +950,14 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd) static int pkt_set_segment_merging(struct pktcdvd_device *pd, struct request_queue *q) { if ((pd->settings.size << 9) / CD_FRAMESIZE - <= queue_max_phys_segments(q)) { + <= queue_max_segments(q)) { /* * The cdrom device can handle one segment/frame */ clear_bit(PACKET_MERGE_SEGS, &pd->flags); return 0; } else if ((pd->settings.size << 9) / PAGE_SIZE - <= queue_max_phys_segments(q)) { + <= queue_max_segments(q)) { /* * We can handle this case at the expense of some extra memory * copies during write operations diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c index 9cd1a4a..bc95469 100644 --- a/drivers/block/ps3disk.c +++ b/drivers/block/ps3disk.c @@ -482,8 +482,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev) blk_queue_ordered(queue, QUEUE_ORDERED_DRAIN_FLUSH, ps3disk_prepare_flush); - blk_queue_max_phys_segments(queue, -1); - blk_queue_max_hw_segments(queue, -1); + blk_queue_max_segments(queue, -1); blk_queue_max_segment_size(queue, dev->bounce_size); gendisk = alloc_disk(PS3DISK_MINORS); diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c index 6416b26..83ebb39 100644 --- a/drivers/block/ps3vram.c +++ b/drivers/block/ps3vram.c @@ -751,8 +751,7 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev) priv->queue = queue; queue->queuedata = dev; blk_queue_make_request(queue, ps3vram_make_request); - blk_queue_max_phys_segments(queue, MAX_PHYS_SEGMENTS); - blk_queue_max_hw_segments(queue, MAX_HW_SEGMENTS); + blk_queue_max_segments(queue, BLK_MAX_HW_SEGMENTS); blk_queue_max_segment_size(queue, BLK_MAX_SEGMENT_SIZE); blk_queue_max_hw_sectors(queue, BLK_SAFE_MAX_SECTORS); diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c index dd30cdd..48e8fee 100644 --- a/drivers/block/sunvdc.c +++ b/drivers/block/sunvdc.c @@ -691,8 +691,7 @@ static int probe_disk(struct vdc_port *port) port->disk = g; - blk_queue_max_hw_segments(q, port->ring_cookies); - blk_queue_max_phys_segments(q, port->ring_cookies); + blk_queue_max_segments(q, port->ring_cookies); blk_queue_max_hw_sectors(q, port->max_xfer_size); g->major = vdc_major; g->first_minor = port->vio.vdev->dev_no << PARTITION_SHIFT; diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index 7bd7b2f..b70f0fc 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c @@ -1518,8 +1518,7 @@ static int carm_init_disks(struct carm_host *host) break; } disk->queue = q; - blk_queue_max_hw_segments(q, CARM_MAX_REQ_SG); - blk_queue_max_phys_segments(q, CARM_MAX_REQ_SG); + blk_queue_max_segments(q, CARM_MAX_REQ_SG); blk_queue_segment_boundary(q, CARM_SG_BOUNDARY); q->queuedata = port; diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 352ea24..2e88983 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c @@ -2320,8 +2320,7 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum) disk->queue = q; blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH); - blk_queue_max_hw_segments(q, UB_MAX_REQ_SG); - blk_queue_max_phys_segments(q, UB_MAX_REQ_SG); + blk_queue_max_segments(q, UB_MAX_REQ_SG); blk_queue_segment_boundary(q, 0xffffffff); /* Dubious. */ blk_queue_max_hw_sectors(q, UB_MAX_SECTORS); blk_queue_logical_block_size(q, lun->capacity.bsize); diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index d44ece7..c12b313 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c @@ -471,8 +471,7 @@ retry: } d->disk = g; - blk_queue_max_hw_segments(q, VIOMAXBLOCKDMA); - blk_queue_max_phys_segments(q, VIOMAXBLOCKDMA); + blk_queue_max_segments(q, VIOMAXBLOCKDMA); blk_queue_max_hw_sectors(q, VIODASD_MAXSECTORS); g->major = VIODASD_MAJOR; g->first_minor = dev_no << PARTITION_SHIFT; diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index f9861aa..9c09694 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -353,8 +353,7 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) blk_queue_max_segment_size(rq, PAGE_SIZE); /* Ensure a merged request will fit in a single I/O ring slot. */ - blk_queue_max_phys_segments(rq, BLKIF_MAX_SEGMENTS_PER_REQUEST); - blk_queue_max_hw_segments(rq, BLKIF_MAX_SEGMENTS_PER_REQUEST); + blk_queue_max_segments(rq, BLKIF_MAX_SEGMENTS_PER_REQUEST); /* Make sure buffer addresses are sector-aligned. */ blk_queue_dma_alignment(rq, 511); -- cgit v1.1