dm optimization: don't disable irq when taking map_lock It is supposed that no one will take dm table from the interrupt context. No one can submit bios from the interrupt context anyway, so we suppose that no one will call I/O helper functions from interrupt context. This patch removes irq disabling from device mapper. The patch adds BUG_ON(in_interrupt()) to catch parts of code that may possibly take dm table from an interrupt context. Signed-off-by: Mikulas Patocka --- drivers/md/dm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) Index: linux-3.3-devel/drivers/md/dm.c =================================================================== --- linux-3.3-devel.orig/drivers/md/dm.c 2012-04-17 22:33:31.000000000 +0200 +++ linux-3.3-devel/drivers/md/dm.c 2012-04-17 22:35:07.000000000 +0200 @@ -546,13 +546,13 @@ static void queue_io(struct mapped_devic struct dm_table *dm_get_live_table(struct mapped_device *md) { struct dm_table *t; - unsigned long flags; - read_lock_irqsave(&md->map_lock, flags); + BUG_ON(in_interrupt()); + read_lock(&md->map_lock); t = md->map; if (t) dm_table_get(t); - read_unlock_irqrestore(&md->map_lock, flags); + read_unlock(&md->map_lock); return t; } @@ -2057,7 +2057,6 @@ static struct dm_table *__bind(struct ma struct dm_table *old_map; struct request_queue *q = md->queue; sector_t size; - unsigned long flags; int merge_is_optional; size = dm_table_get_size(t); @@ -2086,7 +2085,7 @@ static struct dm_table *__bind(struct ma merge_is_optional = dm_table_merge_is_optional(t); - write_lock_irqsave(&md->map_lock, flags); + write_lock(&md->map_lock); old_map = md->map; md->map = t; md->immutable_target_type = dm_table_get_immutable_target_type(t); @@ -2096,7 +2095,7 @@ static struct dm_table *__bind(struct ma set_bit(DMF_MERGE_IS_OPTIONAL, &md->flags); else clear_bit(DMF_MERGE_IS_OPTIONAL, &md->flags); - write_unlock_irqrestore(&md->map_lock, flags); + write_unlock(&md->map_lock); return old_map; } @@ -2107,15 +2106,14 @@ static struct dm_table *__bind(struct ma static struct dm_table *__unbind(struct mapped_device *md) { struct dm_table *map = md->map; - unsigned long flags; if (!map) return NULL; dm_table_event_callback(map, NULL, NULL); - write_lock_irqsave(&md->map_lock, flags); + write_lock(&md->map_lock); md->map = NULL; - write_unlock_irqrestore(&md->map_lock, flags); + write_unlock(&md->map_lock); return map; }