From patchwork Tue Mar 17 14:05:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonthan Brassow X-Patchwork-Id: 12619 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 n2HE5ENf018680 for ; Tue, 17 Mar 2009 14:05:14 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 1E9E6619B26; Tue, 17 Mar 2009 10:05:15 -0400 (EDT) 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 n2HE5DNE023640 for ; Tue, 17 Mar 2009 10:05:13 -0400 Received: from hydrogen.msp.redhat.com (hydrogen.msp.redhat.com [10.15.80.1]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n2HE5Bk9011744 for ; Tue, 17 Mar 2009 10:05:12 -0400 Received: from hydrogen.msp.redhat.com (localhost.localdomain [127.0.0.1]) by hydrogen.msp.redhat.com (8.14.1/8.14.1) with ESMTP id n2HE5B6c017471 for ; Tue, 17 Mar 2009 09:05:11 -0500 Received: (from jbrassow@localhost) by hydrogen.msp.redhat.com (8.14.1/8.14.1/Submit) id n2HE5BFK017469 for dm-devel@redhat.com; Tue, 17 Mar 2009 09:05:11 -0500 Date: Tue, 17 Mar 2009 09:05:11 -0500 From: Jonathan Brassow Message-Id: <200903171405.n2HE5BFK017469@hydrogen.msp.redhat.com> To: dm-devel@redhat.com X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 18 of 29] 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 @@ -741,20 +741,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.