#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <result.h>
#include <list.h>
#include "../hal/pcm_i.h"
#include "log_i.h"
Go to the source code of this file.
Classes | |
struct | m_phlog_base_nvmd_s |
struct | m_phlog_base_s |
Defines | |
#define | CHUNK_SIZE 64 |
Typedefs | |
typedef m_phlog_base_s | m_phlog_base_t |
typedef m_phlog_base_nvmd_s | m_phlog_base_nvmd_t |
Functions | |
m_result_t | m_phlog_base_format (pcm_storeset_t *set, m_phlog_base_nvmd_t *nvmd, pcm_word_t *nvphlog, int type) |
Formats the non-volatile physical log for reuse. | |
m_result_t | m_phlog_base_alloc (m_phlog_base_t **phlog_basep) |
Allocates a volatile log structure. | |
m_result_t | m_phlog_base_init (m_phlog_base_t *phlog, m_phlog_base_nvmd_t *nvmd, pcm_word_t *nvphlog) |
Initializes the volatile log descriptor using the non-volatile metadata referenced by log_dsc. | |
m_result_t | m_phlog_base_check_consistency (m_phlog_base_nvmd_t *nvmd, pcm_word_t *nvphlog, uint64_t *stable_tail) |
Check the consistency of the non-volatile log and find the consistent stable region starting from the head. | |
m_result_t | m_phlog_base_truncate_async (pcm_storeset_t *set, m_phlog_base_t *phlog) |
Truncates the log up to the read_index point. |
INVARIANTS:
1. Head and tail always advance by the number of buffer entries.
For example if cache-line size is 64 bytes and word is 64-bits, then the buffer has 8 entries to ensuere that there would always be a complete cacheline to write to the hardware WC buffer. Since buffer has 8 entries, we advance head and tail by 8 entries as well. In the case when we flush the log, the buffer might not be full. We still flush 8 entries even if the buffer is full and we advance tail by 8. This simplifies and makes bounds checking faster by requiring less conditions (less branches, no-memory fences).
2. todo: state the rest of the invariants
TERMINOLOGY:
Atomic log fragment: a region of the log guaranteed to be made persistent.
Definition in file phlog_base.h.