diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-22 09:00:23 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-22 09:00:23 +0200 |
commit | 6acf116c9558314d3cac36d5eb17f30368c73fd2 (patch) | |
tree | 385d0f4811ca8e0bf2deed3d58516b7e97054242 /drivers/md/persistent-data/dm-space-map-disk.c | |
parent | USB: ene_usb6250: turn off the Removable flag (diff) | |
parent | Linux 4.12-rc2 (diff) | |
download | linux-6acf116c9558314d3cac36d5eb17f30368c73fd2.tar.xz linux-6acf116c9558314d3cac36d5eb17f30368c73fd2.zip |
Merge 4.12-rc2 into usb-next
We want the USB fixes in here as well to handle testing and merge
issues.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/persistent-data/dm-space-map-disk.c')
-rw-r--r-- | drivers/md/persistent-data/dm-space-map-disk.c | 15 |
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) |