Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm: do not call dm_sync_table() when creating new devices

When creating new devices dm_sync_table() calls
synchronize_rcu_expedited(), causing _all_ pending RCU pointers to be
flushed. This causes a latency overhead that is especially noticeable
when creating lots of devices.

And all of this is pointless as there are no old maps to be
disconnected, and hence no stale pointers which would need to be
cleared up.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>

authored by

Hannes Reinecke and committed by
Mike Snitzer
41abc4e1 6fa99520

+6 -3
+6 -3
drivers/md/dm.c
··· 2341 2341 set_bit(DMF_MERGE_IS_OPTIONAL, &md->flags); 2342 2342 else 2343 2343 clear_bit(DMF_MERGE_IS_OPTIONAL, &md->flags); 2344 - dm_sync_table(md); 2344 + if (old_map) 2345 + dm_sync_table(md); 2345 2346 2346 2347 return old_map; 2347 2348 } ··· 2783 2782 * flush_workqueue(md->wq). 2784 2783 */ 2785 2784 set_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags); 2786 - synchronize_srcu(&md->io_barrier); 2785 + if (map) 2786 + synchronize_srcu(&md->io_barrier); 2787 2787 2788 2788 /* 2789 2789 * Stop md->queue before flushing md->wq in case request-based ··· 2804 2802 2805 2803 if (noflush) 2806 2804 clear_bit(DMF_NOFLUSH_SUSPENDING, &md->flags); 2807 - synchronize_srcu(&md->io_barrier); 2805 + if (map) 2806 + synchronize_srcu(&md->io_barrier); 2808 2807 2809 2808 /* were we interrupted ? */ 2810 2809 if (r < 0) {