003 File Manager
Current Path:
/usr/src/sys/contrib/openzfs/module/zfs
usr
/
src
/
sys
/
contrib
/
openzfs
/
module
/
zfs
/
📁
..
📄
Makefile.in
(4.57 KB)
📄
THIRDPARTYLICENSE.cityhash
(1.03 KB)
📄
THIRDPARTYLICENSE.cityhash.descrip
(39 B)
📄
abd.c
(31.72 KB)
📄
aggsum.c
(8.46 KB)
📄
arc.c
(330.91 KB)
📄
blkptr.c
(4.26 KB)
📄
bplist.c
(2.38 KB)
📄
bpobj.c
(27.82 KB)
📄
bptree.c
(8.2 KB)
📄
bqueue.c
(4.7 KB)
📄
btree.c
(65.19 KB)
📄
dataset_kstats.c
(6.32 KB)
📄
dbuf.c
(141.84 KB)
📄
dbuf_stats.c
(6.05 KB)
📄
ddt.c
(28.01 KB)
📄
ddt_zap.c
(4.38 KB)
📄
dmu.c
(60.44 KB)
📄
dmu_diff.c
(6.25 KB)
📄
dmu_object.c
(14.73 KB)
📄
dmu_objset.c
(79.38 KB)
📄
dmu_recv.c
(98.69 KB)
📄
dmu_redact.c
(37.09 KB)
📄
dmu_send.c
(95.51 KB)
📄
dmu_traverse.c
(21.98 KB)
📄
dmu_tx.c
(40.13 KB)
📄
dmu_zfetch.c
(13.56 KB)
📄
dnode.c
(71.32 KB)
📄
dnode_sync.c
(24.93 KB)
📄
dsl_bookmark.c
(51.22 KB)
📄
dsl_crypt.c
(78.06 KB)
📄
dsl_dataset.c
(141.61 KB)
📄
dsl_deadlist.c
(27.94 KB)
📄
dsl_deleg.c
(19.92 KB)
📄
dsl_destroy.c
(36.73 KB)
📄
dsl_dir.c
(65.45 KB)
📄
dsl_pool.c
(42.92 KB)
📄
dsl_prop.c
(32.88 KB)
📄
dsl_scan.c
(134.47 KB)
📄
dsl_synctask.c
(7.94 KB)
📄
dsl_userhold.c
(18.26 KB)
📄
edonr_zfs.c
(3.21 KB)
📄
fm.c
(39.75 KB)
📄
gzip.c
(2.57 KB)
📄
hkdf.c
(4.5 KB)
📄
lz4.c
(26.46 KB)
📄
lzjb.c
(3.85 KB)
📄
metaslab.c
(190.62 KB)
📄
mmp.c
(24.93 KB)
📄
multilist.c
(12.21 KB)
📄
objlist.c
(2.58 KB)
📄
pathname.c
(2.52 KB)
📄
range_tree.c
(24.9 KB)
📄
refcount.c
(7.82 KB)
📄
rrwlock.c
(10.82 KB)
📄
sa.c
(59.23 KB)
📄
sha256.c
(2.89 KB)
📄
skein_zfs.c
(2.92 KB)
📄
spa.c
(272.81 KB)
📄
spa_boot.c
(1.28 KB)
📄
spa_checkpoint.c
(21.54 KB)
📄
spa_config.c
(16.97 KB)
📄
spa_errlog.c
(11.35 KB)
📄
spa_history.c
(17.75 KB)
📄
spa_log_spacemap.c
(47.13 KB)
📄
spa_misc.c
(75.4 KB)
📄
spa_stats.c
(27.08 KB)
📄
space_map.c
(31.45 KB)
📄
space_reftree.c
(4.21 KB)
📄
txg.c
(27.49 KB)
📄
uberblock.c
(2.17 KB)
📄
unique.c
(2.53 KB)
📄
vdev.c
(143.91 KB)
📄
vdev_cache.c
(11.71 KB)
📄
vdev_draid.c
(96.86 KB)
📄
vdev_draid_rand.c
(1.16 KB)
📄
vdev_indirect.c
(60.83 KB)
📄
vdev_indirect_births.c
(5.88 KB)
📄
vdev_indirect_mapping.c
(18.06 KB)
📄
vdev_initialize.c
(22.38 KB)
📄
vdev_label.c
(57.52 KB)
📄
vdev_mirror.c
(26.76 KB)
📄
vdev_missing.c
(3.74 KB)
📄
vdev_queue.c
(37.61 KB)
📄
vdev_raidz.c
(76.09 KB)
📄
vdev_raidz_math.c
(17.18 KB)
📄
vdev_raidz_math_aarch64_neon.c
(112.13 KB)
📄
vdev_raidz_math_aarch64_neon_common.h
(23.64 KB)
📄
vdev_raidz_math_aarch64_neonx2.c
(5.39 KB)
📄
vdev_raidz_math_avx2.c
(10.64 KB)
📄
vdev_raidz_math_avx512bw.c
(10.93 KB)
📄
vdev_raidz_math_avx512f.c
(17.9 KB)
📄
vdev_raidz_math_impl.h
(34.78 KB)
📄
vdev_raidz_math_powerpc_altivec.c
(213.46 KB)
📄
vdev_raidz_math_powerpc_altivec_common.h
(22.62 KB)
📄
vdev_raidz_math_scalar.c
(9.54 KB)
📄
vdev_raidz_math_sse2.c
(25.84 KB)
📄
vdev_raidz_math_ssse3.c
(118 KB)
📄
vdev_rebuild.c
(34.65 KB)
📄
vdev_removal.c
(72.08 KB)
📄
vdev_root.c
(4.28 KB)
📄
vdev_trim.c
(50.92 KB)
📄
zap.c
(35.35 KB)
📄
zap_leaf.c
(22.75 KB)
📄
zap_micro.c
(42.18 KB)
📄
zcp.c
(42.29 KB)
📄
zcp_get.c
(21.01 KB)
📄
zcp_global.c
(1.9 KB)
📄
zcp_iter.c
(18.21 KB)
📄
zcp_set.c
(2.37 KB)
📄
zcp_synctask.c
(13.69 KB)
📄
zfeature.c
(17.6 KB)
📄
zfs_byteswap.c
(5.64 KB)
📄
zfs_fm.c
(40.58 KB)
📄
zfs_fuid.c
(19.69 KB)
📄
zfs_ioctl.c
(195.48 KB)
📄
zfs_log.c
(20.6 KB)
📄
zfs_onexit.c
(5.09 KB)
📄
zfs_quota.c
(12.93 KB)
📄
zfs_ratelimit.c
(2.35 KB)
📄
zfs_replay.c
(26.11 KB)
📄
zfs_rlock.c
(20.38 KB)
📄
zfs_sa.c
(13.09 KB)
📄
zfs_vnops.c
(22 KB)
📄
zil.c
(111.32 KB)
📄
zio.c
(144.72 KB)
📄
zio_checksum.c
(17.28 KB)
📄
zio_compress.c
(5.92 KB)
📄
zio_inject.c
(25.79 KB)
📄
zle.c
(2.52 KB)
📄
zrlock.c
(4.45 KB)
📄
zthr.c
(16.41 KB)
📄
zvol.c
(42.96 KB)
Editing: vdev_indirect_births.c
/* * CDDL HEADER START * * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. * * CDDL HEADER END */ /* * Copyright (c) 2015 by Delphix. All rights reserved. */ #include <sys/dmu_tx.h> #include <sys/spa.h> #include <sys/dmu.h> #include <sys/dsl_pool.h> #include <sys/vdev_indirect_births.h> #ifdef ZFS_DEBUG static boolean_t vdev_indirect_births_verify(vdev_indirect_births_t *vib) { ASSERT(vib != NULL); ASSERT(vib->vib_object != 0); ASSERT(vib->vib_objset != NULL); ASSERT(vib->vib_phys != NULL); ASSERT(vib->vib_dbuf != NULL); EQUIV(vib->vib_phys->vib_count > 0, vib->vib_entries != NULL); return (B_TRUE); } #endif uint64_t vdev_indirect_births_count(vdev_indirect_births_t *vib) { ASSERT(vdev_indirect_births_verify(vib)); return (vib->vib_phys->vib_count); } uint64_t vdev_indirect_births_object(vdev_indirect_births_t *vib) { ASSERT(vdev_indirect_births_verify(vib)); return (vib->vib_object); } static uint64_t vdev_indirect_births_size_impl(vdev_indirect_births_t *vib) { return (vib->vib_phys->vib_count * sizeof (*vib->vib_entries)); } void vdev_indirect_births_close(vdev_indirect_births_t *vib) { ASSERT(vdev_indirect_births_verify(vib)); if (vib->vib_phys->vib_count > 0) { uint64_t births_size = vdev_indirect_births_size_impl(vib); vmem_free(vib->vib_entries, births_size); vib->vib_entries = NULL; } dmu_buf_rele(vib->vib_dbuf, vib); vib->vib_objset = NULL; vib->vib_object = 0; vib->vib_dbuf = NULL; vib->vib_phys = NULL; kmem_free(vib, sizeof (*vib)); } uint64_t vdev_indirect_births_alloc(objset_t *os, dmu_tx_t *tx) { ASSERT(dmu_tx_is_syncing(tx)); return (dmu_object_alloc(os, DMU_OTN_UINT64_METADATA, SPA_OLD_MAXBLOCKSIZE, DMU_OTN_UINT64_METADATA, sizeof (vdev_indirect_birth_phys_t), tx)); } vdev_indirect_births_t * vdev_indirect_births_open(objset_t *os, uint64_t births_object) { vdev_indirect_births_t *vib = kmem_zalloc(sizeof (*vib), KM_SLEEP); vib->vib_objset = os; vib->vib_object = births_object; VERIFY0(dmu_bonus_hold(os, vib->vib_object, vib, &vib->vib_dbuf)); vib->vib_phys = vib->vib_dbuf->db_data; if (vib->vib_phys->vib_count > 0) { uint64_t births_size = vdev_indirect_births_size_impl(vib); vib->vib_entries = vmem_alloc(births_size, KM_SLEEP); VERIFY0(dmu_read(vib->vib_objset, vib->vib_object, 0, births_size, vib->vib_entries, DMU_READ_PREFETCH)); } ASSERT(vdev_indirect_births_verify(vib)); return (vib); } void vdev_indirect_births_free(objset_t *os, uint64_t object, dmu_tx_t *tx) { VERIFY0(dmu_object_free(os, object, tx)); } void vdev_indirect_births_add_entry(vdev_indirect_births_t *vib, uint64_t max_offset, uint64_t txg, dmu_tx_t *tx) { vdev_indirect_birth_entry_phys_t vibe; uint64_t old_size; uint64_t new_size; vdev_indirect_birth_entry_phys_t *new_entries; ASSERT(dmu_tx_is_syncing(tx)); ASSERT(dsl_pool_sync_context(dmu_tx_pool(tx))); ASSERT(vdev_indirect_births_verify(vib)); dmu_buf_will_dirty(vib->vib_dbuf, tx); vibe.vibe_offset = max_offset; vibe.vibe_phys_birth_txg = txg; old_size = vdev_indirect_births_size_impl(vib); dmu_write(vib->vib_objset, vib->vib_object, old_size, sizeof (vibe), &vibe, tx); vib->vib_phys->vib_count++; new_size = vdev_indirect_births_size_impl(vib); new_entries = vmem_alloc(new_size, KM_SLEEP); if (old_size > 0) { bcopy(vib->vib_entries, new_entries, old_size); vmem_free(vib->vib_entries, old_size); } new_entries[vib->vib_phys->vib_count - 1] = vibe; vib->vib_entries = new_entries; } uint64_t vdev_indirect_births_last_entry_txg(vdev_indirect_births_t *vib) { ASSERT(vdev_indirect_births_verify(vib)); ASSERT(vib->vib_phys->vib_count > 0); vdev_indirect_birth_entry_phys_t *last = &vib->vib_entries[vib->vib_phys->vib_count - 1]; return (last->vibe_phys_birth_txg); } /* * Return the txg in which the given range was copied (i.e. its physical * birth txg). The specified offset+asize must be contiguously mapped * (i.e. not a split block). * * The entries are sorted by increasing phys_birth, and also by increasing * offset. We find the specified offset by binary search. Note that we * can not use bsearch() because looking at each entry independently is * insufficient to find the correct entry. Each entry implicitly relies * on the previous entry: an entry indicates that the offsets from the * end of the previous entry to the end of this entry were written in the * specified txg. */ uint64_t vdev_indirect_births_physbirth(vdev_indirect_births_t *vib, uint64_t offset, uint64_t asize) { vdev_indirect_birth_entry_phys_t *base; vdev_indirect_birth_entry_phys_t *last; ASSERT(vdev_indirect_births_verify(vib)); ASSERT(vib->vib_phys->vib_count > 0); base = vib->vib_entries; last = base + vib->vib_phys->vib_count - 1; ASSERT3U(offset, <, last->vibe_offset); while (last >= base) { vdev_indirect_birth_entry_phys_t *p = base + ((last - base) / 2); if (offset >= p->vibe_offset) { base = p + 1; } else if (p == vib->vib_entries || offset >= (p - 1)->vibe_offset) { ASSERT3U(offset + asize, <=, p->vibe_offset); return (p->vibe_phys_birth_txg); } else { last = p - 1; } } ASSERT(!"offset not found"); return (-1); } #if defined(_KERNEL) EXPORT_SYMBOL(vdev_indirect_births_add_entry); EXPORT_SYMBOL(vdev_indirect_births_alloc); EXPORT_SYMBOL(vdev_indirect_births_close); EXPORT_SYMBOL(vdev_indirect_births_count); EXPORT_SYMBOL(vdev_indirect_births_free); EXPORT_SYMBOL(vdev_indirect_births_last_entry_txg); EXPORT_SYMBOL(vdev_indirect_births_object); EXPORT_SYMBOL(vdev_indirect_births_open); EXPORT_SYMBOL(vdev_indirect_births_physbirth); #endif
Upload File
Create Folder