Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176516
b: refs/heads/master
c: b09acf1
h: refs/heads/master
v: v3
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed Dec 10, 2009
1 parent a41136d commit 5459247
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 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: 4184153f9e483f9bb63339ed316e059962fe9794
refs/heads/master: b09acf1aa79462bdacfe6744b469a17722a52702
18 changes: 11 additions & 7 deletions trunk/drivers/md/dm-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ struct log_header {

struct log_c {
struct dm_target *ti;
int touched;
int touched_dirtied;
int touched_cleaned;
uint32_t region_size;
unsigned int region_count;
region_t sync_count;
Expand Down Expand Up @@ -253,14 +254,14 @@ static inline void log_set_bit(struct log_c *l,
uint32_t *bs, unsigned bit)
{
ext2_set_bit(bit, (unsigned long *) bs);
l->touched = 1;
l->touched_cleaned = 1;
}

static inline void log_clear_bit(struct log_c *l,
uint32_t *bs, unsigned bit)
{
ext2_clear_bit(bit, (unsigned long *) bs);
l->touched = 1;
l->touched_dirtied = 1;
}

/*----------------------------------------------------------------
Expand Down Expand Up @@ -378,7 +379,8 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
}

lc->ti = ti;
lc->touched = 0;
lc->touched_dirtied = 0;
lc->touched_cleaned = 0;
lc->region_size = region_size;
lc->region_count = region_count;
lc->sync = sync;
Expand Down Expand Up @@ -660,14 +662,16 @@ static int disk_flush(struct dm_dirty_log *log)
struct log_c *lc = (struct log_c *) log->context;

/* only write if the log has changed */
if (!lc->touched)
if (!lc->touched_cleaned && !lc->touched_dirtied)
return 0;

r = rw_header(lc, WRITE);
if (r)
fail_log_device(lc);
else
lc->touched = 0;
else {
lc->touched_dirtied = 0;
lc->touched_cleaned = 0;
}

return r;
}
Expand Down

0 comments on commit 5459247

Please sign in to comment.