Commit:     943317efdbc295e8a28df3f5cbd549d066ee8b4a
Parent:     0764147b111b8ca886e4f2e9c9e019106b09b657
Author:     Jonathan Brassow <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 17:28:25 2007 +0100
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Jul 12 15:01:08 2007 -0700

    dm raid1: clear region outside spinlock
    A clear_region function is permitted to block (in practice, rare) but gets
    called in rh_update_states() with a spinlock held.
    The bits being marked and cleared by the above functions are used
    to update the on-disk log, but are never read directly.  We can
    perform these operations outside the spinlock since the
    bits are only changed within one thread viz.
       - mark_region in rh_inc()
       - clear_region in rh_update_states().
    So, we grab the clean_regions list items via list_splice() within the
    spinlock and defer clear_region() until we iterate over the list for
    deletion - similar to how the recovered_regions list is already handled.
    We then move the flush() call down to ensure it encapsulates the changes
    which are done by the later calls to clear_region().
    Signed-off-by: Jonathan Brassow <[EMAIL PROTECTED]>
    Signed-off-by: Alasdair G Kergon <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 drivers/md/dm-raid1.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index b3bba98..04dce7a 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -378,10 +378,8 @@ static void rh_update_states(struct region_hash *rh)
                list_splice(&rh->clean_regions, &clean);
-               list_for_each_entry (reg, &clean, list) {
-                       rh->log->type->clear_region(rh->log, reg->key);
+               list_for_each_entry(reg, &clean, list)
-               }
        if (!list_empty(&rh->recovered_regions)) {
@@ -405,10 +403,12 @@ static void rh_update_states(struct region_hash *rh)
                mempool_free(reg, rh->region_pool);
-       rh->log->type->flush(rh->log);
-       list_for_each_entry_safe (reg, next, &clean, list)
+       list_for_each_entry_safe(reg, next, &clean, list) {
+               rh->log->type->clear_region(rh->log, reg->key);
                mempool_free(reg, rh->region_pool);
+       }
+       rh->log->type->flush(rh->log);
 static void rh_inc(struct region_hash *rh, region_t region)
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to