Skip to content

Commit

Permalink
os/bluestore: fix missing discard in BlueStore::_kv_sync_thread
Browse files Browse the repository at this point in the history
Discard comand should be issued before space released.

Signed-off-by: Junhui Tang <tangjunhui@sangfor.com.cn>
Fixes: https://tracker.ceph.com/issues/39621
(cherry picked from commit f6205d2)
  • Loading branch information
JunhuiTang authored and Prashant D committed May 27, 2019
1 parent 35e6f59 commit 14a021c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -10555,7 +10555,20 @@ void BlueStore::_kv_sync_thread()
if (!bluefs_extents_reclaiming.empty()) {
dout(0) << __func__ << " releasing old bluefs 0x" << std::hex
<< bluefs_extents_reclaiming << std::dec << dendl;
int r = 0;
if (cct->_conf->bdev_enable_discard && cct->_conf->bdev_async_discard) {
r = bdev->queue_discard(bluefs_extents_reclaiming);
if (r == 0) {
goto clear;
}
} else if (cct->_conf->bdev_enable_discard) {
for (auto p = bluefs_extents_reclaiming.begin(); p != bluefs_extents_reclaiming.end(); ++p) {
bdev->discard(p.get_start(), p.get_len());
}
}

alloc->release(bluefs_extents_reclaiming);
clear:
bluefs_extents_reclaiming.clear();
}
}
Expand Down

0 comments on commit 14a021c

Please sign in to comment.