/* bits for the extent_map::flags field */ enum { /* this entry not yet on disk, don't free it */
ENUM_BIT(EXTENT_FLAG_PINNED),
ENUM_BIT(EXTENT_FLAG_COMPRESS_ZLIB),
ENUM_BIT(EXTENT_FLAG_COMPRESS_LZO),
ENUM_BIT(EXTENT_FLAG_COMPRESS_ZSTD), /* pre-allocated extent */
ENUM_BIT(EXTENT_FLAG_PREALLOC), /* Logging this extent */
ENUM_BIT(EXTENT_FLAG_LOGGING), /* This em is merged from two or more physically adjacent ems */
ENUM_BIT(EXTENT_FLAG_MERGED),
};
/* * This structure represents file extents and holes. * * Unlike on-disk file extent items, extent maps can be merged to save memory. * This means members only match file extent items before any merging. * * Keep this structure as compact as possible, as we can have really large * amounts of allocated extent maps at any time.
*/ struct extent_map { struct rb_node rb_node;
/* All of these are in bytes. */
/* File offset matching the offset of a BTRFS_EXTENT_ITEM_KEY key. */
u64 start;
/* * Length of the file extent. * * For non-inlined file extents it's btrfs_file_extent_item::num_bytes. * For inline extents it's sectorsize, since inline data starts at * offsetof(struct btrfs_file_extent_item, disk_bytenr) thus * btrfs_file_extent_item::num_bytes is not valid.
*/
u64 len;
/* * The bytenr of the full on-disk extent. * * For regular extents it's btrfs_file_extent_item::disk_bytenr. * For holes it's EXTENT_MAP_HOLE and for inline extents it's * EXTENT_MAP_INLINE.
*/
u64 disk_bytenr;
/* * The full on-disk extent length, matching * btrfs_file_extent_item::disk_num_bytes.
*/
u64 disk_num_bytes;
/* * Offset inside the decompressed extent. * * For regular extents it's btrfs_file_extent_item::offset. * For holes and inline extents it's 0.
*/
u64 offset;
/* * The decompressed size of the whole on-disk extent, matching * btrfs_file_extent_item::ram_bytes.
*/
u64 ram_bytes;
/* * Generation of the extent map, for merged em it's the highest * generation of all merged ems. * For non-merged extents, it's from btrfs_file_extent_item::generation.
*/
u64 generation;
u32 flags;
refcount_t refs; struct list_head list;
};
if (em->flags & EXTENT_FLAG_COMPRESS_LZO) return BTRFS_COMPRESS_LZO;
if (em->flags & EXTENT_FLAG_COMPRESS_ZSTD) return BTRFS_COMPRESS_ZSTD;
return BTRFS_COMPRESS_NONE;
}
/* * More efficient way to determine if extent is compressed, instead of using * 'extent_map_compression() != BTRFS_COMPRESS_NONE'.
*/ staticinlinebool btrfs_extent_map_is_compressed(conststruct extent_map *em)
{ return (em->flags & (EXTENT_FLAG_COMPRESS_ZLIB |
EXTENT_FLAG_COMPRESS_LZO |
EXTENT_FLAG_COMPRESS_ZSTD)) != 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.