summaryrefslogtreecommitdiff
path: root/drivers/md/persistent-data
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-06-07 11:25:30 +0300
committerTakashi Iwai <tiwai@suse.de>2017-06-07 11:25:30 +0300
commit4c7aba46c9e82aa236502760a677e666589afead (patch)
tree9baa94b072fa58c674c34b8ddaec8b9e727e1657 /drivers/md/persistent-data
parentd2dc2a96de9d58038ac1f9ee432e88a70958d59b (diff)
parentba3021b2c79b2fa9114f92790a99deb27a65b728 (diff)
downloadlinux-4c7aba46c9e82aa236502760a677e666589afead.tar.xz
Merge branch 'for-linus' into for-next
For applying more ALSA timer cleanups.
Diffstat (limited to 'drivers/md/persistent-data')
-rw-r--r--drivers/md/persistent-data/dm-space-map-disk.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/md/persistent-data/dm-space-map-disk.c b/drivers/md/persistent-data/dm-space-map-disk.c
index ebb280a14325..32adf6b4a9c7 100644
--- a/drivers/md/persistent-data/dm-space-map-disk.c
+++ b/drivers/md/persistent-data/dm-space-map-disk.c
@@ -142,10 +142,23 @@ static int sm_disk_inc_block(struct dm_space_map *sm, dm_block_t b)
static int sm_disk_dec_block(struct dm_space_map *sm, dm_block_t b)
{
+ int r;
+ uint32_t old_count;
enum allocation_event ev;
struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
- return sm_ll_dec(&smd->ll, b, &ev);
+ r = sm_ll_dec(&smd->ll, b, &ev);
+ if (!r && (ev == SM_FREE)) {
+ /*
+ * It's only free if it's also free in the last
+ * transaction.
+ */
+ r = sm_ll_lookup(&smd->old_ll, b, &old_count);
+ if (!r && !old_count)
+ smd->nr_allocated_this_transaction--;
+ }
+
+ return r;
}
static int sm_disk_new_block(struct dm_space_map *sm, dm_block_t *b)