diff options
author | Joe Thornber <ejt@redhat.com> | 2014-03-03 10:37:24 -0500 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2014-03-27 16:56:23 -0400 |
commit | 428e4698642794444cdb26c148a827f22c28d546 (patch) | |
tree | cf554886d6d1f9434a58a3e139c5b7d4ee8a6ab5 /drivers/md | |
parent | eec40579d84873dfb7021eb24c50360f073237c5 (diff) |
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>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/persistent-data/dm-bitset.c | 10 | ||||
-rw-r--r-- | drivers/md/persistent-data/dm-bitset.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/drivers/md/persistent-data/dm-bitset.c b/drivers/md/persistent-data/dm-bitset.c index cd9a86d4cdf0..36f7cc2c7109 100644 --- a/drivers/md/persistent-data/dm-bitset.c +++ b/drivers/md/persistent-data/dm-bitset.c | |||
@@ -65,7 +65,7 @@ int dm_bitset_flush(struct dm_disk_bitset *info, dm_block_t root, | |||
65 | int r; | 65 | int r; |
66 | __le64 value; | 66 | __le64 value; |
67 | 67 | ||
68 | if (!info->current_index_set) | 68 | if (!info->current_index_set || !info->dirty) |
69 | return 0; | 69 | return 0; |
70 | 70 | ||
71 | value = cpu_to_le64(info->current_bits); | 71 | value = cpu_to_le64(info->current_bits); |
@@ -77,6 +77,8 @@ int dm_bitset_flush(struct dm_disk_bitset *info, dm_block_t root, | |||
77 | return r; | 77 | return r; |
78 | 78 | ||
79 | info->current_index_set = false; | 79 | info->current_index_set = false; |
80 | info->dirty = false; | ||
81 | |||
80 | return 0; | 82 | return 0; |
81 | } | 83 | } |
82 | EXPORT_SYMBOL_GPL(dm_bitset_flush); | 84 | EXPORT_SYMBOL_GPL(dm_bitset_flush); |
@@ -94,6 +96,8 @@ static int read_bits(struct dm_disk_bitset *info, dm_block_t root, | |||
94 | info->current_bits = le64_to_cpu(value); | 96 | info->current_bits = le64_to_cpu(value); |
95 | info->current_index_set = true; | 97 | info->current_index_set = true; |
96 | info->current_index = array_index; | 98 | info->current_index = array_index; |
99 | info->dirty = false; | ||
100 | |||
97 | return 0; | 101 | return 0; |
98 | } | 102 | } |
99 | 103 | ||
@@ -126,6 +130,8 @@ int dm_bitset_set_bit(struct dm_disk_bitset *info, dm_block_t root, | |||
126 | return r; | 130 | return r; |
127 | 131 | ||
128 | set_bit(b, (unsigned long *) &info->current_bits); | 132 | set_bit(b, (unsigned long *) &info->current_bits); |
133 | info->dirty = true; | ||
134 | |||
129 | return 0; | 135 | return 0; |
130 | } | 136 | } |
131 | EXPORT_SYMBOL_GPL(dm_bitset_set_bit); | 137 | 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, | |||
141 | return r; | 147 | return r; |
142 | 148 | ||
143 | clear_bit(b, (unsigned long *) &info->current_bits); | 149 | clear_bit(b, (unsigned long *) &info->current_bits); |
150 | info->dirty = true; | ||
151 | |||
144 | return 0; | 152 | return 0; |
145 | } | 153 | } |
146 | EXPORT_SYMBOL_GPL(dm_bitset_clear_bit); | 154 | EXPORT_SYMBOL_GPL(dm_bitset_clear_bit); |
diff --git a/drivers/md/persistent-data/dm-bitset.h b/drivers/md/persistent-data/dm-bitset.h index e1b9bea14aa1..c2287d672ef5 100644 --- a/drivers/md/persistent-data/dm-bitset.h +++ b/drivers/md/persistent-data/dm-bitset.h | |||
@@ -71,6 +71,7 @@ struct dm_disk_bitset { | |||
71 | uint64_t current_bits; | 71 | uint64_t current_bits; |
72 | 72 | ||
73 | bool current_index_set:1; | 73 | bool current_index_set:1; |
74 | bool dirty:1; | ||
74 | }; | 75 | }; |
75 | 76 | ||
76 | /* | 77 | /* |