diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-22 08:56:55 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-22 08:56:55 +0200 |
| commit | b4a338d2b3cafa1be68d4e1903203c7e08a38ee5 (patch) | |
| tree | 069f3753af1cda34c36a7627000ab46ef5c51c83 /drivers/md/persistent-data/dm-space-map-disk.c | |
| parent | 34cfb106d1f8a746fcccbe61c852f705dcdceaa2 (diff) | |
| parent | 08332893e37af6ae779367e78e444f8f9571511d (diff) | |
| download | lwn-b4a338d2b3cafa1be68d4e1903203c7e08a38ee5.tar.gz lwn-b4a338d2b3cafa1be68d4e1903203c7e08a38ee5.zip | |
Merge 4.12-rc2 into char-misc-next
We want the fixes in here as well to handle 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) |
