Lines Matching full:index
6 #include "index-session.h"
15 #include "index.h"
16 #include "index-layout.h"
19 * The index session contains a lock (the request_mutex) which ensures that only one thread can
20 * change the state of its index at a time. The state field indicates the current state of the
21 * index through a set of descriptive flags. The request_mutex must be notified whenever a
23 * requests currently in progress so that they can be drained when suspending or closing the index.
25 * If the index session is suspended shortly after opening an index, it may have to suspend during
26 * a rebuild. Depending on the size of the index, a rebuild may take a significant amount of time,
28 * the index session is resumed, the rebuild can continue from where it left off. If the index
30 * will start from the beginning the next time the index is loaded. The mutex and status fields in
36 /* The session has started loading an index but not completed it. */
38 /* The session has loaded an index, which can handle requests. */
40 /* The session's index has been permanently disabled. */
42 /* The session's index is suspended. */
44 /* The session is handling some index state change. */
46 /* The session's index is closing and draining requests. */
62 /* Release a reference to an index session. */
72 * Acquire a reference to the index session for an asynchronous index request. The reference must
131 request->index = request->session->index; in uds_launch_request()
256 vdo_log_info("Index session is suspended"); in start_loading_index_session()
259 vdo_log_info("Index is already loaded"); in start_loading_index_session()
295 enter_callback_stage, &index_session->index); in initialize_index_session()
297 vdo_log_error_strerror(result, "Failed to make index"); in initialize_index_session()
309 return "creating index"; in get_open_type_string()
311 return "loading or rebuilding index"; in get_open_type_string()
313 return "loading index"; in get_open_type_string()
320 * Open an index under the given session. This operation will fail if the
321 * index session is suspended, or if there is already an open index.
373 return uds_save_index(index_session->index); in save_index()
383 /* Wait until the index indicates that it is not replaying. */ in suspend_rebuild()
393 /* Index load does not need to be suspended. */ in suspend_rebuild()
409 * Suspend index operation, draining all current index requests and preventing new index requests
410 * from starting. Optionally saves all index data before returning.
418 /* Wait for any current index state change to complete. */ in uds_suspend_index_session()
425 vdo_log_info("Index session is already changing state"); in uds_suspend_index_session()
463 result = uds_replace_index_storage(session->index, bdev); in replace_device()
472 * Resume index operation after being suspended. If the index is suspended and the supplied block
473 * device differs from the current backing store, the index will start using the new backing store.
484 vdo_log_info("Index session is already changing state"); in uds_resume_index_session()
501 if ((session->index != NULL) && (bdev != session->parameters.bdev)) { in uds_resume_index_session()
517 /* Notify the index to start replaying again. */ in uds_resume_index_session()
522 /* There is no index rebuild to resume. */ in uds_resume_index_session()
549 struct uds_index *index = index_session->index; in save_and_free_index() local
551 if (index == NULL) in save_and_free_index()
559 result = uds_save_index(index); in save_and_free_index()
564 uds_free_index(index); in save_and_free_index()
565 index_session->index = NULL; in save_and_free_index()
568 * Reset all index state that happens to be in the index in save_and_free_index()
569 * session, so it doesn't affect any future index. in save_and_free_index()
583 /* Save and close the current index. */
588 /* Wait for any current index state change to complete. */ in uds_close_index()
597 vdo_log_info("Index session is suspended"); in uds_close_index()
601 /* The index doesn't exist, hasn't finished loading, or is being destroyed. */ in uds_close_index()
610 vdo_log_debug("Closing index"); in uds_close_index()
613 vdo_log_debug("Closed index"); in uds_close_index()
622 /* This will save and close an open index before destroying the session. */
628 vdo_log_debug("Destroying index session"); in uds_destroy_index_session()
630 /* Wait for any current index state change to complete. */ in uds_destroy_index_session()
640 vdo_log_info("Index session is already closing"); in uds_destroy_index_session()
650 /* Tell the index to terminate the rebuild. */ in uds_destroy_index_session()
671 vdo_log_debug("Destroyed index session"); in uds_destroy_index_session()
676 /* Wait until all callbacks for index operations are complete. */
680 uds_wait_for_idle_index(index_session->index); in uds_flush_index_session()
709 vdo_log_error("received a NULL index stats pointer"); in uds_get_index_session_stats()
714 if (index_session->index != NULL) { in uds_get_index_session_stats()
715 uds_get_index_stats(index_session->index, stats); in uds_get_index_session_stats()