enum { /* The maximum configurable amount of memory */
UDS_MEMORY_CONFIG_MAX = 1024, /* Flag indicating that the index has one less chapter than usual */
UDS_MEMORY_CONFIG_REDUCED = 0x1000,
UDS_MEMORY_CONFIG_REDUCED_MAX = 1024 + UDS_MEMORY_CONFIG_REDUCED, /* Special values indicating sizes less than 1 GB */
UDS_MEMORY_CONFIG_256MB = -256,
UDS_MEMORY_CONFIG_512MB = -512,
UDS_MEMORY_CONFIG_768MB = -768,
UDS_MEMORY_CONFIG_REDUCED_256MB = -1280,
UDS_MEMORY_CONFIG_REDUCED_512MB = -1536,
UDS_MEMORY_CONFIG_REDUCED_768MB = -1792,
};
struct uds_parameters { /* The block_device used for storage */ struct block_device *bdev; /* The maximum allowable size of the index on storage */
size_t size; /* The offset where the index should start */
off_t offset; /* The maximum memory allocation, in GB */
uds_memory_config_size_t memory_size; /* Whether the index should include sparse chapters */ bool sparse; /* A 64-bit nonce to validate the index */
u64 nonce; /* The number of threads used to process index requests */ unsignedint zone_count; /* The number of threads used to read volume pages */ unsignedint read_threads;
};
/* *Thesestatisticscapturecharacteristicsofthecurrentindex,includingresourceusageand *requestsprocessedsincetheindexwasopened.
*/ struct uds_index_stats { /* The total number of records stored in the index */
u64 entries_indexed; /* An estimate of the index's memory usage, in bytes */
u64 memory_used; /* The number of collisions recorded in the volume index */
u64 collisions; /* The number of entries discarded from the index since startup */
u64 entries_discarded; /* The time at which these statistics were fetched */
s64 current_time; /* The number of post calls that found an existing entry */
u64 posts_found; /* The number of post calls that added an entry */
u64 posts_not_found; /* *Thenumberofpostcallsthatfoundanexistingentrythatiscurrentenoughtoonly *existinmemoryandnothavebeencommittedtodiskyet
*/
u64 in_memory_posts_found; /* *Thenumberofpostcallsthatfoundanexistingentryinthedenseportionoftheindex
*/
u64 dense_posts_found; /* *Thenumberofpostcallsthatfoundanexistingentryinthesparseportionoftheindex
*/
u64 sparse_posts_found; /* The number of update calls that updated an existing entry */
u64 updates_found; /* The number of update calls that added a new entry */
u64 updates_not_found; /* The number of delete requests that deleted an existing entry */
u64 deletions_found; /* The number of delete requests that did nothing */
u64 deletions_not_found; /* The number of query calls that found existing entry */
u64 queries_found; /* The number of query calls that did not find an entry */
u64 queries_not_found; /* The total number of requests processed */
u64 requests;
};
enum uds_index_region { /* No location information has been determined */
UDS_LOCATION_UNKNOWN = 0, /* The index page entry has been found */
UDS_LOCATION_INDEX_PAGE_LOOKUP, /* The record page entry has been found */
UDS_LOCATION_RECORD_PAGE_LOOKUP, /* The record is not in the index */
UDS_LOCATION_UNAVAILABLE, /* The record was found in the open chapter */
UDS_LOCATION_IN_OPEN_CHAPTER, /* The record was found in the dense part of the index */
UDS_LOCATION_IN_DENSE, /* The record was found in the sparse part of the index */
UDS_LOCATION_IN_SPARSE,
} __packed;
/* Zone message requests are used to communicate between index zones. */ enum uds_zone_message_type { /* A standard request with no message */
UDS_MESSAGE_NONE = 0, /* Add a chapter to the sparse chapter index cache */
UDS_MESSAGE_SPARSE_CACHE_BARRIER, /* Close a chapter to keep the zone from falling behind */
UDS_MESSAGE_ANNOUNCE_CHAPTER_CLOSED,
} __packed;
struct uds_zone_message { /* The type of message, determining how it will be processed */ enum uds_zone_message_type type; /* The virtual chapter number to which the message applies */
u64 virtual_chapter;
} __packed;
/* Once this callback has been invoked, the uds_request structure can be reused or freed. */ typedefvoid (*uds_request_callback_fn)(struct uds_request *request);
struct uds_request { /* These input fields must be set before launching a request. */
/* The name of the record to look up or create */ struct uds_record_name record_name; /* New data to associate with the record name, if applicable */ struct uds_record_data new_metadata; /* A callback to invoke when the request is complete */
uds_request_callback_fn callback; /* The index session that will manage this request */ struct uds_index_session *session; /* The type of operation to perform, as describe above */ enum uds_request_type type;
/* These output fields are set when a request is complete. */
/* The existing data associated with the request name, if any */ struct uds_record_data old_metadata; /* True if the record name had an existing entry in the index */ bool found; /* Either UDS_SUCCESS or an error code for the request */ int status;
/* The remaining fields are used internally and should not be altered by clients. */
struct_group(internal, /* The virtual chapter containing the record name, if known */
u64 virtual_chapter; /* The region of the index containing the record name */ enum uds_index_region location; /* If true, process request immediately by waking the worker thread */ bool unbatched; /* If true, continue this request before processing newer requests */ bool requeued; /* Control message for coordinating between zones */ struct uds_zone_message zone_message; /* The number of the zone which will process this request*/ unsignedint zone_number; /* A link for adding a request to a lock-free queue */ struct funnel_queue_entry queue_link; /* A link for adding a request to a standard linked list */ struct uds_request *next_request; /* A pointer to the index processing this request */ struct uds_index *index;
);
};
/* A session is required for most index operations. */ int __must_check uds_create_index_session(struct uds_index_session **session);
/* Destroying an index session also closes and saves the associated index. */ int uds_destroy_index_session(struct uds_index_session *session);
/* Wait until all outstanding index operations are complete. */ int __must_check uds_flush_index_session(struct uds_index_session *session);
/* Close an index. This operation fails if the index session is suspended. */ int __must_check uds_close_index(struct uds_index_session *session);
/* Get index statistics since the last time the index was opened. */ int __must_check uds_get_index_session_stats(struct uds_index_session *session, struct uds_index_stats *stats);
/* This function will fail if any required field of the request is not set. */ int __must_check uds_launch_request(struct uds_request *request);
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.