Lines Matching +full:512 +full:- +full:bytes

1 /*-
2 * Copyright (c) 2011-2018 The DragonFly Project. All rights reserved.
44 * dmsg_hdr must be 64 bytes
57 uint32_t aux_bytes; /* 28 auxiliary data length (bytes) */
68 * The structures below represent the on-disk media structures for the HAMMER2
69 * filesystem. Note that all fields for on-disk structures are naturally
70 * aligned. The host endian format is typically used - compatibility is
77 * references utilize 64-bit byte offsets.
91 * fragments might be supported in the future (down to 64 bytes is possible),
94 * A full indirect block use supports 512 x 128-byte blockrefs in a 64KB
98 * A maximally sized file (2^64-1 bytes) requires ~6 indirect block levels
99 * using 64KB indirect blocks (128 byte refs, 512 or radix 9 per indblk).
114 * MINALLOCSIZE - The minimum allocation size. This can be smaller
120 * MINIOSIZE - The minimum IO size. This must be less than
123 * HAMMER2_LBUFSIZE - Nominal buffer size for I/O rollups.
125 * HAMMER2_PBUFSIZE - Topological block size used by files for all
128 * HAMMER2_SEGSIZE - Allocation map segment size, typically 4MB
135 #define HAMMER2_PBUFRADIX 16 /* physical buf (1<<16) bytes */
137 #define HAMMER2_LBUFRADIX 14 /* logical buf (1<<14) bytes */
158 * In HAMMER2, arrays of blockrefs are fully set-associative, meaning that
163 * Inodes embed either 512 bytes of direct data or an array of 4 blockrefs,
164 * resulting in highly efficient storage for files <= 512 bytes and for files
165 * <= 512KB. Up to 4 directory entries can be referenced from a directory
173 #define HAMMER2_EMBEDDED_BYTES 512 /* inode blockset/dd size */
176 #define HAMMER2_PBUFMASK (HAMMER2_PBUFSIZE - 1)
177 #define HAMMER2_LBUFMASK (HAMMER2_LBUFSIZE - 1)
178 #define HAMMER2_SEGMASK (HAMMER2_SEGSIZE - 1)
186 #define HAMMER2_UUID_STRING "5cbb9ad1-862d-11dc-a94d-01301bb8a9f5"
251 * The freemap utilizes blocks #1-40 in 8 sets of 5 blocks. Each block in
267 * and has a 512 bit bitmap, using 2 bits to represent a 16KB chunk of
277 * track of sub-allocations in memory, which means that on a unmount or reboot
287 * sub-directory trees can be deleted simply by deleting the directory inode
303 #define HAMMER2_VOLUME_ALIGNMASK (HAMMER2_VOLUME_ALIGN - 1)
308 #define HAMMER2_NEWFS_ALIGNMASK (HAMMER2_VOLUME_ALIGN - 1)
312 #define HAMMER2_ZONE_MASK64 (HAMMER2_ZONE_BYTES64 - 1)
328 #define HAMMER2_ZONE_FREEMAP_END 41 /* (non-inclusive) */
353 #define HAMMER2_ZONE_END 64 /* non-inclusive */
355 #define HAMMER2_NFREEMAPS 8 /* FREEMAP_00 - FREEMAP_07 */
366 * Freemap radix. Assumes a set-count of 4, 128-byte blockrefs,
369 * Leaf entry represents 4MB of storage broken down into a 512-bit
370 * bitmap, 2-bits per entry. So course bitmap item represents 16KB.
373 #error "hammer2_disk.h - freemap assumes SET_COUNT is 4"
381 #define HAMMER2_FREEMAP_LEVEL0_RADIX 22 /* 4MB (128by in l-1 leaf) */
383 #define HAMMER2_FREEMAP_LEVELN_PSIZE 32768 /* physical bytes */
398 #define HAMMER2_FREEMAP_LEVEL5_MASK (HAMMER2_FREEMAP_LEVEL5_SIZE - 1)
399 #define HAMMER2_FREEMAP_LEVEL4_MASK (HAMMER2_FREEMAP_LEVEL4_SIZE - 1)
400 #define HAMMER2_FREEMAP_LEVEL3_MASK (HAMMER2_FREEMAP_LEVEL3_SIZE - 1)
401 #define HAMMER2_FREEMAP_LEVEL2_MASK (HAMMER2_FREEMAP_LEVEL2_SIZE - 1)
402 #define HAMMER2_FREEMAP_LEVEL1_MASK (HAMMER2_FREEMAP_LEVEL1_SIZE - 1)
403 #define HAMMER2_FREEMAP_LEVEL0_MASK (HAMMER2_FREEMAP_LEVEL0_SIZE - 1)
414 #define H2FMBASE(key, radix) ((key) & ~(((hammer2_off_t)1 << (radix)) - 1))
421 #define HAMMER2_FREEMAP_BLOCK_MASK (HAMMER2_FREEMAP_BLOCK_SIZE - 1)
426 * 8 x 64-bit elements, 2 bits per block.
428 * representing INDEX_SIZE bytes worth of storage per element.
433 #define HAMMER2_BMAP_ALLONES ((hammer2_bitmap_t)-1)
441 #define HAMMER2_BMAP_INDEX_MASK (HAMMER2_BMAP_INDEX_SIZE - 1)
445 #define HAMMER2_BMAP_MASK (HAMMER2_BMAP_SIZE - 1)
451 * at the volume header (but can be self-CRCd internally, depending).
462 * Most HAMMER2 types are implemented as unsigned 64-bit integers.
465 * We utilize 32-bit iSCSI CRCs.
488 * Indexes into physical buffers are always 64-byte aligned. The low 6 bits
500 #define HAMMER2_OFF_BAD ((hammer2_off_t)-1)
508 * HAMMER2 directory support and pre-defined keys
524 * All HAMMER2 directories directly under the super-root on your local
536 * PFSID of the directory in the super-root that you specified. The local
546 * WARNING! This structure must be exactly 128 bytes long for its config
550 uint8_t copyid; /* 00 copyid 0-255 (must match slot) */
554 uint16_t flags; /* 04-05 flags field */
556 uint8_t priority; /* 07 priority and round-robin flag */
558 uint8_t reserved08[23]; /* 09-1F */
559 uuid_t pfs_clid; /* 20-2F copy target must match this uuid */
560 uint8_t label[16]; /* 30-3F import/export label */
561 uint8_t path[64]; /* 40-7F target specification string or key */
568 #define DMSG_VOLF_CONN_RR 0x80 /* round-robin at same priority */
570 #define DMSG_VOLF_CONN_PRI 0x0F /* select priority 0-15 (15=best) */
586 #define H2_LNK_VOLCONF(msg) ((dmsg_lnk_hammer2_volconf_t *)(msg)->any.buf)
589 * HAMMER2 directory entry header (embedded in blockref) exactly 16 bytes
603 * media topology recursion. This 128-byte data structure is embedded in the
615 * The check code can be a simple 32-bit iscsi code, a 64-bit crc, or as
616 * complex as a 512 bit cryptographic hash. I originally used a 64-byte
617 * blockref but later expanded it to 128 bytes to be able to support the
621 * a maximally-sized check code unverified dedup should only be used in
624 * Unverified dedup is deduping based on meta-data only without verifying
626 * integrity but is a far more I/O-expensive operation.
628 * --
630 * mirror_tid - per cluster node modified (propagated upward by flush)
631 * modify_tid - clc record modified (not propagated).
632 * update_tid - clc record updated (propagated upward on verification)
634 * CLC - Stands for 'Cluster Level Change', identifiers which are identical
639 * ((key) + (1LL << keybits) - 1). HAMMER2 usually populates
640 * blocks bottom-up, inserting a new root when radix expansion
643 * leaf_count - Helps manage leaf collapse calculations when indirect
659 * CONTENT ADDRESSABLE INDEXING (future) - Using a 256 or 512-bit check code.
661 struct hammer2_blockref { /* MUST BE EXACTLY 64 BYTES */
666 uint8_t vradix; /* virtual data/meta-data size */
680 * NOTE: check.buf contains filename if <= 64 bytes. Longer
725 * bigmask - Radixes available for allocation (0-31).
728 * 10-16 are used (i.e. (1<<10) through (1<<16)).
730 * avail - Total available space remaining, in bytes
735 uint64_t avail; /* total available bytes */
743 #define HAMMER2_BLOCKREF_BYTES 128 /* blockref struct in bytes */
749 * On-media and off-media blockref types.
751 * types >= 128 are pseudo values that should never be present on-media.
760 #define HAMMER2_BREF_TYPE_FREEMAP 254 /* pseudo-type */
761 #define HAMMER2_BREF_TYPE_VOLUME 255 /* pseudo-type */
785 /* user-specifiable check modes only */
792 * ipdata->meta.check_algo and ipdata->meta.comp_algo.
812 #define HAMMER2_METH_DEFAULT -1
830 * set. This is a top-down approach in that indirect blocks are not created
836 * are also treated as fully set-associative.
858 * hammer2_bmap_data - A freemap entry in the LEVEL1 block.
860 * Each 128-byte entry contains the bitmap and meta-data required to manage
867 * (data structure must be 128 bytes exactly)
869 * linear - A BYTE linear allocation offset used for sub-16KB allocations
871 * if 16KB-aligned (i.e. force bitmap scan), otherwise may be
872 * used to sub-allocate within the 16KB block (which is already
875 * Sub-allocations need only be 1KB-aligned and do not have to be
876 * size-aligned, and 16KB or larger allocations do not update this
880 * other issues such as buffer cache direct-mapping and the
884 * class - Clustering class. Cleared to 0 only if the entire leaf becomes
892 * bitmap - Two bits per 16KB allocation block arranged in arrays of
893 * 64-bit elements, 256x2 bits representing ~4MB worth of media
902 int32_t linear; /* 00 linear sub-granular allocation offset */
903 uint16_t class; /* 04-05 clustering class ((type<<8)|radix) */
912 uint32_t reserved20[8]; /* 20-3F 256 bits manages 128K/1KB/2-bits */
913 /* 40-7F 512 bits manages 4MB of storage */
929 * The inode is 1024 bytes, made up of 256 bytes of meta-data, 256 bytes
930 * for the filename, and 512 bytes worth of direct file data OR an embedded
931 * blockset. The in-memory hammer2_inode structure contains only the mostly-
932 * node-independent meta-data portion (some flags are node-specific and will
933 * not be synchronized). The rest of the inode is node-specific and chain I/O
938 * blockrefs, in turn, are indexed by the 64-bit directory hash key. Remember
942 * Up to 512 bytes of direct data can be embedded in an inode, and since
948 * recorded on a blockref-by-blockref basis.
963 #define HAMMER2_INODE_MAXNAME 256 /* maximum name in bytes */
971 uint8_t pfs_subtype; /* 0003 pfs sub-type */
1011 * NOTE: We can't use {volume_data->fsid, pfs_clid} to uniquely
1019 uint8_t pfs_nmasters; /* 0086 (if PFSROOT) if multi-master */
1026 * Quotas and aggregate sub-tree inode and data counters. Note that
1028 * the sysop and in-memory structures keep track of inheritance.
1030 hammer2_key_t data_quota; /* 00B0 subtree quota in bytes */
1039 * in place instead of copy-on-write).
1045 * Tracks (possibly degenerate) free areas covering all sub-tree
1047 * 0/0 indicates empty entry. fully set-associative.
1058 hammer2_inode_meta_t meta; /* 0000-00FF */
1060 /* 0100-01FF (256 char, unterminated) */
1061 union { /* 0200-03FF (64x8 = 512 bytes) */
1085 #define HAMMER2_COPYID_LOCAL ((uint8_t)-1)
1143 * on-media, but defined here because the field may be used in dmsgs.
1155 * Flags (8 bits) - blockref, for freemap only
1159 * chunk size down to 256 bytes and if so we will need bits 8 and 9.
1178 * we want to try to fit all nominal filesystem updates in a 512-byte section
1187 * A read-write mount may have to recover missing allocations by doing an
1192 * Read-only mounts do not need to do any recovery, access to the filesystem
1206 * NOTE: root_blockref points to the super-root directory, not the root
1208 * super-root.
1210 * The super-root directory contains all root directories and all
1212 * null-mount of the super-root using special path constructions
1217 * preferred over creating discrete PFSs in the super-root. Instead
1218 * the super-root is most typically used to create writable snapshots,
1219 * alternative roots, and so forth. The super-root is also used by
1227 * sector #0 - 512 bytes
1231 hammer2_off_t boot_end; /* 0010 (size = end - beg) */
1233 hammer2_off_t aux_end; /* 0020 (size = end - beg) */
1234 hammer2_off_t volu_size; /* 0028 Volume size, bytes */
1251 * Initial non-reserved-area allocations do not use the freemap
1262 * block device regardless of whether it is to the super-root
1273 hammer2_tid_t reserved00A0[5]; /* 00A0-00C7 */
1282 uint32_t copyexists[8]; /* 00C8-00E7 copy exists bmap */
1283 char reserved0140[248]; /* 00E8-01DF */
1286 * 32 bit CRC array at the end of the first 512 byte sector.
1288 * icrc_sects[7] - First 512-4 bytes of volume header (including all
1291 * icrc_sects[6] - Sector 1 (512 bytes) of volume header, which is
1294 * icrc_sects[5] - Sector 2
1295 * icrc_sects[4] - Sector 3
1296 * icrc_sects[3] - Sector 4 (the freemap blockset)
1298 hammer2_crc32_t icrc_sects[8]; /* 01E0-01FF */
1301 * sector #1 - 512 bytes
1305 hammer2_blockset_t sroot_blockset; /* 0200-03FF Superroot dir */
1308 * sector #2-7
1310 char sector2[512]; /* 0400-05FF reserved */
1311 char sector3[512]; /* 0600-07FF reserved */
1312 hammer2_blockset_t freemap_blockset; /* 0800-09FF freemap */
1313 char sector5[512]; /* 0A00-0BFF reserved */
1314 char sector6[512]; /* 0C00-0DFF reserved */
1315 char sector7[512]; /* 0E00-0FFF reserved */
1318 * sector #8-71 - 32768 bytes
1329 /* 1000-8FFF copyinfo config */
1335 char reserved0400[0x6FFC]; /* 9000-FFFB reserved */
1340 hammer2_crc32_t icrc_volheader; /* FFFC-FFFF full volume icrc*/
1348 * The first 512 bytes has its own iCRC stored at the end of the 512 bytes
1351 * The second 512 bytes also has its own iCRC but it is stored in the first
1352 * 512 bytes so it covers the entire second 512 bytes.
1354 * The whole volume block (64KB) has an iCRC covering all but the last 4 bytes,
1356 * a catch-all for anything not individually iCRCd.
1364 #define HAMMER2_VOLUME_ICRC1_OFF 512
1367 #define HAMMER2_VOLUME_ICRC0_SIZE (512 - 4)
1368 #define HAMMER2_VOLUME_ICRC1_SIZE (512)
1369 #define HAMMER2_VOLUME_ICRCVH_SIZE (65536 - 4)