@@ -596,7 +596,6 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio)
596596 this_cpu_inc (* md -> pending_io );
597597 io -> orig_bio = bio ;
598598 io -> md = md ;
599- io -> map_task = current ;
600599 spin_lock_init (& io -> lock );
601600 io -> start_time = jiffies ;
602601 io -> flags = 0 ;
@@ -1241,13 +1240,6 @@ void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors)
12411240}
12421241EXPORT_SYMBOL_GPL (dm_accept_partial_bio );
12431242
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-
12511243/*
12521244 * @clone: clone bio that DM core passed to target's .map function
12531245 * @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)
12621254 struct dm_target_io * tio = clone_to_tio (clone );
12631255 struct dm_io * io = tio -> io ;
12641256
1265- WARN_ON_ONCE (!tio -> ti -> accounts_remapped_io );
1266-
12671257 /* establish bio that will get submitted */
12681258 if (!tgt_clone )
12691259 tgt_clone = clone ;
@@ -1272,15 +1262,11 @@ void dm_submit_bio_remap(struct bio *clone, struct bio *tgt_clone)
12721262 * Account io->origin_bio to DM dev on behalf of target
12731263 * that took ownership of IO with DM_MAPIO_SUBMITTED.
12741264 */
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 );
12811266
1282- __dm_submit_bio_remap (tgt_clone , disk_devt (io -> md -> disk ),
1267+ trace_block_bio_remap (tgt_clone , disk_devt (io -> md -> disk ),
12831268 tio -> old_sector );
1269+ submit_bio_noacct (tgt_clone );
12841270}
12851271EXPORT_SYMBOL_GPL (dm_submit_bio_remap );
12861272
@@ -1340,16 +1326,10 @@ static void __map_bio(struct bio *clone)
13401326 case DM_MAPIO_SUBMITTED :
13411327 /* target has assumed ownership of this io */
13421328 if (!ti -> accounts_remapped_io )
1343- dm_io_set_flag (io , DM_IO_START_ACCT );
1329+ dm_start_io_acct (io , clone );
13441330 break ;
13451331 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 );
13531333 break ;
13541334 case DM_MAPIO_KILL :
13551335 case DM_MAPIO_REQUEUE :
@@ -1667,7 +1647,6 @@ static void dm_split_and_process_bio(struct mapped_device *md,
16671647 }
16681648
16691649 error = __split_and_process_bio (& ci );
1670- io -> map_task = NULL ;
16711650 if (error || !ci .sector_count )
16721651 goto out ;
16731652 /*
@@ -1679,9 +1658,6 @@ static void dm_split_and_process_bio(struct mapped_device *md,
16791658 bio_inc_remaining (bio );
16801659 submit_bio_noacct (bio );
16811660out :
1682- if (dm_io_flagged (io , DM_IO_START_ACCT ))
1683- dm_start_io_acct (io , NULL );
1684-
16851661 /*
16861662 * Drop the extra reference count for non-POLLED bio, and hold one
16871663 * reference for POLLED bio, which will be released in dm_poll_bio
0 commit comments