Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Device-mapper Development (http://www.linux-archive.org/device-mapper-development/)
-   -   DM Snapshot: small code optimization (http://www.linux-archive.org/device-mapper-development/266467-dm-snapshot-small-code-optimization.html)

Jonathan Brassow 03-19-2009 08:35 PM

DM Snapshot: small code optimization
 
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 <jbrassow@redhat.com>

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.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Jonathan Brassow 03-25-2009 08:37 PM

DM Snapshot: small code optimization
 
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 <jbrassow@redhat.com>

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.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


All times are GMT. The time now is 07:03 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.