From patchwork Fri Feb 20 23:28:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonthan Brassow X-Patchwork-Id: 8224 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1KNSdMq031111 for ; Fri, 20 Feb 2009 23:28:39 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id CE8E68E04DA; Fri, 20 Feb 2009 18:28:38 -0500 (EST) Received: from int-mx2.corp.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n1KNSbac001371 for ; Fri, 20 Feb 2009 18:28:37 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n1KNSaj2015046 for ; Fri, 20 Feb 2009 18:28:37 -0500 Received: from [10.15.80.1] (hydrogen.msp.redhat.com [10.15.80.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n1KNSZwX028943 for ; Fri, 20 Feb 2009 18:28:35 -0500 From: Jonathan Brassow To: dm-devel@redhat.com Date: Fri, 20 Feb 2009 17:28:35 -0600 Message-Id: <1235172515.24593.45.camel@hydrogen.msp.redhat.com> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 13 of 17] dm-snap-possible-code-optimization.patch X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Minor code clean-up. The reason I broke this out into a separate patch is so people can check if I'm not missing anything... I don't see a reason to check 's->valid' separately anymore. RFC-by: Jonathan Brassow --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel 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 @@ -740,20 +740,14 @@ static void pending_complete(struct dm_s struct bio *snapshot_bios = NULL; int error = 0; + down_write(&s->lock); if (!success) { /* Read/write error - snapshot is unusable */ - down_write(&s->lock); __invalidate_snapshot(s, -EIO); error = 1; goto out; } - down_write(&s->lock); - if (!s->valid) { - error = 1; - goto out; - } - /* * Check for conflicting reads. This is extremely improbable, * so msleep(1) is sufficient and there is no need for a wait queue.