aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c4
-rw-r--r--block/blk-map.c6
-rw-r--r--block/blk-merge.c21
-rw-r--r--block/blk-timeout.c20
-rw-r--r--block/elevator.c12
-rw-r--r--block/genhd.c2
-rw-r--r--block/ioctl.c7
7 files changed, 22 insertions, 50 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index c3df30cfb3fc..10e8a64a5a5b 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1770,8 +1770,6 @@ static void end_that_request_last(struct request *req, int error)
1770{ 1770{
1771 struct gendisk *disk = req->rq_disk; 1771 struct gendisk *disk = req->rq_disk;
1772 1772
1773 blk_delete_timer(req);
1774
1775 if (blk_rq_tagged(req)) 1773 if (blk_rq_tagged(req))
1776 blk_queue_end_tag(req->q, req); 1774 blk_queue_end_tag(req->q, req);
1777 1775
@@ -1781,6 +1779,8 @@ static void end_that_request_last(struct request *req, int error)
1781 if (unlikely(laptop_mode) && blk_fs_request(req)) 1779 if (unlikely(laptop_mode) && blk_fs_request(req))
1782 laptop_io_completion(); 1780 laptop_io_completion();
1783 1781
1782 blk_delete_timer(req);
1783
1784 /* 1784 /*
1785 * Account IO completion. bar_rq isn't accounted as a normal 1785 * Account IO completion. bar_rq isn't accounted as a normal
1786 * IO on queueing nor completion. Accounting the containing 1786 * IO on queueing nor completion. Accounting the containing
diff --git a/block/blk-map.c b/block/blk-map.c
index 4849fa36161e..0f4b4b881811 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -217,6 +217,12 @@ 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 bio_unmap_user(bio);
222 return -EINVAL; 228 return -EINVAL;
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 8681cd6f9911..b92f5b0866b0 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -222,27 +222,6 @@ new_segment:
222} 222}
223EXPORT_SYMBOL(blk_rq_map_sg); 223EXPORT_SYMBOL(blk_rq_map_sg);
224 224
225static inline int ll_new_mergeable(struct request_queue *q,
226 struct request *req,
227 struct bio *bio)
228{
229 int nr_phys_segs = bio_phys_segments(q, bio);
230
231 if (req->nr_phys_segments + nr_phys_segs > q->max_phys_segments) {
232 req->cmd_flags |= REQ_NOMERGE;
233 if (req == q->last_merge)
234 q->last_merge = NULL;
235 return 0;
236 }
237
238 /*
239 * A hw segment is just getting larger, bump just the phys
240 * counter.
241 */
242 req->nr_phys_segments += nr_phys_segs;
243 return 1;
244}
245
246static inline int ll_new_hw_segment(struct request_queue *q, 225static inline int ll_new_hw_segment(struct request_queue *q,
247 struct request *req, 226 struct request *req,
248 struct bio *bio) 227 struct bio *bio)
diff --git a/block/blk-timeout.c b/block/blk-timeout.c
index 972a63f848fb..69185ea9fae2 100644
--- a/block/blk-timeout.c
+++ b/block/blk-timeout.c
@@ -75,14 +75,7 @@ void blk_delete_timer(struct request *req)
75{ 75{
76 struct request_queue *q = req->q; 76 struct request_queue *q = req->q;
77 77
78 /*
79 * Nothing to detach
80 */
81 if (!q->rq_timed_out_fn || !req->deadline)
82 return;
83
84 list_del_init(&req->timeout_list); 78 list_del_init(&req->timeout_list);
85
86 if (list_empty(&q->timeout_list)) 79 if (list_empty(&q->timeout_list))
87 del_timer(&q->timeout); 80 del_timer(&q->timeout);
88} 81}
@@ -142,7 +135,7 @@ void blk_rq_timed_out_timer(unsigned long data)
142 } 135 }
143 136
144 if (next_set && !list_empty(&q->timeout_list)) 137 if (next_set && !list_empty(&q->timeout_list))
145 mod_timer(&q->timeout, round_jiffies(next)); 138 mod_timer(&q->timeout, round_jiffies_up(next));
146 139
147 spin_unlock_irqrestore(q->queue_lock, flags); 140 spin_unlock_irqrestore(q->queue_lock, flags);
148} 141}
@@ -198,17 +191,10 @@ void blk_add_timer(struct request *req)
198 191
199 /* 192 /*
200 * If the timer isn't already pending or this timeout is earlier 193 * If the timer isn't already pending or this timeout is earlier
201 * than an existing one, modify the timer. Round to next nearest 194 * than an existing one, modify the timer. Round up to next nearest
202 * second. 195 * second.
203 */ 196 */
204 expiry = round_jiffies(req->deadline); 197 expiry = round_jiffies_up(req->deadline);
205
206 /*
207 * We use ->deadline == 0 to detect whether a timer was added or
208 * not, so just increase to next jiffy for that specific case
209 */
210 if (unlikely(!req->deadline))
211 req->deadline = 1;
212 198
213 if (!timer_pending(&q->timeout) || 199 if (!timer_pending(&q->timeout) ||
214 time_before(expiry, q->timeout.expires)) 200 time_before(expiry, q->timeout.expires))
diff --git a/block/elevator.c b/block/elevator.c
index 59173a69ebdf..9ac82dde99dd 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -773,12 +773,6 @@ struct request *elv_next_request(struct request_queue *q)
773 */ 773 */
774 rq->cmd_flags |= REQ_STARTED; 774 rq->cmd_flags |= REQ_STARTED;
775 blk_add_trace_rq(q, rq, BLK_TA_ISSUE); 775 blk_add_trace_rq(q, rq, BLK_TA_ISSUE);
776
777 /*
778 * We are now handing the request to the hardware,
779 * add the timeout handler
780 */
781 blk_add_timer(rq);
782 } 776 }
783 777
784 if (!q->boundary_rq || q->boundary_rq == rq) { 778 if (!q->boundary_rq || q->boundary_rq == rq) {
@@ -850,6 +844,12 @@ void elv_dequeue_request(struct request_queue *q, struct request *rq)
850 */ 844 */
851 if (blk_account_rq(rq)) 845 if (blk_account_rq(rq))
852 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} 853}
854EXPORT_SYMBOL(elv_dequeue_request); 854EXPORT_SYMBOL(elv_dequeue_request);
855 855
diff --git a/block/genhd.c b/block/genhd.c
index 4e5e7493f676..27549e470da5 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);
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)