@@ -976,11 +976,12 @@ static bool swap_bios_limit(struct dm_target *ti, struct bio *bio)
976
976
static void clone_endio (struct bio * bio )
977
977
{
978
978
blk_status_t error = bio -> bi_status ;
979
+ struct request_queue * q = bio -> bi_bdev -> bd_disk -> queue ;
979
980
struct dm_target_io * tio = clone_to_tio (bio );
981
+ struct dm_target * ti = tio -> ti ;
982
+ dm_endio_fn endio = ti -> type -> end_io ;
980
983
struct dm_io * io = tio -> io ;
981
- struct mapped_device * md = tio -> io -> md ;
982
- dm_endio_fn endio = tio -> ti -> type -> end_io ;
983
- struct request_queue * q = bio -> bi_bdev -> bd_disk -> queue ;
984
+ struct mapped_device * md = io -> md ;
984
985
985
986
if (unlikely (error == BLK_STS_TARGET )) {
986
987
if (bio_op (bio ) == REQ_OP_DISCARD &&
@@ -995,7 +996,7 @@ static void clone_endio(struct bio *bio)
995
996
dm_zone_endio (io , bio );
996
997
997
998
if (endio ) {
998
- int r = endio (tio -> ti , bio , & error );
999
+ int r = endio (ti , bio , & error );
999
1000
switch (r ) {
1000
1001
case DM_ENDIO_REQUEUE :
1001
1002
/*
@@ -1019,10 +1020,8 @@ static void clone_endio(struct bio *bio)
1019
1020
}
1020
1021
}
1021
1022
1022
- if (unlikely (swap_bios_limit (tio -> ti , bio ))) {
1023
- struct mapped_device * md = io -> md ;
1023
+ if (unlikely (swap_bios_limit (ti , bio )))
1024
1024
up (& md -> swap_bios_semaphore );
1025
- }
1026
1025
1027
1026
free_tio (bio );
1028
1027
dm_io_dec_pending (io , error );
@@ -1263,9 +1262,10 @@ static noinline void __set_swap_bios_limit(struct mapped_device *md, int latch)
1263
1262
static void __map_bio (struct bio * clone )
1264
1263
{
1265
1264
struct dm_target_io * tio = clone_to_tio (clone );
1266
- int r ;
1267
- struct dm_io * io = tio -> io ;
1268
1265
struct dm_target * ti = tio -> ti ;
1266
+ struct dm_io * io = tio -> io ;
1267
+ struct mapped_device * md = io -> md ;
1268
+ int r ;
1269
1269
1270
1270
clone -> bi_end_io = clone_endio ;
1271
1271
@@ -1276,7 +1276,6 @@ static void __map_bio(struct bio *clone)
1276
1276
tio -> old_sector = clone -> bi_iter .bi_sector ;
1277
1277
1278
1278
if (unlikely (swap_bios_limit (ti , clone ))) {
1279
- struct mapped_device * md = io -> md ;
1280
1279
int latch = get_swap_bios ();
1281
1280
if (unlikely (latch != md -> swap_bios ))
1282
1281
__set_swap_bios_limit (md , latch );
@@ -1288,7 +1287,7 @@ static void __map_bio(struct bio *clone)
1288
1287
* on zoned target. In this case, dm_zone_map_bio() calls the target
1289
1288
* map operation.
1290
1289
*/
1291
- if (unlikely (dm_emulate_zone_append (io -> md )))
1290
+ if (unlikely (dm_emulate_zone_append (md )))
1292
1291
r = dm_zone_map_bio (tio );
1293
1292
else
1294
1293
r = ti -> type -> map (ti , clone );
@@ -1304,14 +1303,14 @@ static void __map_bio(struct bio *clone)
1304
1303
* the bio has been remapped so dispatch it, but defer
1305
1304
* dm_start_io_acct() until after possible bio_split().
1306
1305
*/
1307
- __dm_submit_bio_remap (clone , disk_devt (io -> md -> disk ),
1306
+ __dm_submit_bio_remap (clone , disk_devt (md -> disk ),
1308
1307
tio -> old_sector );
1309
1308
dm_io_set_flag (io , DM_IO_START_ACCT );
1310
1309
break ;
1311
1310
case DM_MAPIO_KILL :
1312
1311
case DM_MAPIO_REQUEUE :
1313
1312
if (unlikely (swap_bios_limit (ti , clone )))
1314
- up (& io -> md -> swap_bios_semaphore );
1313
+ up (& md -> swap_bios_semaphore );
1315
1314
free_tio (clone );
1316
1315
if (r == DM_MAPIO_KILL )
1317
1316
dm_io_dec_pending (io , BLK_STS_IOERR );
0 commit comments