Skip to content

Commit feaf384

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: block: fix setting of max_segment_size and seg_boundary mask block: internal dequeue shouldn't start timer block: set disk->node_id before it's being used When block layer fails to map iov, it calls bio_unmap_user to undo
2 parents a771132 + 0e435ac commit feaf384

8 files changed

Lines changed: 37 additions & 19 deletions

File tree

‎block/blk-barrier.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static inline struct request *start_ordered(struct request_queue *q,
161161
/*
162162
* Prep proxy barrier request.
163163
*/
164-
blkdev_dequeue_request(rq);
164+
elv_dequeue_request(q, rq);
165165
q->orig_bar_rq = rq;
166166
rq = &q->bar_rq;
167167
blk_rq_init(q, rq);
@@ -219,7 +219,7 @@ int blk_do_ordered(struct request_queue *q, struct request **rqp)
219219
* This can happen when the queue switches to
220220
* ORDERED_NONE while this request is on it.
221221
*/
222-
blkdev_dequeue_request(rq);
222+
elv_dequeue_request(q, rq);
223223
if (__blk_end_request(rq, -EOPNOTSUPP,
224224
blk_rq_bytes(rq)))
225225
BUG();

‎block/blk-core.c‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
592592
1 << QUEUE_FLAG_STACKABLE);
593593
q->queue_lock = lock;
594594

595-
blk_queue_segment_boundary(q, 0xffffffff);
595+
blk_queue_segment_boundary(q, BLK_SEG_BOUNDARY_MASK);
596596

597597
blk_queue_make_request(q, __make_request);
598598
blk_queue_max_segment_size(q, MAX_SEGMENT_SIZE);
@@ -1636,6 +1636,28 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq)
16361636
}
16371637
EXPORT_SYMBOL_GPL(blk_insert_cloned_request);
16381638

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+
*/
1649+
void 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+
}
1659+
EXPORT_SYMBOL(blkdev_dequeue_request);
1660+
16391661
/**
16401662
* __end_that_request_first - end I/O on a request
16411663
* @req: the request being processed
@@ -1774,7 +1796,7 @@ static void end_that_request_last(struct request *req, int error)
17741796
blk_queue_end_tag(req->q, req);
17751797

17761798
if (blk_queued_rq(req))
1777-
blkdev_dequeue_request(req);
1799+
elv_dequeue_request(req->q, req);
17781800

17791801
if (unlikely(laptop_mode) && blk_fs_request(req))
17801802
laptop_io_completion();

‎block/blk-map.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
224224
*/
225225
bio_get(bio);
226226
bio_endio(bio, 0);
227-
bio_unmap_user(bio);
227+
__blk_rq_unmap_user(bio);
228228
return -EINVAL;
229229
}
230230

‎block/blk-settings.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
125125
q->nr_requests = BLKDEV_MAX_RQ;
126126
blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
127127
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+
128131
q->make_request_fn = mfn;
129132
q->backing_dev_info.ra_pages =
130133
(VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
@@ -314,6 +317,7 @@ void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b)
314317
/* zero is "infinity" */
315318
t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors);
316319
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);
317321

318322
t->max_phys_segments = min(t->max_phys_segments, b->max_phys_segments);
319323
t->max_hw_segments = min(t->max_hw_segments, b->max_hw_segments);

‎block/elevator.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -844,14 +844,7 @@ void elv_dequeue_request(struct request_queue *q, struct request *rq)
844844
*/
845845
if (blk_account_rq(rq))
846846
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);
853847
}
854-
EXPORT_SYMBOL(elv_dequeue_request);
855848

856849
int elv_queue_empty(struct request_queue *q)
857850
{

‎block/genhd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
11021102
kfree(disk);
11031103
return NULL;
11041104
}
1105+
disk->node_id = node_id;
11051106
if (disk_expand_part_tbl(disk, 0)) {
11061107
free_part_stats(&disk->part0);
11071108
kfree(disk);
@@ -1116,7 +1117,6 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
11161117
device_initialize(disk_to_dev(disk));
11171118
INIT_WORK(&disk->async_notify,
11181119
media_change_notify_thread);
1119-
disk->node_id = node_id;
11201120
}
11211121
return disk;
11221122
}

‎drivers/md/dm-table.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ static void check_for_valid_limits(struct io_restrictions *rs)
668668
if (!rs->max_segment_size)
669669
rs->max_segment_size = MAX_SEGMENT_SIZE;
670670
if (!rs->seg_boundary_mask)
671-
rs->seg_boundary_mask = -1;
671+
rs->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK;
672672
if (!rs->bounce_pfn)
673673
rs->bounce_pfn = -1;
674674
}

‎include/linux/blkdev.h‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,8 @@ static inline void blk_run_address_space(struct address_space *mapping)
786786
blk_run_backing_dev(mapping->backing_dev_info, NULL);
787787
}
788788

789+
extern void blkdev_dequeue_request(struct request *req);
790+
789791
/*
790792
* blk_end_request() and friends.
791793
* __blk_end_request() and end_request() must be called with
@@ -820,11 +822,6 @@ extern void blk_update_request(struct request *rq, int error,
820822
extern unsigned int blk_rq_bytes(struct request *rq);
821823
extern unsigned int blk_rq_cur_bytes(struct request *rq);
822824

823-
static inline void blkdev_dequeue_request(struct request *req)
824-
{
825-
elv_dequeue_request(req->q, req);
826-
}
827-
828825
/*
829826
* Access functions for manipulating queue properties
830827
*/
@@ -921,6 +918,8 @@ extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter);
921918

922919
#define MAX_SEGMENT_SIZE 65536
923920

921+
#define BLK_SEG_BOUNDARY_MASK 0xFFFFFFFFUL
922+
924923
#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)
925924

926925
static inline int queue_hardsect_size(struct request_queue *q)

0 commit comments

Comments
 (0)