diff options
Diffstat (limited to 'drivers/s390/char/tape_block.c')
-rw-r--r-- | drivers/s390/char/tape_block.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index f32e89e7c4f..1e796767598 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
@@ -74,13 +74,6 @@ tapeblock_trigger_requeue(struct tape_device *device) | |||
74 | * Post finished request. | 74 | * Post finished request. |
75 | */ | 75 | */ |
76 | static void | 76 | static void |
77 | tapeblock_end_request(struct request *req, int error) | ||
78 | { | ||
79 | if (blk_end_request(req, error, blk_rq_bytes(req))) | ||
80 | BUG(); | ||
81 | } | ||
82 | |||
83 | static void | ||
84 | __tapeblock_end_request(struct tape_request *ccw_req, void *data) | 77 | __tapeblock_end_request(struct tape_request *ccw_req, void *data) |
85 | { | 78 | { |
86 | struct tape_device *device; | 79 | struct tape_device *device; |
@@ -90,17 +83,17 @@ __tapeblock_end_request(struct tape_request *ccw_req, void *data) | |||
90 | 83 | ||
91 | device = ccw_req->device; | 84 | device = ccw_req->device; |
92 | req = (struct request *) data; | 85 | req = (struct request *) data; |
93 | tapeblock_end_request(req, (ccw_req->rc == 0) ? 0 : -EIO); | 86 | blk_end_request_all(req, (ccw_req->rc == 0) ? 0 : -EIO); |
94 | if (ccw_req->rc == 0) | 87 | if (ccw_req->rc == 0) |
95 | /* Update position. */ | 88 | /* Update position. */ |
96 | device->blk_data.block_position = | 89 | device->blk_data.block_position = |
97 | (req->sector + req->nr_sectors) >> TAPEBLOCK_HSEC_S2B; | 90 | (blk_rq_pos(req) + blk_rq_sectors(req)) >> TAPEBLOCK_HSEC_S2B; |
98 | else | 91 | else |
99 | /* We lost the position information due to an error. */ | 92 | /* We lost the position information due to an error. */ |
100 | device->blk_data.block_position = -1; | 93 | device->blk_data.block_position = -1; |
101 | device->discipline->free_bread(ccw_req); | 94 | device->discipline->free_bread(ccw_req); |
102 | if (!list_empty(&device->req_queue) || | 95 | if (!list_empty(&device->req_queue) || |
103 | elv_next_request(device->blk_data.request_queue)) | 96 | blk_peek_request(device->blk_data.request_queue)) |
104 | tapeblock_trigger_requeue(device); | 97 | tapeblock_trigger_requeue(device); |
105 | } | 98 | } |
106 | 99 | ||
@@ -118,7 +111,7 @@ tapeblock_start_request(struct tape_device *device, struct request *req) | |||
118 | ccw_req = device->discipline->bread(device, req); | 111 | ccw_req = device->discipline->bread(device, req); |
119 | if (IS_ERR(ccw_req)) { | 112 | if (IS_ERR(ccw_req)) { |
120 | DBF_EVENT(1, "TBLOCK: bread failed\n"); | 113 | DBF_EVENT(1, "TBLOCK: bread failed\n"); |
121 | tapeblock_end_request(req, -EIO); | 114 | blk_end_request_all(req, -EIO); |
122 | return PTR_ERR(ccw_req); | 115 | return PTR_ERR(ccw_req); |
123 | } | 116 | } |
124 | ccw_req->callback = __tapeblock_end_request; | 117 | ccw_req->callback = __tapeblock_end_request; |
@@ -131,7 +124,7 @@ tapeblock_start_request(struct tape_device *device, struct request *req) | |||
131 | * Start/enqueueing failed. No retries in | 124 | * Start/enqueueing failed. No retries in |
132 | * this case. | 125 | * this case. |
133 | */ | 126 | */ |
134 | tapeblock_end_request(req, -EIO); | 127 | blk_end_request_all(req, -EIO); |
135 | device->discipline->free_bread(ccw_req); | 128 | device->discipline->free_bread(ccw_req); |
136 | } | 129 | } |
137 | 130 | ||
@@ -169,19 +162,16 @@ tapeblock_requeue(struct work_struct *work) { | |||
169 | spin_lock_irq(&device->blk_data.request_queue_lock); | 162 | spin_lock_irq(&device->blk_data.request_queue_lock); |
170 | while ( | 163 | while ( |
171 | !blk_queue_plugged(queue) && | 164 | !blk_queue_plugged(queue) && |
172 | elv_next_request(queue) && | 165 | (req = blk_fetch_request(queue)) && |
173 | nr_queued < TAPEBLOCK_MIN_REQUEUE | 166 | nr_queued < TAPEBLOCK_MIN_REQUEUE |
174 | ) { | 167 | ) { |
175 | req = elv_next_request(queue); | ||
176 | if (rq_data_dir(req) == WRITE) { | 168 | if (rq_data_dir(req) == WRITE) { |
177 | DBF_EVENT(1, "TBLOCK: Rejecting write request\n"); | 169 | DBF_EVENT(1, "TBLOCK: Rejecting write request\n"); |
178 | blkdev_dequeue_request(req); | ||
179 | spin_unlock_irq(&device->blk_data.request_queue_lock); | 170 | spin_unlock_irq(&device->blk_data.request_queue_lock); |
180 | tapeblock_end_request(req, -EIO); | 171 | blk_end_request_all(req, -EIO); |
181 | spin_lock_irq(&device->blk_data.request_queue_lock); | 172 | spin_lock_irq(&device->blk_data.request_queue_lock); |
182 | continue; | 173 | continue; |
183 | } | 174 | } |
184 | blkdev_dequeue_request(req); | ||
185 | nr_queued++; | 175 | nr_queued++; |
186 | spin_unlock_irq(&device->blk_data.request_queue_lock); | 176 | spin_unlock_irq(&device->blk_data.request_queue_lock); |
187 | rc = tapeblock_start_request(device, req); | 177 | rc = tapeblock_start_request(device, req); |