lib/blob: try best to merge the contiguous clusters

blob_persist_clear_clusters() issues 'unmap' or 'write_zeroes'
IOs in one batch, this can consumes lots of 'bdev_io's.
we need to try best to merge the contiguous clusters
especially in the following case:

cluster 0: LBA 128 (count = 128)
cluster 1: LBA 0 (meaning thin provisioned, no cluster allocated)
cluster 2: LBA 256 (count = 128)

Besides, in the long run, we may need to do this batch by sequence.

Signed-off-by: Sochin Jiang <jiangxiaoqing.sochin@bytedance.com>
Change-Id: I436c8b46a1ee33ec127d0f43fd85b2c443689b59
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4082
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Sochin Jiang 2020-09-07 14:37:53 +08:00 committed by Tomasz Zawadzki
parent 18274baf87
commit 3790a412b8

View File

@ -1732,6 +1732,8 @@ blob_persist_clear_clusters(spdk_bs_sequence_t *seq, struct spdk_blob_persist_ct
/* This cluster is contiguous with the previous one. */
lba_count += next_lba_count;
continue;
} else if (next_lba == 0) {
continue;
}
/* This cluster is not contiguous with the previous one. */