mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
dm raid1: split touched state into two
Split the variable "touched" into two, "touched_dirtied" and "touched_cleaned", set when some region was dirtied or cleaned. This will be used to optimize flushes. After a transition from "dirty" to "clean" state we don't have flush hardware cache on the log device. After a transition from "clean" to "dirty" the cache must be flushed. Before a transition from "clean" to "dirty" state we don't have to flush all the raid legs. Before a transition from "dirty" to "clean" we must flush all the legs to make sure that they are really in sync. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
parent
4184153f9e
commit
b09acf1aa7
@ -208,7 +208,8 @@ struct log_header {
|
|||||||
|
|
||||||
struct log_c {
|
struct log_c {
|
||||||
struct dm_target *ti;
|
struct dm_target *ti;
|
||||||
int touched;
|
int touched_dirtied;
|
||||||
|
int touched_cleaned;
|
||||||
uint32_t region_size;
|
uint32_t region_size;
|
||||||
unsigned int region_count;
|
unsigned int region_count;
|
||||||
region_t sync_count;
|
region_t sync_count;
|
||||||
@ -253,14 +254,14 @@ static inline void log_set_bit(struct log_c *l,
|
|||||||
uint32_t *bs, unsigned bit)
|
uint32_t *bs, unsigned bit)
|
||||||
{
|
{
|
||||||
ext2_set_bit(bit, (unsigned long *) bs);
|
ext2_set_bit(bit, (unsigned long *) bs);
|
||||||
l->touched = 1;
|
l->touched_cleaned = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void log_clear_bit(struct log_c *l,
|
static inline void log_clear_bit(struct log_c *l,
|
||||||
uint32_t *bs, unsigned bit)
|
uint32_t *bs, unsigned bit)
|
||||||
{
|
{
|
||||||
ext2_clear_bit(bit, (unsigned long *) bs);
|
ext2_clear_bit(bit, (unsigned long *) bs);
|
||||||
l->touched = 1;
|
l->touched_dirtied = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------
|
/*----------------------------------------------------------------
|
||||||
@ -378,7 +379,8 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
|
|||||||
}
|
}
|
||||||
|
|
||||||
lc->ti = ti;
|
lc->ti = ti;
|
||||||
lc->touched = 0;
|
lc->touched_dirtied = 0;
|
||||||
|
lc->touched_cleaned = 0;
|
||||||
lc->region_size = region_size;
|
lc->region_size = region_size;
|
||||||
lc->region_count = region_count;
|
lc->region_count = region_count;
|
||||||
lc->sync = sync;
|
lc->sync = sync;
|
||||||
@ -660,14 +662,16 @@ static int disk_flush(struct dm_dirty_log *log)
|
|||||||
struct log_c *lc = (struct log_c *) log->context;
|
struct log_c *lc = (struct log_c *) log->context;
|
||||||
|
|
||||||
/* only write if the log has changed */
|
/* only write if the log has changed */
|
||||||
if (!lc->touched)
|
if (!lc->touched_cleaned && !lc->touched_dirtied)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = rw_header(lc, WRITE);
|
r = rw_header(lc, WRITE);
|
||||||
if (r)
|
if (r)
|
||||||
fail_log_device(lc);
|
fail_log_device(lc);
|
||||||
else
|
else {
|
||||||
lc->touched = 0;
|
lc->touched_dirtied = 0;
|
||||||
|
lc->touched_cleaned = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user