Skip to content

Commit

Permalink
Merge branch 'for-2.6.34-next' into for-2.6.34
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Axboe committed Feb 28, 2010
2 parents 58c24a6 + 8a78362 commit 6fc2de0
Show file tree
Hide file tree
Showing 55 changed files with 153 additions and 214 deletions.
4 changes: 2 additions & 2 deletions arch/um/drivers/ubd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ static int ubd_open_dev(struct ubd *ubd_dev)
ubd_dev->fd = fd;

if(ubd_dev->cow.file != NULL){
blk_queue_max_sectors(ubd_dev->queue, 8 * sizeof(long));
blk_queue_max_hw_sectors(ubd_dev->queue, 8 * sizeof(long));

err = -ENOMEM;
ubd_dev->cow.bitmap = vmalloc(ubd_dev->cow.bitmap_len);
Expand Down Expand Up @@ -849,7 +849,7 @@ static int ubd_add(int n, char **error_out)
}
ubd_dev->queue->queuedata = ubd_dev;

blk_queue_max_hw_segments(ubd_dev->queue, MAX_SG);
blk_queue_max_segments(ubd_dev->queue, MAX_SG);
err = ubd_disk_register(UBD_MAJOR, ubd_dev->size, n, &ubd_gendisk[n]);
if(err){
*error_out = "Failed to register device";
Expand Down
3 changes: 1 addition & 2 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1614,8 +1614,7 @@ int blk_rq_check_limits(struct request_queue *q, struct request *rq)
* limitation.
*/
blk_recalc_rq_segments(rq);
if (rq->nr_phys_segments > queue_max_phys_segments(q) ||
rq->nr_phys_segments > queue_max_hw_segments(q)) {
if (rq->nr_phys_segments > queue_max_segments(q)) {
printk(KERN_ERR "%s: over max segments limit.\n", __func__);
return -EIO;
}
Expand Down
8 changes: 2 additions & 6 deletions block/blk-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ static inline int ll_new_hw_segment(struct request_queue *q,
{
int nr_phys_segs = bio_phys_segments(q, bio);

if (req->nr_phys_segments + nr_phys_segs > queue_max_hw_segments(q) ||
req->nr_phys_segments + nr_phys_segs > queue_max_phys_segments(q)) {
if (req->nr_phys_segments + nr_phys_segs > queue_max_segments(q)) {
req->cmd_flags |= REQ_NOMERGE;
if (req == q->last_merge)
q->last_merge = NULL;
Expand Down Expand Up @@ -300,10 +299,7 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
total_phys_segments--;
}

if (total_phys_segments > queue_max_phys_segments(q))
return 0;

if (total_phys_segments > queue_max_hw_segments(q))
if (total_phys_segments > queue_max_segments(q))
return 0;

/* Merge is OK... */
Expand Down
105 changes: 33 additions & 72 deletions block/blk-settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ EXPORT_SYMBOL_GPL(blk_queue_lld_busy);
*/
void blk_set_default_limits(struct queue_limits *lim)
{
lim->max_phys_segments = MAX_PHYS_SEGMENTS;
lim->max_hw_segments = MAX_HW_SEGMENTS;
lim->max_segments = BLK_MAX_SEGMENTS;
lim->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK;
lim->max_segment_size = MAX_SEGMENT_SIZE;
lim->max_segment_size = BLK_MAX_SEGMENT_SIZE;
lim->max_sectors = BLK_DEF_MAX_SECTORS;
lim->max_hw_sectors = INT_MAX;
lim->max_discard_sectors = 0;
Expand Down Expand Up @@ -154,7 +153,7 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
q->unplug_timer.data = (unsigned long)q;

blk_set_default_limits(&q->limits);
blk_queue_max_sectors(q, SAFE_MAX_SECTORS);
blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS);

/*
* If the caller didn't supply a lock, fall back to our embedded
Expand Down Expand Up @@ -210,37 +209,32 @@ void blk_queue_bounce_limit(struct request_queue *q, u64 dma_mask)
EXPORT_SYMBOL(blk_queue_bounce_limit);

/**
* blk_queue_max_sectors - set max sectors for a request for this queue
* blk_queue_max_hw_sectors - set max sectors for a request for this queue
* @q: the request queue for the device
* @max_sectors: max sectors in the usual 512b unit
* @max_hw_sectors: max hardware sectors in the usual 512b unit
*
* Description:
* Enables a low level driver to set an upper limit on the size of
* received requests.
* Enables a low level driver to set a hard upper limit,
* max_hw_sectors, on the size of requests. max_hw_sectors is set by
* the device driver based upon the combined capabilities of I/O
* controller and storage device.
*
* max_sectors is a soft limit imposed by the block layer for
* filesystem type requests. This value can be overridden on a
* per-device basis in /sys/block/<device>/queue/max_sectors_kb.
* The soft limit can not exceed max_hw_sectors.
**/
void blk_queue_max_sectors(struct request_queue *q, unsigned int max_sectors)
void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_sectors)
{
if ((max_sectors << 9) < PAGE_CACHE_SIZE) {
max_sectors = 1 << (PAGE_CACHE_SHIFT - 9);
if ((max_hw_sectors << 9) < PAGE_CACHE_SIZE) {
max_hw_sectors = 1 << (PAGE_CACHE_SHIFT - 9);
printk(KERN_INFO "%s: set to minimum %d\n",
__func__, max_sectors);
__func__, max_hw_sectors);
}

if (BLK_DEF_MAX_SECTORS > max_sectors)
q->limits.max_hw_sectors = q->limits.max_sectors = max_sectors;
else {
q->limits.max_sectors = BLK_DEF_MAX_SECTORS;
q->limits.max_hw_sectors = max_sectors;
}
}
EXPORT_SYMBOL(blk_queue_max_sectors);

void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_sectors)
{
if (BLK_DEF_MAX_SECTORS > max_sectors)
q->limits.max_hw_sectors = BLK_DEF_MAX_SECTORS;
else
q->limits.max_hw_sectors = max_sectors;
q->limits.max_hw_sectors = max_hw_sectors;
q->limits.max_sectors = min_t(unsigned int, max_hw_sectors,
BLK_DEF_MAX_SECTORS);
}
EXPORT_SYMBOL(blk_queue_max_hw_sectors);

Expand All @@ -257,51 +251,25 @@ void blk_queue_max_discard_sectors(struct request_queue *q,
EXPORT_SYMBOL(blk_queue_max_discard_sectors);

/**
* blk_queue_max_phys_segments - set max phys segments for a request for this queue
* blk_queue_max_segments - set max hw segments for a request for this queue
* @q: the request queue for the device
* @max_segments: max number of segments
*
* Description:
* Enables a low level driver to set an upper limit on the number of
* physical data segments in a request. This would be the largest sized
* scatter list the driver could handle.
* hw data segments in a request.
**/
void blk_queue_max_phys_segments(struct request_queue *q,
unsigned short max_segments)
void blk_queue_max_segments(struct request_queue *q, unsigned short max_segments)
{
if (!max_segments) {
max_segments = 1;
printk(KERN_INFO "%s: set to minimum %d\n",
__func__, max_segments);
}

q->limits.max_phys_segments = max_segments;
q->limits.max_segments = max_segments;
}
EXPORT_SYMBOL(blk_queue_max_phys_segments);

/**
* blk_queue_max_hw_segments - set max hw segments for a request for this queue
* @q: the request queue for the device
* @max_segments: max number of segments
*
* Description:
* Enables a low level driver to set an upper limit on the number of
* hw data segments in a request. This would be the largest number of
* address/length pairs the host adapter can actually give at once
* to the device.
**/
void blk_queue_max_hw_segments(struct request_queue *q,
unsigned short max_segments)
{
if (!max_segments) {
max_segments = 1;
printk(KERN_INFO "%s: set to minimum %d\n",
__func__, max_segments);
}

q->limits.max_hw_segments = max_segments;
}
EXPORT_SYMBOL(blk_queue_max_hw_segments);
EXPORT_SYMBOL(blk_queue_max_segments);

/**
* blk_queue_max_segment_size - set max segment size for blk_rq_map_sg
Expand Down Expand Up @@ -536,11 +504,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
t->seg_boundary_mask = min_not_zero(t->seg_boundary_mask,
b->seg_boundary_mask);

t->max_phys_segments = min_not_zero(t->max_phys_segments,
b->max_phys_segments);

t->max_hw_segments = min_not_zero(t->max_hw_segments,
b->max_hw_segments);
t->max_segments = min_not_zero(t->max_segments, b->max_segments);

t->max_segment_size = min_not_zero(t->max_segment_size,
b->max_segment_size);
Expand Down Expand Up @@ -744,22 +708,19 @@ EXPORT_SYMBOL(blk_queue_update_dma_pad);
* does is adjust the queue so that the buf is always appended
* silently to the scatterlist.
*
* Note: This routine adjusts max_hw_segments to make room for
* appending the drain buffer. If you call
* blk_queue_max_hw_segments() or blk_queue_max_phys_segments() after
* calling this routine, you must set the limit to one fewer than your
* device can support otherwise there won't be room for the drain
* buffer.
* Note: This routine adjusts max_hw_segments to make room for appending
* the drain buffer. If you call blk_queue_max_segments() after calling
* this routine, you must set the limit to one fewer than your device
* can support otherwise there won't be room for the drain buffer.
*/
int blk_queue_dma_drain(struct request_queue *q,
dma_drain_needed_fn *dma_drain_needed,
void *buf, unsigned int size)
{
if (queue_max_hw_segments(q) < 2 || queue_max_phys_segments(q) < 2)
if (queue_max_segments(q) < 2)
return -EINVAL;
/* make room for appending the drain */
blk_queue_max_hw_segments(q, queue_max_hw_segments(q) - 1);
blk_queue_max_phys_segments(q, queue_max_phys_segments(q) - 1);
blk_queue_max_segments(q, queue_max_segments(q) - 1);
q->dma_drain_needed = dma_drain_needed;
q->dma_drain_buffer = buf;
q->dma_drain_size = size;
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
dev->flags |= ATA_DFLAG_NO_UNLOAD;

/* configure max sectors */
blk_queue_max_sectors(sdev->request_queue, dev->max_sectors);
blk_queue_max_hw_sectors(sdev->request_queue, dev->max_sectors);

if (dev->class == ATA_DEV_ATAPI) {
struct request_queue *q = sdev->request_queue;
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/sata_nv.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ static int nv_adma_slave_config(struct scsi_device *sdev)
}

blk_queue_segment_boundary(sdev->request_queue, segment_boundary);
blk_queue_max_hw_segments(sdev->request_queue, sg_tablesize);
blk_queue_max_segments(sdev->request_queue, sg_tablesize);
ata_port_printk(ap, KERN_INFO,
"DMA mask 0x%llX, segment boundary 0x%lX, hw segs %hu\n",
(unsigned long long)*ap->host->dev->dma_mask,
Expand Down
4 changes: 2 additions & 2 deletions drivers/block/DAC960.c
Original file line number Diff line number Diff line change
Expand Up @@ -2534,8 +2534,8 @@ 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_sectors(RequestQueue, Controller->MaxBlocksPerCommand);
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);
disk->major = MajorNumber;
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/brd.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ static struct brd_device *brd_alloc(int i)
goto out_free_dev;
blk_queue_make_request(brd->brd_queue, brd_make_request);
blk_queue_ordered(brd->brd_queue, QUEUE_ORDERED_TAG, NULL);
blk_queue_max_sectors(brd->brd_queue, 1024);
blk_queue_max_hw_sectors(brd->brd_queue, 1024);
blk_queue_bounce_limit(brd->brd_queue, BLK_BOUNCE_ANY);

disk = brd->brd_disk = alloc_disk(1 << part_shift);
Expand Down
7 changes: 2 additions & 5 deletions drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1797,12 +1797,9 @@ 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);
blk_queue_max_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_sectors(disk->queue, h->cciss_max_sectors);
blk_queue_max_hw_sectors(disk->queue, h->cciss_max_sectors);

blk_queue_softirq_done(disk->queue, cciss_softirq_done);

Expand Down
5 changes: 1 addition & 4 deletions drivers/block/cpqarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
5 changes: 2 additions & 3 deletions drivers/block/drbd/drbd_nl.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,9 +709,8 @@ 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_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_hw_sectors(q, max_seg_s >> 9);
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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -4234,7 +4234,7 @@ static int __init floppy_init(void)
err = -ENOMEM;
goto out_unreg_driver;
}
blk_queue_max_sectors(floppy_queue, 64);
blk_queue_max_hw_sectors(floppy_queue, 64);

blk_register_region(MKDEV(FLOPPY_MAJOR, 0), 256, THIS_MODULE,
floppy_find, NULL, NULL);
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/hd.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ static int __init hd_init(void)
return -ENOMEM;
}

blk_queue_max_sectors(hd_queue, 255);
blk_queue_max_hw_sectors(hd_queue, 255);
init_timer(&device_timer);
device_timer.function = hd_times_out;
blk_queue_logical_block_size(hd_queue, 512);
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/mg_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ static int mg_probe(struct platform_device *plat_dev)
__func__, __LINE__);
goto probe_err_6;
}
blk_queue_max_sectors(host->breq, MG_MAX_SECTS);
blk_queue_max_hw_sectors(host->breq, MG_MAX_SECTS);
blk_queue_logical_block_size(host->breq, MG_SECTOR_SIZE);

