aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-barrier.c4
-rw-r--r--block/blk-core.c26
-rw-r--r--block/blk-map.c8
-rw-r--r--block/blk-settings.c4
-rw-r--r--block/elevator.c7
-rw-r--r--block/genhd.c4
-rw-r--r--block/ioctl.c7
7 files changed, 43 insertions, 17 deletions
diff --git a/block/blk-barrier.c b/block/blk-barrier.c
index 5c99ff8d2db8..6e72d661ae42 100644
--- a/block/blk-barrier.c
+++ b/block/blk-barrier.c
@@ -161,7 +161,7 @@ static inline struct request *start_ordered(struct request_queue *q,
161 /* 161 /*
162 * Prep proxy barrier request. 162 * Prep proxy barrier request.
163 */ 163 */
164 blkdev_dequeue_request(rq); 164 elv_dequeue_request(q, rq);
165 q->orig_bar_rq = rq; 165 q->orig_bar_rq = rq;
166 rq = &q->bar_rq; 166 rq = &q->bar_rq;
167 blk_rq_init(q, rq); 167 blk_rq_init(q, rq);
@@ -219,7 +219,7 @@ int blk_do_ordered(struct request_queue *q, struct request **rqp)
219 * This can happen when the queue switches to 219 * This can happen when the queue switches to
220 * ORDERED_NONE while this request is on it. 220 * ORDERED_NONE while this request is on it.
221 */ 221 */
222 blkdev_dequeue_request(rq); 222 elv_dequeue_request(q, rq);
223 if (__blk_end_request(rq, -EOPNOTSUPP, 223 if (__blk_end_request(rq, -EOPNOTSUPP,
224 blk_rq_bytes(rq))) 224 blk_rq_bytes(rq)))
225 BUG(); 225 BUG();
diff --git a/block/blk-core.c b/block/blk-core.c
index 10e8a64a5a5b..c36aa98fafa3 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -592,7 +592,7 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
592 1 << QUEUE_FLAG_STACKABLE); 592 1 << QUEUE_FLAG_STACKABLE);
593 q->queue_lock = lock; 593 q->queue_lock = lock;
594 594
595 blk_queue_segment_boundary(q, 0xffffffff); 595 blk_queue_segment_boundary(q, BLK_SEG_BOUNDARY_MASK);
596 596
597 blk_queue_make_request(q, __make_request); 597 blk_queue_make_request(q, __make_request);
598 blk_queue_max_segment_size(q, MAX_SEGMENT_SIZE); 598 blk_queue_max_segment_size(q, MAX_SEGMENT_SIZE);
@@ -1637,6 +1637,28 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq)
1637EXPORT_SYMBOL_GPL(blk_insert_cloned_request); 1637EXPORT_SYMBOL_GPL(blk_insert_cloned_request);
1638 1638
1639/** 1639/**
1640 * blkdev_dequeue_request - dequeue request and start timeout timer
1641 * @req: request to dequeue
1642 *
1643 * Dequeue @req and start timeout timer on it. This hands off the
1644 * request to the driver.
1645 *
1646 * Block internal functions which don't want to start timer should
1647 * call elv_dequeue_request().
1648 */
1649void blkdev_dequeue_request(struct request *req)
1650{
1651 elv_dequeue_request(req->q, req);
1652
1653 /*
1654 * We are now handing the request to the hardware, add the
1655 * timeout handler.
1656 */
1657 blk_add_timer(req);
1658}
1659EXPORT_SYMBOL(blkdev_dequeue_request);
1660
1661/**
1640 * __end_that_request_first - end I/O on a request 1662 * __end_that_request_first - end I/O on a request
1641 * @req: the request being processed 1663 * @req: the request being processed
1642 * @error: %0 for success, < %0 for error 1664 * @error: %0 for success, < %0 for error
@@ -1774,7 +1796,7 @@ static void end_that_request_last(struct request *req, int error)
1774 blk_queue_end_tag(req->q, req); 1796 blk_queue_end_tag(req->q, req);
1775 1797
1776 if (blk_queued_rq(req)) 1798 if (blk_queued_rq(req))
1777 blkdev_dequeue_request(req); 1799 elv_dequeue_request(req->q, req);
1778 1800
1779 if (unlikely(laptop_mode) && blk_fs_request(req)) 1801 if (unlikely(laptop_mode) && blk_fs_request(req))
1780 laptop_io_completion(); 1802 laptop_io_completion();
diff --git a/block/blk-map.c b/block/blk-map.c
index 4849fa36161e..2990447f45e9 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -217,8 +217,14 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
217 return PTR_ERR(bio); 217 return PTR_ERR(bio);
218 218
219 if (bio->bi_size != len) { 219 if (bio->bi_size != len) {
220 /*
221 * Grab an extra reference to this bio, as bio_unmap_user()
222 * expects to be able to drop it twice as it happens on the
223 * normal IO completion path
224 */
225 bio_get(bio);
220 bio_endio(bio, 0); 226 bio_endio(bio, 0);
221 bio_unmap_user(bio); 227 __blk_rq_unmap_user(bio);
222 return -EINVAL; 228 return -EINVAL;
223 } 229 }
224 230
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 41392fbe19ff..afa55e14e278 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -125,6 +125,9 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
125 q->nr_requests = BLKDEV_MAX_RQ; 125 q->nr_requests = BLKDEV_MAX_RQ;
126 blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS); 126 blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
127 blk_queue_max_hw_segments(q, MAX_HW_SEGMENTS); 127 blk_queue_max_hw_segments(q, MAX_HW_SEGMENTS);
128 blk_queue_segment_boundary(q, BLK_SEG_BOUNDARY_MASK);
129 blk_queue_max_segment_size(q, MAX_SEGMENT_SIZE);
130
128 q->make_request_fn = mfn; 131 q->make_request_fn = mfn;
129 q->backing_dev_info.ra_pages = 132 q->backing_dev_info.ra_pages =
130 (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; 133 (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
@@ -314,6 +317,7 @@ void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b)
314 /* zero is "infinity" */ 317 /* zero is "infinity" */
315 t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); 318 t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors);
316 t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); 319 t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors);
320 t->seg_boundary_mask = min_not_zero(t->seg_boundary_mask, b->seg_boundary_mask);
317 321
318 t->max_phys_segments = min(t->max_phys_segments, b->max_phys_segments); 322 t->max_phys_segments = min(t->max_phys_segments, b->max_phys_segments);
319 t->max_hw_segments = min(t->max_hw_segments, b->max_hw_segments); 323 t->max_hw_segments = min(t->max_hw_segments, b->max_hw_segments);
diff --git a/block/elevator.c b/block/elevator.c
index 9ac82dde99dd..a6951f76ba0c 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -844,14 +844,7 @@ void elv_dequeue_request(struct request_queue *q, struct request *rq)
844 */ 844 */
845 if (blk_account_rq(rq)) 845 if (blk_account_rq(rq))
846 q->in_flight++; 846 q->in_flight++;
847
848 /*
849 * We are now handing the request to the hardware, add the
850 * timeout handler.
851 */
852 blk_add_timer(rq);
853} 847}
854EXPORT_SYMBOL(elv_dequeue_request);
855 848
856int elv_queue_empty(struct request_queue *q) 849int elv_queue_empty(struct request_queue *q)
857{ 850{
diff --git a/block/genhd.c b/block/genhd.c
index 4e5e7493f676..2f7feda61e35 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -768,6 +768,8 @@ static int __init genhd_device_init(void)
768 bdev_map = kobj_map_init(base_probe, &block_class_lock); 768 bdev_map = kobj_map_init(base_probe, &block_class_lock);
769 blk_dev_init(); 769 blk_dev_init();
770 770
771 register_blkdev(BLOCK_EXT_MAJOR, "blkext");
772
771#ifndef CONFIG_SYSFS_DEPRECATED 773#ifndef CONFIG_SYSFS_DEPRECATED
772 /* create top-level block dir */ 774 /* create top-level block dir */
773 block_depr = kobject_create_and_add("block", NULL); 775 block_depr = kobject_create_and_add("block", NULL);
@@ -1100,6 +1102,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
1100 kfree(disk); 1102 kfree(disk);
1101 return NULL; 1103 return NULL;
1102 } 1104 }
1105 disk->node_id = node_id;
1103 if (disk_expand_part_tbl(disk, 0)) { 1106 if (disk_expand_part_tbl(disk, 0)) {
1104 free_part_stats(&disk->part0); 1107 free_part_stats(&disk->part0);
1105 kfree(disk); 1108 kfree(disk);
@@ -1114,7 +1117,6 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
1114 device_initialize(disk_to_dev(disk)); 1117 device_initialize(disk_to_dev(disk));
1115 INIT_WORK(&disk->async_notify, 1118 INIT_WORK(&disk->async_notify,
1116 media_change_notify_thread); 1119 media_change_notify_thread);
1117 disk->node_id = node_id;
1118 } 1120 }
1119 return disk; 1121 return disk;
1120} 1122}
diff --git a/block/ioctl.c b/block/ioctl.c
index c832d639b6e2..d03985b04d67 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -18,7 +18,6 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
18 struct disk_part_iter piter; 18 struct disk_part_iter piter;
19 long long start, length; 19 long long start, length;
20 int partno; 20 int partno;
21 int err;
22 21
23 if (!capable(CAP_SYS_ADMIN)) 22 if (!capable(CAP_SYS_ADMIN))
24 return -EACCES; 23 return -EACCES;
@@ -61,10 +60,10 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
61 disk_part_iter_exit(&piter); 60 disk_part_iter_exit(&piter);
62 61
63 /* all seems OK */ 62 /* all seems OK */
64 err = add_partition(disk, partno, start, length, 63 part = add_partition(disk, partno, start, length,
65 ADDPART_FLAG_NONE); 64 ADDPART_FLAG_NONE);
66 mutex_unlock(&bdev->bd_mutex); 65 mutex_unlock(&bdev->bd_mutex);
67 return err; 66 return IS_ERR(part) ? PTR_ERR(part) : 0;
68 case BLKPG_DEL_PARTITION: 67 case BLKPG_DEL_PARTITION:
69 part = disk_get_part(disk, partno); 68 part = disk_get_part(disk, partno);
70 if (!part) 69 if (!part)