diff options
author | Mike Snitzer <snitzer@redhat.com> | 2009-12-10 23:52:29 +0000 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-12-10 23:52:29 +0000 |
commit | 615d1eb9cad9b34ed17c18c604254e8db533ac6f (patch) | |
tree | 0937db148422cad3057db39ec2eaecf7b87e21a9 /drivers | |
parent | 9eaae8ffbc340fc034fed1e5d0dc9ca0e943f817 (diff) | |
download | linux-615d1eb9cad9b34ed17c18c604254e8db533ac6f.tar.gz linux-615d1eb9cad9b34ed17c18c604254e8db533ac6f.tar.bz2 linux-615d1eb9cad9b34ed17c18c604254e8db533ac6f.zip |
dm snapshot: create function for chunk_is_tracked wait
Move the __chunk_is_tracked() loop into a separate function as we will
also need to call it from the write path in the rare case of conflicting
writes to the same chunk.
Originally introduced in commit a8d41b59f3f5a7ac19452ef442a7fc1b5fa17366
("dm snapshot: fix race during exception creation").
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-snap.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 5e553c50c215..288994ee7142 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -234,6 +234,16 @@ static int __chunk_is_tracked(struct dm_snapshot *s, chunk_t chunk) } /* + * This conflicting I/O is extremely improbable in the caller, + * so msleep(1) is sufficient and there is no need for a wait queue. + */ +static void __check_for_conflicting_io(struct dm_snapshot *s, chunk_t chunk) +{ + while (__chunk_is_tracked(s, chunk)) + msleep(1); +} + +/* * One of these per registered origin, held in the snapshot_origins hash */ struct origin { @@ -1102,12 +1112,8 @@ static void pending_complete(struct dm_snap_pending_exception *pe, int success) goto out; } - /* - * Check for conflicting reads. This is extremely improbable, - * so msleep(1) is sufficient and there is no need for a wait queue. - */ - while (__chunk_is_tracked(s, pe->e.old_chunk)) - msleep(1); + /* Check for conflicting reads */ + __check_for_conflicting_io(s, pe->e.old_chunk); /* * Add a proper exception, and remove the |