Tidy-ups incl. using dm_suspended(). --- diff/drivers/md/dm.c 2005-07-06 18:41:32.000000000 +0100 +++ source/drivers/md/dm.c 2005-07-06 18:40:34.000000000 +0100 @@ -610,7 +610,7 @@ int ret = -ENXIO; if (map) { - ret = dm_table_flush_all(md->map); + ret = dm_table_flush_all(map); dm_table_put(map); } @@ -849,13 +849,14 @@ if (size == 0) return 0; + dm_table_get(t); + dm_table_event_callback(t, event_callback, md); + write_lock(&md->map_lock); md->map = t; + dm_table_set_restrictions(t, q); write_unlock(&md->map_lock); - dm_table_get(t); - dm_table_event_callback(md->map, event_callback, md); - dm_table_set_restrictions(t, q); return 0; } @@ -935,7 +936,7 @@ struct dm_table *map = dm_get_table(md); if (atomic_dec_and_test(&md->holders)) { - if (!test_bit(DMF_SUSPENDED, &md->flags) && map) { + if (!dm_suspended(md) && map) { dm_table_presuspend_targets(map); dm_table_postsuspend_targets(map); } @@ -971,7 +972,7 @@ down_write(&md->lock); /* device must be suspended */ - if (!test_bit(DMF_SUSPENDED, &md->flags)) { + if (!dm_suspended(md)) { up_write(&md->lock); return -EPERM; } @@ -1142,7 +1143,7 @@ down_write(&md->lock); if (!map || - !test_bit(DMF_SUSPENDED, &md->flags) || + !dm_suspended(md) || !dm_table_get_size(map)) { up_write(&md->lock); dm_table_put(map);