dm bitset: only flush the current word if it has been dirtied
This change offers a big performance boost for dm-era. Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
eec40579d8
commit
428e469864
2 changed files with 10 additions and 1 deletions
|
@ -65,7 +65,7 @@ int dm_bitset_flush(struct dm_disk_bitset *info, dm_block_t root,
|
||||||
int r;
|
int r;
|
||||||
__le64 value;
|
__le64 value;
|
||||||
|
|
||||||
if (!info->current_index_set)
|
if (!info->current_index_set || !info->dirty)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
value = cpu_to_le64(info->current_bits);
|
value = cpu_to_le64(info->current_bits);
|
||||||
|
@ -77,6 +77,8 @@ int dm_bitset_flush(struct dm_disk_bitset *info, dm_block_t root,
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
info->current_index_set = false;
|
info->current_index_set = false;
|
||||||
|
info->dirty = false;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(dm_bitset_flush);
|
EXPORT_SYMBOL_GPL(dm_bitset_flush);
|
||||||
|
@ -94,6 +96,8 @@ static int read_bits(struct dm_disk_bitset *info, dm_block_t root,
|
||||||
info->current_bits = le64_to_cpu(value);
|
info->current_bits = le64_to_cpu(value);
|
||||||
info->current_index_set = true;
|
info->current_index_set = true;
|
||||||
info->current_index = array_index;
|
info->current_index = array_index;
|
||||||
|
info->dirty = false;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +130,8 @@ int dm_bitset_set_bit(struct dm_disk_bitset *info, dm_block_t root,
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
set_bit(b, (unsigned long *) &info->current_bits);
|
set_bit(b, (unsigned long *) &info->current_bits);
|
||||||
|
info->dirty = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(dm_bitset_set_bit);
|
EXPORT_SYMBOL_GPL(dm_bitset_set_bit);
|
||||||
|
@ -141,6 +147,8 @@ int dm_bitset_clear_bit(struct dm_disk_bitset *info, dm_block_t root,
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
clear_bit(b, (unsigned long *) &info->current_bits);
|
clear_bit(b, (unsigned long *) &info->current_bits);
|
||||||
|
info->dirty = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(dm_bitset_clear_bit);
|
EXPORT_SYMBOL_GPL(dm_bitset_clear_bit);
|
||||||
|
|
|
@ -71,6 +71,7 @@ struct dm_disk_bitset {
|
||||||
uint64_t current_bits;
|
uint64_t current_bits;
|
||||||
|
|
||||||
bool current_index_set:1;
|
bool current_index_set:1;
|
||||||
|
bool dirty:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue