memcmpz -> lblk_is_zeros
This commit is contained in:
parent
24401f9a68
commit
c1ec406a00
|
@ -504,6 +504,25 @@ lblk_alloc_elem_read(struct dm_compress* dc, struct zone_cache* zc, u64 lblk)
|
||||||
* Logical block functions
|
* Logical block functions
|
||||||
**************************************/
|
**************************************/
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
lblk_is_zeros(struct cbd_params* params, struct zone_cache* zc)
|
||||||
|
{
|
||||||
|
#ifdef CBD_DETECT_ZERO_BLOCKS
|
||||||
|
u32 off;
|
||||||
|
u32 len = PBLK_SIZE * lblk_per_pblk(params);
|
||||||
|
|
||||||
|
for (off = 0; off < len; ++off) {
|
||||||
|
if (zc->lblk[off]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compress dc->lblk into dc->lz4_cbuf
|
* Compress dc->lblk into dc->lz4_cbuf
|
||||||
*
|
*
|
||||||
|
@ -569,11 +588,7 @@ lblk_write(struct dm_compress* dc, struct zone_cache* zc)
|
||||||
BUG_ON(zc->lblk_alloc_elem_lblk == LBLK_NONE);
|
BUG_ON(zc->lblk_alloc_elem_lblk == LBLK_NONE);
|
||||||
|
|
||||||
d_len = PBLK_SIZE * lblk_per_pblk(&dc->params);
|
d_len = PBLK_SIZE * lblk_per_pblk(&dc->params);
|
||||||
#ifdef CBD_DETECT_ZERO_BLOCKS
|
if (lblk_is_zeros(&dc->params, zc)) {
|
||||||
if (memcmpz(zc->lblk, d_len) == 0) {
|
|
||||||
#else
|
|
||||||
if (0) {
|
|
||||||
#endif
|
|
||||||
c_len = 0;
|
c_len = 0;
|
||||||
c_buf = NULL;
|
c_buf = NULL;
|
||||||
zc->lblk_alloc_elem->len = 0;
|
zc->lblk_alloc_elem->len = 0;
|
||||||
|
|
Loading…
Reference in New Issue