Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 86841
b: refs/heads/master
c: 8311c29
h: refs/heads/master
i:
  86839: 5541b3e
v: v3
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Mar 5, 2008
1 parent ff40de2 commit f017375
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a35e63efa1fb18c6f20f38e3ddf3f8ffbcf0f6e7
refs/heads/master: 8311c29d40235062a843f4a8e8a70a44af6fe4c9
19 changes: 17 additions & 2 deletions trunk/drivers/md/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,11 @@ void bitmap_daemon_work(struct bitmap *bitmap)
if (time_before(jiffies, bitmap->daemon_lastrun + bitmap->daemon_sleep*HZ))
return;
bitmap->daemon_lastrun = jiffies;
if (bitmap->allclean) {
bitmap->mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
return;
}
bitmap->allclean = 1;

for (j = 0; j < bitmap->chunks; j++) {
bitmap_counter_t *bmc;
Expand All @@ -1068,8 +1073,10 @@ void bitmap_daemon_work(struct bitmap *bitmap)
clear_page_attr(bitmap, page, BITMAP_PAGE_NEEDWRITE);

spin_unlock_irqrestore(&bitmap->lock, flags);
if (need_write)
if (need_write) {
write_page(bitmap, page, 0);
bitmap->allclean = 0;
}
continue;
}

Expand Down Expand Up @@ -1098,6 +1105,9 @@ void bitmap_daemon_work(struct bitmap *bitmap)
/*
if (j < 100) printk("bitmap: j=%lu, *bmc = 0x%x\n", j, *bmc);
*/
if (*bmc)
bitmap->allclean = 0;

if (*bmc == 2) {
*bmc=1; /* maybe clear the bit next time */
set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN);
Expand Down Expand Up @@ -1132,6 +1142,8 @@ void bitmap_daemon_work(struct bitmap *bitmap)
}
}

if (bitmap->allclean == 0)
bitmap->mddev->thread->timeout = bitmap->daemon_sleep * HZ;
}

static bitmap_counter_t *bitmap_get_counter(struct bitmap *bitmap,
Expand Down Expand Up @@ -1226,6 +1238,7 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect
sectors -= blocks;
else sectors = 0;
}
bitmap->allclean = 0;
return 0;
}

Expand Down Expand Up @@ -1296,6 +1309,7 @@ int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks,
}
}
spin_unlock_irq(&bitmap->lock);
bitmap->allclean = 0;
return rv;
}

Expand Down Expand Up @@ -1332,6 +1346,7 @@ void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int ab
}
unlock:
spin_unlock_irqrestore(&bitmap->lock, flags);
bitmap->allclean = 0;
}

void bitmap_close_sync(struct bitmap *bitmap)
Expand Down Expand Up @@ -1399,7 +1414,7 @@ static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int n
set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN);
}
spin_unlock_irq(&bitmap->lock);

bitmap->allclean = 0;
}

/* dirty the memory and file bits for bitmap chunks "s" to "e" */
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/raid/bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ struct bitmap {

unsigned long flags;

int allclean;

unsigned long max_write_behind; /* write-behind mode */
atomic_t behind_writes;

Expand Down

0 comments on commit f017375

Please sign in to comment.