mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 11:47:43 +03:00
Remove bcopy(), bzero(), bcmp()
bcopy() has a confusing argument order and is actually a move, not a copy; they're all deprecated since POSIX.1-2001 and removed in -2008, and we shim them out to mem*() on Linux anyway Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12996
This commit is contained in:
+15
-15
@@ -46,11 +46,11 @@ static kmem_cache_t *ddt_entry_cache;
|
||||
*/
|
||||
int zfs_dedup_prefetch = 0;
|
||||
|
||||
static const ddt_ops_t *ddt_ops[DDT_TYPES] = {
|
||||
static const ddt_ops_t *const ddt_ops[DDT_TYPES] = {
|
||||
&ddt_zap_ops,
|
||||
};
|
||||
|
||||
static const char *ddt_class_name[DDT_CLASSES] = {
|
||||
static const char *const ddt_class_name[DDT_CLASSES] = {
|
||||
"ditto",
|
||||
"duplicate",
|
||||
"unique",
|
||||
@@ -99,7 +99,7 @@ ddt_object_destroy(ddt_t *ddt, enum ddt_type type, enum ddt_class class,
|
||||
VERIFY(zap_remove(os, DMU_POOL_DIRECTORY_OBJECT, name, tx) == 0);
|
||||
VERIFY(zap_remove(os, spa->spa_ddt_stat_object, name, tx) == 0);
|
||||
VERIFY(ddt_ops[type]->ddt_op_destroy(os, *objectp, tx) == 0);
|
||||
bzero(&ddt->ddt_object_stats[type][class], sizeof (ddt_object_t));
|
||||
memset(&ddt->ddt_object_stats[type][class], 0, sizeof (ddt_object_t));
|
||||
|
||||
*objectp = 0;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ ddt_phys_fill(ddt_phys_t *ddp, const blkptr_t *bp)
|
||||
void
|
||||
ddt_phys_clear(ddt_phys_t *ddp)
|
||||
{
|
||||
bzero(ddp, sizeof (*ddp));
|
||||
memset(ddp, 0, sizeof (*ddp));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -390,7 +390,7 @@ ddt_stat_generate(ddt_t *ddt, ddt_entry_t *dde, ddt_stat_t *dds)
|
||||
uint64_t lsize = DDK_GET_LSIZE(ddk);
|
||||
uint64_t psize = DDK_GET_PSIZE(ddk);
|
||||
|
||||
bzero(dds, sizeof (*dds));
|
||||
memset(dds, 0, sizeof (*dds));
|
||||
|
||||
for (int p = 0; p < DDT_PHYS_TYPES; p++, ddp++) {
|
||||
uint64_t dsize = 0;
|
||||
@@ -454,7 +454,7 @@ ddt_histogram_add(ddt_histogram_t *dst, const ddt_histogram_t *src)
|
||||
void
|
||||
ddt_histogram_stat(ddt_stat_t *dds, const ddt_histogram_t *ddh)
|
||||
{
|
||||
bzero(dds, sizeof (*dds));
|
||||
memset(dds, 0, sizeof (*dds));
|
||||
|
||||
for (int h = 0; h < 64; h++)
|
||||
ddt_stat_add(dds, &ddh->ddh_stat[h], 0);
|
||||
@@ -532,7 +532,7 @@ ddt_get_dedup_dspace(spa_t *spa)
|
||||
if (spa->spa_dedup_dspace != ~0ULL)
|
||||
return (spa->spa_dedup_dspace);
|
||||
|
||||
bzero(&dds_total, sizeof (ddt_stat_t));
|
||||
memset(&dds_total, 0, sizeof (ddt_stat_t));
|
||||
|
||||
/* Calculate and cache the stats */
|
||||
ddt_get_dedup_stats(spa, &dds_total);
|
||||
@@ -566,7 +566,7 @@ ddt_compress(void *src, uchar_t *dst, size_t s_len, size_t d_len)
|
||||
|
||||
if (c_len == s_len) {
|
||||
cpfunc = ZIO_COMPRESS_OFF;
|
||||
bcopy(src, dst, s_len);
|
||||
memcpy(dst, src, s_len);
|
||||
}
|
||||
|
||||
*version = cpfunc;
|
||||
@@ -586,7 +586,7 @@ ddt_decompress(uchar_t *src, void *dst, size_t s_len, size_t d_len)
|
||||
if (ci->ci_decompress != NULL)
|
||||
(void) ci->ci_decompress(src, dst, s_len, d_len, ci->ci_level);
|
||||
else
|
||||
bcopy(src, dst, d_len);
|
||||
memcpy(dst, src, d_len);
|
||||
|
||||
if (((version & DDT_COMPRESS_BYTEORDER_MASK) != 0) !=
|
||||
(ZFS_HOST_BYTEORDER != 0))
|
||||
@@ -633,7 +633,7 @@ ddt_alloc(const ddt_key_t *ddk)
|
||||
ddt_entry_t *dde;
|
||||
|
||||
dde = kmem_cache_alloc(ddt_entry_cache, KM_SLEEP);
|
||||
bzero(dde, sizeof (ddt_entry_t));
|
||||
memset(dde, 0, sizeof (ddt_entry_t));
|
||||
cv_init(&dde->dde_cv, NULL, CV_DEFAULT, NULL);
|
||||
|
||||
dde->dde_key = *ddk;
|
||||
@@ -785,7 +785,7 @@ ddt_table_alloc(spa_t *spa, enum zio_checksum c)
|
||||
ddt_t *ddt;
|
||||
|
||||
ddt = kmem_cache_alloc(ddt_cache, KM_SLEEP);
|
||||
bzero(ddt, sizeof (ddt_t));
|
||||
memset(ddt, 0, sizeof (ddt_t));
|
||||
|
||||
mutex_init(&ddt->ddt_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
avl_create(&ddt->ddt_tree, ddt_entry_compare,
|
||||
@@ -847,7 +847,7 @@ ddt_load(spa_t *spa)
|
||||
/*
|
||||
* Seed the cached histograms.
|
||||
*/
|
||||
bcopy(ddt->ddt_histogram, &ddt->ddt_histogram_cache,
|
||||
memcpy(&ddt->ddt_histogram_cache, ddt->ddt_histogram,
|
||||
sizeof (ddt->ddt_histogram));
|
||||
spa->spa_dedup_dspace = ~0ULL;
|
||||
}
|
||||
@@ -919,7 +919,7 @@ ddt_repair_start(ddt_t *ddt, const blkptr_t *bp)
|
||||
}
|
||||
}
|
||||
|
||||
bzero(dde->dde_phys, sizeof (dde->dde_phys));
|
||||
memset(dde->dde_phys, 0, sizeof (dde->dde_phys));
|
||||
|
||||
return (dde);
|
||||
}
|
||||
@@ -964,7 +964,7 @@ ddt_repair_entry(ddt_t *ddt, ddt_entry_t *dde, ddt_entry_t *rdde, zio_t *rio)
|
||||
for (int p = 0; p < DDT_PHYS_TYPES; p++, ddp++, rddp++) {
|
||||
if (ddp->ddp_phys_birth == 0 ||
|
||||
ddp->ddp_phys_birth != rddp->ddp_phys_birth ||
|
||||
bcmp(ddp->ddp_dva, rddp->ddp_dva, sizeof (ddp->ddp_dva)))
|
||||
memcmp(ddp->ddp_dva, rddp->ddp_dva, sizeof (ddp->ddp_dva)))
|
||||
continue;
|
||||
ddt_bp_create(ddt->ddt_checksum, ddk, ddp, &blk);
|
||||
zio_nowait(zio_rewrite(zio, zio->io_spa, 0, &blk,
|
||||
@@ -1108,7 +1108,7 @@ ddt_sync_table(ddt_t *ddt, dmu_tx_t *tx, uint64_t txg)
|
||||
}
|
||||
}
|
||||
|
||||
bcopy(ddt->ddt_histogram, &ddt->ddt_histogram_cache,
|
||||
memcpy(&ddt->ddt_histogram_cache, ddt->ddt_histogram,
|
||||
sizeof (ddt->ddt_histogram));
|
||||
spa->spa_dedup_dspace = ~0ULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user