aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-14 16:15:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-14 16:15:14 -0400
commitdddec01eb8e2b56267b37a6f9f0997a64b4e0b2a (patch)
treeb6d8bfbce9abd105384b9d116499afbe306b9c22 /block/blk-core.c
parent7daf705f362e349983e92037a198b8821db198af (diff)
parent32502b8413a77b54b9e19809404109590c32dfb7 (diff)
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: (37 commits) splice: fix generic_file_splice_read() race with page invalidation ramfs: enable splice write drivers/block/pktcdvd.c: avoid useless memset cdrom: revert commit 22a9189 (cdrom: use kmalloced buffers instead of buffers on stack) scsi: sr avoids useless buffer allocation block: blk_rq_map_kern uses the bounce buffers for stack buffers block: add blk_queue_update_dma_pad DAC960: push down BKL pktcdvd: push BKL down into driver paride: push ioctl down into driver block: use get_unaligned_* helpers block: extend queue_flag bitops block: request_module(): use format string Add bvec_merge_data to handle stacked devices and ->merge_bvec() block: integrity flags can't use bit ops on unsigned short cmdfilter: extend default read filter sg: fix odd style (extra parenthesis) introduced by cmd filter patch block: add bounce support to blk_rq_map_user_iov cfq-iosched: get rid of enable_idle being unused warning allow userspace to modify scsi command filter on per device basis ...
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 1905aaba49fb..dbc7f42b5d2b 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -143,6 +143,10 @@ static void req_bio_endio(struct request *rq, struct bio *bio,
143 143
144 bio->bi_size -= nbytes; 144 bio->bi_size -= nbytes;
145 bio->bi_sector += (nbytes >> 9); 145 bio->bi_sector += (nbytes >> 9);
146
147 if (bio_integrity(bio))
148 bio_integrity_advance(bio, nbytes);
149
146 if (bio->bi_size == 0) 150 if (bio->bi_size == 0)
147 bio_endio(bio, error); 151 bio_endio(bio, error);
148 } else { 152 } else {
@@ -201,8 +205,7 @@ void blk_plug_device(struct request_queue *q)
201 if (blk_queue_stopped(q)) 205 if (blk_queue_stopped(q))
202 return; 206 return;
203 207
204 if (!test_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags)) { 208 if (!queue_flag_test_and_set(QUEUE_FLAG_PLUGGED, q)) {
205 __set_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags);
206 mod_timer(&q->unplug_timer, jiffies + q->unplug_delay); 209 mod_timer(&q->unplug_timer, jiffies + q->unplug_delay);
207 blk_add_trace_generic(q, NULL, 0, BLK_TA_PLUG); 210 blk_add_trace_generic(q, NULL, 0, BLK_TA_PLUG);
208 } 211 }
@@ -217,10 +220,9 @@ int blk_remove_plug(struct request_queue *q)
217{ 220{
218 WARN_ON(!irqs_disabled()); 221 WARN_ON(!irqs_disabled());
219 222
220 if (!test_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags)) 223 if (!queue_flag_test_and_clear(QUEUE_FLAG_PLUGGED, q))
221 return 0; 224 return 0;
222 225
223 queue_flag_clear(QUEUE_FLAG_PLUGGED, q);
224 del_timer(&q->unplug_timer); 226 del_timer(&q->unplug_timer);
225 return 1; 227 return 1;
226} 228}
@@ -324,8 +326,7 @@ void blk_start_queue(struct request_queue *q)
324 * one level of recursion is ok and is much faster than kicking 326 * one level of recursion is ok and is much faster than kicking
325 * the unplug handling 327 * the unplug handling
326 */ 328 */
327 if (!test_bit(QUEUE_FLAG_REENTER, &q->queue_flags)) { 329 if (!queue_flag_test_and_set(QUEUE_FLAG_REENTER, q)) {
328 queue_flag_set(QUEUE_FLAG_REENTER, q);
329 q->request_fn(q); 330 q->request_fn(q);
330 queue_flag_clear(QUEUE_FLAG_REENTER, q); 331 queue_flag_clear(QUEUE_FLAG_REENTER, q);
331 } else { 332 } else {
@@ -390,8 +391,7 @@ void __blk_run_queue(struct request_queue *q)
390 * handling reinvoke the handler shortly if we already got there. 391 * handling reinvoke the handler shortly if we already got there.
391 */ 392 */
392 if (!elv_queue_empty(q)) { 393 if (!elv_queue_empty(q)) {
393 if (!test_bit(QUEUE_FLAG_REENTER, &q->queue_flags)) { 394 if (!queue_flag_test_and_set(QUEUE_FLAG_REENTER, q)) {
394 queue_flag_set(QUEUE_FLAG_REENTER, q);
395 q->request_fn(q); 395 q->request_fn(q);
396 queue_flag_clear(QUEUE_FLAG_REENTER, q); 396 queue_flag_clear(QUEUE_FLAG_REENTER, q);
397 } else { 397 } else {
@@ -1381,6 +1381,9 @@ end_io:
1381 */ 1381 */
1382 blk_partition_remap(bio); 1382 blk_partition_remap(bio);
1383 1383
1384 if (bio_integrity_enabled(bio) && bio_integrity_prep(bio))
1385 goto end_io;
1386
1384 if (old_sector != -1) 1387 if (old_sector != -1)
1385 blk_add_trace_remap(q, bio, old_dev, bio->bi_sector, 1388 blk_add_trace_remap(q, bio, old_dev, bio->bi_sector,
1386 old_sector); 1389 old_sector);