Skip to content

Commit

Permalink
blobstore: expose api to reset blob usage cache
Browse files Browse the repository at this point in the history
Signed-off-by: Hrudaya <[email protected]>
Signed-off-by: Dmitry Savitskiy <[email protected]>
  • Loading branch information
hrudaya21 authored and dsavitskiy committed Sep 15, 2023
1 parent f3feaf5 commit 80d1ec0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions include/spdk/blob.h
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,12 @@ struct spdk_bs_dev *spdk_blob_get_esnap_bs_dev(const struct spdk_blob *blob);
*/
bool spdk_blob_is_degraded(const struct spdk_blob *blob);

/**
* Reset num_used_clusters_cache, if blob is thin provisioned.
* \param blob for which need to reset the usage cache.
*/
void spdk_blob_reset_used_clusters_cache(struct spdk_blob *blob);

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion lib/blob/blobstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -5976,7 +5976,7 @@ spdk_blob_calc_used_clusters(struct spdk_blob *blob)
}

void
blob_reset_used_clusters_cache(struct spdk_blob *blob)
spdk_blob_reset_used_clusters_cache(struct spdk_blob *blob)
{
assert(blob != NULL);
if (spdk_blob_is_thin_provisioned(blob)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/lvol/lvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ lvol_create_snapshot_cb(void *cb_arg, spdk_blob_id blobid, int lvolerrno)
struct spdk_lvol_snapshot_req *snap_req = cb_arg;

if (lvolerrno == 0) {
blob_reset_used_clusters_cache(snap_req->parent->blob);
spdk_blob_reset_used_clusters_cache(snap_req->parent->blob);
}
snap_req->orig_cb_fn(snap_req->orig_cb_arg, blobid, lvolerrno);
free(cb_arg);
Expand Down

0 comments on commit 80d1ec0

Please sign in to comment.