@@ -2266,33 +2266,17 @@ static int fnic_clean_pending_aborts(struct fnic *fnic,
2266
2266
static inline int
2267
2267
fnic_scsi_host_start_tag (struct fnic * fnic , struct scsi_cmnd * sc )
2268
2268
{
2269
- struct blk_queue_tag * bqt = fnic -> lport -> host -> bqt ;
2270
- int tag , ret = SCSI_NO_TAG ;
2269
+ struct request_queue * q = sc -> request -> q ;
2270
+ struct request * dummy ;
2271
2271
2272
- BUG_ON (!bqt );
2273
- if (!bqt ) {
2274
- pr_err ("Tags are not supported\n" );
2275
- goto end ;
2276
- }
2277
-
2278
- do {
2279
- tag = find_next_zero_bit (bqt -> tag_map , bqt -> max_depth , 1 );
2280
- if (tag >= bqt -> max_depth ) {
2281
- pr_err ("Tag allocation failure\n" );
2282
- goto end ;
2283
- }
2284
- } while (test_and_set_bit (tag , bqt -> tag_map ));
2272
+ dummy = blk_mq_alloc_request (q , REQ_OP_WRITE , BLK_MQ_REQ_NOWAIT );
2273
+ if (IS_ERR (dummy ))
2274
+ return SCSI_NO_TAG ;
2285
2275
2286
- bqt -> tag_index [tag ] = sc -> request ;
2287
- sc -> request -> tag = tag ;
2288
- sc -> tag = tag ;
2289
- if (!sc -> request -> special )
2290
- sc -> request -> special = sc ;
2276
+ sc -> tag = sc -> request -> tag = dummy -> tag ;
2277
+ sc -> request -> special = sc ;
2291
2278
2292
- ret = tag ;
2293
-
2294
- end :
2295
- return ret ;
2279
+ return dummy -> tag ;
2296
2280
}
2297
2281
2298
2282
/**
@@ -2302,20 +2286,9 @@ fnic_scsi_host_start_tag(struct fnic *fnic, struct scsi_cmnd *sc)
2302
2286
static inline void
2303
2287
fnic_scsi_host_end_tag (struct fnic * fnic , struct scsi_cmnd * sc )
2304
2288
{
2305
- struct blk_queue_tag * bqt = fnic -> lport -> host -> bqt ;
2306
- int tag = sc -> request -> tag ;
2307
-
2308
- if (tag == SCSI_NO_TAG )
2309
- return ;
2310
-
2311
- BUG_ON (!bqt || !bqt -> tag_index [tag ]);
2312
- if (!bqt )
2313
- return ;
2289
+ struct request * dummy = sc -> request -> special ;
2314
2290
2315
- bqt -> tag_index [tag ] = NULL ;
2316
- clear_bit (tag , bqt -> tag_map );
2317
-
2318
- return ;
2291
+ blk_mq_free_request (dummy );
2319
2292
}
2320
2293
2321
2294
/*
@@ -2374,19 +2347,9 @@ int fnic_device_reset(struct scsi_cmnd *sc)
2374
2347
tag = sc -> request -> tag ;
2375
2348
if (unlikely (tag < 0 )) {
2376
2349
/*
2377
- * XXX(hch): current the midlayer fakes up a struct
2378
- * request for the explicit reset ioctls, and those
2379
- * don't have a tag allocated to them. The below
2380
- * code pokes into midlayer structures to paper over
2381
- * this design issue, but that won't work for blk-mq.
2382
- *
2383
- * Either someone who can actually test the hardware
2384
- * will have to come up with a similar hack for the
2385
- * blk-mq case, or we'll have to bite the bullet and
2386
- * fix the way the EH ioctls work for real, but until
2387
- * that happens we fail these explicit requests here.
2350
+ * Really should fix the midlayer to pass in a proper
2351
+ * request for ioctls...
2388
2352
*/
2389
-
2390
2353
tag = fnic_scsi_host_start_tag (fnic , sc );
2391
2354
if (unlikely (tag == SCSI_NO_TAG ))
2392
2355
goto fnic_device_reset_end ;
0 commit comments