@@ -596,7 +596,6 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio)
596
596
this_cpu_inc (* md -> pending_io );
597
597
io -> orig_bio = bio ;
598
598
io -> md = md ;
599
- io -> map_task = current ;
600
599
spin_lock_init (& io -> lock );
601
600
io -> start_time = jiffies ;
602
601
io -> flags = 0 ;
@@ -1241,13 +1240,6 @@ void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors)
1241
1240
}
1242
1241
EXPORT_SYMBOL_GPL (dm_accept_partial_bio );
1243
1242
1244
- static inline void __dm_submit_bio_remap (struct bio * clone ,
1245
- dev_t dev , sector_t old_sector )
1246
- {
1247
- trace_block_bio_remap (clone , dev , old_sector );
1248
- submit_bio_noacct (clone );
1249
- }
1250
-
1251
1243
/*
1252
1244
* @clone: clone bio that DM core passed to target's .map function
1253
1245
* @tgt_clone: clone of @clone bio that target needs submitted
@@ -1262,8 +1254,6 @@ void dm_submit_bio_remap(struct bio *clone, struct bio *tgt_clone)
1262
1254
struct dm_target_io * tio = clone_to_tio (clone );
1263
1255
struct dm_io * io = tio -> io ;
1264
1256
1265
- WARN_ON_ONCE (!tio -> ti -> accounts_remapped_io );
1266
-
1267
1257
/* establish bio that will get submitted */
1268
1258
if (!tgt_clone )
1269
1259
tgt_clone = clone ;
@@ -1272,15 +1262,11 @@ void dm_submit_bio_remap(struct bio *clone, struct bio *tgt_clone)
1272
1262
* Account io->origin_bio to DM dev on behalf of target
1273
1263
* that took ownership of IO with DM_MAPIO_SUBMITTED.
1274
1264
*/
1275
- if (io -> map_task == current ) {
1276
- /* Still in target's map function */
1277
- dm_io_set_flag (io , DM_IO_START_ACCT );
1278
- } else {
1279
- dm_start_io_acct (io , clone );
1280
- }
1265
+ dm_start_io_acct (io , clone );
1281
1266
1282
- __dm_submit_bio_remap (tgt_clone , disk_devt (io -> md -> disk ),
1267
+ trace_block_bio_remap (tgt_clone , disk_devt (io -> md -> disk ),
1283
1268
tio -> old_sector );
1269
+ submit_bio_noacct (tgt_clone );
1284
1270
}
1285
1271
EXPORT_SYMBOL_GPL (dm_submit_bio_remap );
1286
1272
@@ -1340,16 +1326,10 @@ static void __map_bio(struct bio *clone)
1340
1326
case DM_MAPIO_SUBMITTED :
1341
1327
/* target has assumed ownership of this io */
1342
1328
if (!ti -> accounts_remapped_io )
1343
- dm_io_set_flag (io , DM_IO_START_ACCT );
1329
+ dm_start_io_acct (io , clone );
1344
1330
break ;
1345
1331
case DM_MAPIO_REMAPPED :
1346
- /*
1347
- * the bio has been remapped so dispatch it, but defer
1348
- * dm_start_io_acct() until after possible bio_split().
1349
- */
1350
- __dm_submit_bio_remap (clone , disk_devt (md -> disk ),
1351
- tio -> old_sector );
1352
- dm_io_set_flag (io , DM_IO_START_ACCT );
1332
+ dm_submit_bio_remap (clone , NULL );
1353
1333
break ;
1354
1334
case DM_MAPIO_KILL :
1355
1335
case DM_MAPIO_REQUEUE :
@@ -1667,7 +1647,6 @@ static void dm_split_and_process_bio(struct mapped_device *md,
1667
1647
}
1668
1648
1669
1649
error = __split_and_process_bio (& ci );
1670
- io -> map_task = NULL ;
1671
1650
if (error || !ci .sector_count )
1672
1651
goto out ;
1673
1652
/*
@@ -1679,9 +1658,6 @@ static void dm_split_and_process_bio(struct mapped_device *md,
1679
1658
bio_inc_remaining (bio );
1680
1659
submit_bio_noacct (bio );
1681
1660
out :
1682
- if (dm_io_flagged (io , DM_IO_START_ACCT ))
1683
- dm_start_io_acct (io , NULL );
1684
-
1685
1661
/*
1686
1662
* Drop the extra reference count for non-POLLED bio, and hold one
1687
1663
* reference for POLLED bio, which will be released in dm_poll_bio
0 commit comments