From patchwork Mon Apr 6 21:36:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonthan Brassow X-Patchwork-Id: 16655 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 n36La496013303 for ; Mon, 6 Apr 2009 21:36:04 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 BDC8B61B251; Mon, 6 Apr 2009 17:36:04 -0400 (EDT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n36La2ZV031663 for ; Mon, 6 Apr 2009 17:36:03 -0400 Received: from hydrogen.msp.redhat.com (hydrogen.msp.redhat.com [10.15.80.1]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n36La5pO015813 for ; Mon, 6 Apr 2009 17:36:05 -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 n36La09E021240 for ; Mon, 6 Apr 2009 16:36:00 -0500 Received: (from jbrassow@localhost) by hydrogen.msp.redhat.com (8.14.1/8.14.1/Submit) id n36La0iL021239 for dm-devel@redhat.com; Mon, 6 Apr 2009 16:36:00 -0500 Date: Mon, 6 Apr 2009 16:36:00 -0500 From: Jonathan Brassow Message-Id: <200904062136.n36La0iL021239@hydrogen.msp.redhat.com> To: dm-devel@redhat.com X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 21 of 33] DM Snapshot: small code optimization 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 Patch name: dm-snap-small-code-optimization.patch Minor code clean-up. I don't see a reason to check 's->valid' separately anymore. Signed-off-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.