/* *btrfs_pathsrememberthepathtakenfromtherootdowntotheleaf. *level0isalwaystheleaf,andnodes[1...BTRFS_MAX_LEVEL]willpoint *toanyotherlevelsthatarepresent. * *Theslotsarrayrecordstheindexoftheitemorblockpointer *usedwhilewalkingthetree.
*/ struct btrfs_path { struct extent_buffer *nodes[BTRFS_MAX_LEVEL]; int slots[BTRFS_MAX_LEVEL]; /* if there is real range locking, this locks field will change */
u8 locks[BTRFS_MAX_LEVEL];
u8 reada;
u8 lowest_level;
/* *setbybtrfs_split_item,tellssearch_slottokeepalllocks *andtoforcecallstokeepspaceinthenodes
*/ unsignedint search_for_split:1; /* Keep some upper locks as we walk down. */ unsignedint keep_locks:1; unsignedint skip_locking:1; unsignedint search_commit_root:1; unsignedint need_commit_sem:1; unsignedint skip_release_on_error:1; /* *Indicatethatnewitem(btrfs_search_slot)isextendingalready *existingitemandins_lencontainsonlythedatasizeandnotitem *header(ie.sizeof(structbtrfs_item)isnotincluded).
*/ unsignedint search_for_extension:1; /* Stop search if any locks need to be taken (for read) */ unsignedint nowait:1;
};
/* *Reloctreeisorphan,onlykepthereforqgroupdelayedsubtreescan * *Setforthesubvolumetreeowningthereloctree.
*/
BTRFS_ROOT_DEAD_RELOC_TREE, /* Mark dead root stored on device whose cleanup needs to be resumed */
BTRFS_ROOT_DEAD_TREE, /* The root has a log tree. Used for subvolume roots and the tree root. */
BTRFS_ROOT_HAS_LOG_TREE, /* Qgroup flushing is in progress */
BTRFS_ROOT_QGROUP_FLUSHING, /* We started the orphan cleanup for this root. */
BTRFS_ROOT_ORPHAN_CLEANUP, /* This root has a drop operation that was started previously. */
BTRFS_ROOT_UNFINISHED_DROP, /* This reloc root needs to have its buffers lockdep class reset. */
BTRFS_ROOT_RESET_LOCKDEP_CLASS,
};
struct mutex log_mutex;
wait_queue_head_t log_writer_wait;
wait_queue_head_t log_commit_wait[2]; struct list_head log_ctxs[2]; /* Used only for log trees of subvolumes, not for the log root tree */
atomic_t log_writers;
atomic_t log_commit[2]; /* Used only for log trees of subvolumes, not for the log root tree */
atomic_t log_batch; /* *Protectedbythe'log_mutex'lockbutcanbereadwithoutholding *thatlocktoavoidunnecessarylockcontention,inwhichcaseit *shouldbereadusingbtrfs_get_root_log_transid()exceptifit'sa *logtreeinwhichcaseitcanbedirectlyaccessed.Updatestothis *fieldshouldalwaysusebtrfs_set_root_log_transid(),exceptforlog *treeswherethefieldcanbeupdateddirectly.
*/ int log_transid; /* No matter the commit succeeds or not*/ int log_transid_committed; /* *Justbeupdatedwhenthecommitsucceeds.Use *btrfs_get_root_last_log_commit()andbtrfs_set_root_last_log_commit() *toaccessthisfield.
*/ int last_log_commit;
pid_t log_start_pid;
staticinlinebool btrfs_root_readonly(conststruct btrfs_root *root)
{ /* Byte-swap the constant at compile time, root_item::flags is LE */ return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_RDONLY)) != 0;
}
staticinlinebool btrfs_root_dead(conststruct btrfs_root *root)
{ /* Byte-swap the constant at compile time, root_item::flags is LE */ return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_DEAD)) != 0;
}
/* *Structurethatconveysinformationaboutanextentthatisgoingtoreplace *alltheextentsinafilerange.
*/ struct btrfs_replace_extent_info {
u64 disk_offset;
u64 disk_len;
u64 data_offset;
u64 data_len;
u64 file_offset; /* Pointer to a file extent item of type regular or prealloc. */ char *extent_buf; /* *Settotruewhenattemptingtoreplaceafilerangewithanewextent *describedbythisstructure,settofalsewhenattemptingtoclonean *existingextentintoafilerange.
*/ bool is_new_extent; /* Indicate if we should update the inode's mtime and ctime. */ bool update_times; /* Meaningful only if is_new_extent is true. */ int qgroup_reserved; /* *Meaningfulonlyifis_new_extentistrue. *Usedtotrackhowmanyextentitemswehavealreadyinsertedina *subvolumetreethatrefertotheextentdescribedbythisstructure, *sothatweknowwhentocreateanewdelayedreforupdateanexisting *one.
*/ int insertions;
};
/* *IfNULL,btrfs_drop_extents()willallocateandfreeitsownpath. *If'replace_extent'istrue,thismustnotbeNULL.Alsothepath *isalwaysreleasedexceptif'replace_extent'istrueand *btrfs_drop_extents()sets'extent_inserted'totrue,inwhichcase *thepathiskeptlocked.
*/ struct btrfs_path *path; /* Start offset of the range to drop extents from */
u64 start; /* End (exclusive, last byte + 1) of the range to drop extents from */
u64 end; /* If true drop all the extent maps in the range */ bool drop_cache; /* *Iftrueitmeanswewanttoinsertanewextentafterdroppingall *theextentsintherange.Ifthisistrue,the'extent_item_size' *parametermustbesetaswellandthe'extent_inserted'fieldwill *besettotruebybtrfs_drop_extents()ifitcouldinsertthenew *extent. *Note:whenthisissettotruethepathmustnotbeNULL.
*/ bool replace_extent; /* *Usedif'replace_extent'istrue.Sizeofthefileextentitemto *insertafterdroppingallexistingextentsintherange
*/
u32 extent_item_size;
/* *Describesabatchofitemstoinsertinabtree.Thisisusedby *btrfs_insert_empty_items().
*/ struct btrfs_item_batch { /* *Pointertoanarraycontainingthekeysoftheitemstoinsert(in *sortedorder).
*/ conststruct btrfs_key *keys; /* Pointer to an array containing the data size for each item to insert. */ const u32 *data_sizes; /* *Thesumofdatasizesforallitems.Thecallercancomputethiswhile *settingupthedata_sizesarray,soitendsupbeingmoreefficient *thanhavingbtrfs_insert_empty_items()orsetup_item_for_insert() *doingit,asitwouldavoidanextraloopoverapotentiallylarge *array,andinthecaseofsetup_item_for_insert(),wewouldbedoing *itwhileholdingawritelockonaleafandoftenonupperlevelnodes *too,unnecessarilyincreasingthesizeofacriticalsection.
*/
u32 total_data_size; /* Size of the keys and data_sizes arrays (number of items in the batch). */ int nr;
};
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.