Bug #5314
closedRemove "dbuf phys" db->db_data pointer aliases in ZFS
100%
Description
Consumers of the DMU can associate private data with dmu buffers via the dmu_buf_*user() APIs. The current API allows the consumer to register a pointer to a pointer inside its private data that should shadow the db_data pointer within the dbuf. This pointer aliasing exists solely so that the consumer of the API does not need to cast db->db_data to the type of the data contained within the buffer.
Rather than have pointer aliases that consume memory and can get out of sync, use accessor functions that cast db->db_data to the appropriate type.
Updated by Justin Gibbs over 8 years ago
Updated by Justin Gibbs over 8 years ago
Remove "dbuf phys" db->db_data pointer aliases.
Use function accessors that cast db->db_data to the appropriate
"phys" type, removing the need for clients of the dmu buf user
API to keep properly typed pointer aliases to db->db_data in order
to conveniently access their data.
cmd/mdb/common/modules/zfs/Makefile.zfs:
cmd/mdb/intel/amd64/libzpool/Makefile:
cmd/mdb/intel/amd64/zfs/Makefile:
cmd/mdb/intel/ia32/libzpool/Makefile:
cmd/mdb/intel/ia32/zfs/Makefile:
cmd/mdb/sparc/v7/libzpool/Makefile:
cmd/mdb/sparc/v9/libzpool/Makefile:
cmd/mdb/sparc/v9/zfs/Makefile:
cmd/zdb/Makefile.com:
Silence E_STATIC_UNUSED lint warnings.
cmd/mdb/common/modules/zfs/zfs.c:
uts/common/fs/zfs/zap_leaf.c:
In zap_leaf() and zap_leaf_byteswap, now that the pointer alias
field l_phys has been removed, use the db_data field in an on
stack dmu_buf_t to point to the leaf's phys data.
uts/common/fs/zfs/dbuf.c:
Remove the db_user_data_ptr_ptr field from dbuf and all logic
to maintain it.
uts/common/fs/zfs/dbuf.c:
uts/common/fs/zfs/dnode.c:
uts/common/fs/zfs/sys/dbuf.h:
uts/common/fs/zfs/sys/dmu.h:
uts/common/fs/zfs/dsl_dataset.c:
uts/common/fs/zfs/dsl_dir.c:
uts/common/fs/zfs/sa.c:
uts/common/fs/zfs/zap.c:
uts/common/fs/zfs/zap_micro.c:
Modify the DMU buf user API to remove the ability to specify
a db_data aliasing pointer (db_user_data_ptr_ptr).
cmd/zdb/zdb.c:
uts/common/fs/zfs/dmu_diff.c:
uts/common/fs/zfs/dmu_objset.c:
uts/common/fs/zfs/dmu_send.c:
uts/common/fs/zfs/dmu_traverse.c:
uts/common/fs/zfs/dmu_tx.c:
uts/common/fs/zfs/dsl_bookmark.c:
uts/common/fs/zfs/dsl_dataset.c:
uts/common/fs/zfs/dsl_deadlist.c:
uts/common/fs/zfs/dsl_deleg.c:
uts/common/fs/zfs/dsl_destroy.c:
uts/common/fs/zfs/dsl_dir.c:
uts/common/fs/zfs/dsl_pool.c:
uts/common/fs/zfs/dsl_prop.c:
uts/common/fs/zfs/dsl_scan.c:
uts/common/fs/zfs/dsl_synctask.c:
uts/common/fs/zfs/dsl_userhold.c:
uts/common/fs/zfs/sa.c:
uts/common/fs/zfs/spa.c:
uts/common/fs/zfs/spa_history.c:
uts/common/fs/zfs/zap.c:
uts/common/fs/zfs/zap_leaf.c:
uts/common/fs/zfs/zap_micro.c:
uts/common/fs/zfs/zfs_ioctl.c:
uts/common/fs/zfs/sys/dsl_dataset.h:
uts/common/fs/zfs/sys/dsl_dir.h:
uts/common/fs/zfs/sys/zap_impl.h:
uts/common/fs/zfs/sys/zap_leaf.h:
Create and use the new "phys data" accessor functions
dsl_dir_phys(), dsl_dataset_phys(), zap_m_phys(),
zap_f_phys(), and zap_leaf_phys().
uts/common/fs/zfs/sys/dsl_dataset.h:
uts/common/fs/zfs/sys/dsl_dir.h:
uts/common/fs/zfs/sys/zap_impl.h:
uts/common/fs/zfs/sys/zap_leaf.h:
Remove now unused "phys pointer" aliases to db->db_data
from clients of the DMU buf user API.
Updated by Electric Monk over 8 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
git commit c1379625401dfbe1c39b79136dd384a571d47fde
commit c1379625401dfbe1c39b79136dd384a571d47fde Author: Justin T. Gibbs <justing@spectralogic.com> Date: 2014-12-04T05:40:19.000Z 5314 Remove "dbuf phys" db->db_data pointer aliases in ZFS Reviewed by: Andriy Gapon <avg@freebsd.org> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Will Andrews <willa@spectralogic.com> Approved by: Dan McDonald <danmcd@omniti.com>