From: Jonathan Brassow Subject: [PATCH 1 of 2] DM Snapshot: remove redundant valid test Date: Wed, 23 Sep 2009 10:19:08 -0500 Message-ID: <200909231519.n8NFJ8K3028667@hydrogen.msp.redhat.com> Reply-To: device-mapper development Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: dm-devel@redhat.com Cc: mpatocka@redhat.com, snitzer@redhat.com, agk@redhat.com List-Id: dm-devel.ids Patch name: dm-snapshot-remove-redundant-valid-test.patch There is another valid test when we take the lock, the previous test can be dropped. Signed-off-by: Mikulas Patocka Reviewed-by: Jonathan Brassow Reviewed-by: Mike Snitzer Index: linux-2.6/drivers/md/dm-snap.c =================================================================== --- linux-2.6.orig/drivers/md/dm-snap.c +++ linux-2.6/drivers/md/dm-snap.c @@ -1043,15 +1043,11 @@ static int snapshot_map(struct dm_target chunk = sector_to_chunk(s->store, bio->bi_sector); - /* Full snapshots are not usable */ - /* To get here the table must be live so s->active is always set. */ - if (!s->valid) - return -EIO; - /* FIXME: should only take write lock if we need * to copy an exception */ down_write(&s->lock); + /* Full snapshots are not usable */ if (!s->valid) { r = -EIO; goto out_unlock;