init_timer(&host->timer);
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/paride/pd.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ static int __init pd_init(void)
if (!pd_queue)
goto out1;

blk_queue_max_sectors(pd_queue, cluster);
blk_queue_max_hw_sectors(pd_queue, cluster);

if (register_blkdev(major, name))
goto out2;
Expand Down
3 changes: 1 addition & 2 deletions drivers/block/paride/pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions drivers/block/pktcdvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -2312,7 +2312,7 @@ static int pkt_open_dev(struct pktcdvd_device *pd, fmode_t write)
* even if the size is a multiple of the packet size.
*/
spin_lock_irq(q->queue_lock);
blk_queue_max_sectors(q, pd->settings.size);
blk_queue_max_hw_sectors(q, pd->settings.size);
spin_unlock_irq(q->queue_lock);
set_bit(PACKET_WRITABLE, &pd->flags);
} else {
Expand Down Expand Up @@ -2613,7 +2613,7 @@ static void pkt_init_queue(struct pktcdvd_device *pd)

blk_queue_make_request(q, pkt_make_request);
blk_queue_logical_block_size(q, CD_FRAMESIZE);
blk_queue_max_sectors(q, PACKET_MAX_SECTORS);
blk_queue_max_hw_sectors(q, PACKET_MAX_SECTORS);
blk_queue_merge_bvec(q, pkt_merge_bvec);
q->queuedata = pd;
}
Expand Down
Loading

0 comments on commit 6fc2de0

Please sign in to comment.