usermode/library/mcore/src/log/log_i.h File Reference

The interface to the log manager. More...

#include <stdio.h>
#include <pthread.h>
#include <stdint.h>
#include <result.h>
#include <list.h>
#include "hrtime.h"
#include "../hal/pcm_i.h"

Go to the source code of this file.

Classes

struct  m_log_ops_s
struct  m_log_nvmd_s
struct  m_log_dsc_s
struct  m_logmgr_s

Defines

#define PHYSICAL_LOG_NUM_ENTRIES_LOG2   20
#define PHYSICAL_LOG_NUM_ENTRIES   (1 << PHYSICAL_LOG_NUM_ENTRIES_LOG2)
#define PHYSICAL_LOG_SIZE   (PHYSICAL_LOG_NUM_ENTRIES * sizeof(pcm_word_t))
#define LF_FLAGS_MASK   0xFFFFFFFFFFFF0000LLU
#define LF_TYPE_MASK   0x000000000000FFFFLLU
#define LF_DIRTY   0x8000000000000000
#define INV_LOG_ORDER   0xFFFFFFFFFFFFFFFF
#define LF_ASYNC_TRUNCATION   0x0000000000000001
#define PHLOG_WRITE(logtype, set, phlog, val)
#define PHLOG_FLUSH(logtype, set, phlog)
#define PHLOG_WRITE_ASYNCTRUNC(logtype, set, phlog, val)
#define PHLOG_FLUSH_ASYNCTRUNC(logtype, set, phlog)

Typedefs

typedef m_logmgr_s m_logmgr_t
typedef m_log_s m_log_t
typedef m_log_ops_s m_log_ops_t
typedef m_log_dsc_s m_log_dsc_t
typedef m_log_nvmd_s m_log_nvmd_t

Enumerations

enum  { LF_TYPE_FREE = 0, LF_TYPE_VALIDVALUES }

Functions

m_result_t m_logmgr_init (pcm_storeset_t *set)
m_result_t m_logmgr_fini (void)
 Shutdowns the log manager.
m_result_t m_logmgr_register_logtype (pcm_storeset_t *set, int type, m_log_ops_t *ops)
m_result_t m_logmgr_alloc_log (pcm_storeset_t *set, int type, uint64_t flags, m_log_dsc_t **log_dscp)
 Allocates a new log and places it in the active logs list.
m_result_t m_logmgr_free_log (m_log_dsc_t *log_dsc)
 Releases a log.
m_result_t m_logmgr_do_recovery (pcm_storeset_t *set)
m_result_t m_logtrunc_truncate (pcm_storeset_t *set)
 Force log truncation.
void m_logmgr_stat_print ()

Variables

m_log_ops_tm_log_ops []


Detailed Description

The interface to the log manager.

Definition in file log_i.h.


Define Documentation

#define PHLOG_FLUSH ( logtype,
set,
phlog   ) 

Value:

do {                                                                          \
    int retries = 0;                                                          \
    while (m_phlog_##logtype##_flush(set, (phlog)) != M_R_SUCCESS) {          \
        if (retries++ > 1) {                                                  \
            M_INTERNALERROR("Cannot complete log write successfully.\n");     \
        }                                                                     \
        (phlog)->stat_wait_for_trunc++;                                       \
        m_logtrunc_truncate(set);                                             \
    }                                                                         \
} while (0);

Definition at line 166 of file log_i.h.

#define PHLOG_FLUSH_ASYNCTRUNC ( logtype,
set,
phlog   ) 

Value:

do {                                                                           \
        hrtime_t __start;                                                          \
        hrtime_t __end;                                                            \
    if (m_phlog_##logtype##_flush(set, (phlog)) != M_R_SUCCESS) {              \
        (phlog)->stat_wait_for_trunc++;                                        \
        __start = hrtime_cycles();                                             \
        while (m_phlog_##logtype##_flush(set, (phlog)) != M_R_SUCCESS);        \
        __end = hrtime_cycles();                                               \
            phlog->stat_wait_time_for_trunc += (HRTIME_CYCLE2NS(__end - __start)); \
    }                                                                          \
} while (0);

Definition at line 193 of file log_i.h.

#define PHLOG_WRITE ( logtype,
set,
phlog,
val   ) 

Value:

do {                                                                          \
    int retries = 0;                                                          \
    while (m_phlog_##logtype##_write(set, (phlog), (val)) != M_R_SUCCESS) {   \
        if (retries++ > 1) {                                                  \
            M_INTERNALERROR("Cannot complete log write successfully.\n");     \
        }                                                                     \
        (phlog)->stat_wait_for_trunc++;                                       \
        m_logtrunc_truncate(set);                                             \
    }                                                                         \
} while (0);

Definition at line 153 of file log_i.h.

#define PHLOG_WRITE_ASYNCTRUNC ( logtype,
set,
phlog,
val   ) 

Value:

do {                                                                           \
        hrtime_t __start;                                                          \
        hrtime_t __end;                                                            \
    if (m_phlog_##logtype##_write(set, (phlog), (val)) != M_R_SUCCESS) {       \
        (phlog)->stat_wait_for_trunc++;                                        \
        __start = hrtime_cycles();                                             \
        while (m_phlog_##logtype##_write(set, (phlog), (val)) != M_R_SUCCESS); \
        __end = hrtime_cycles();                                               \
            phlog->stat_wait_time_for_trunc += (HRTIME_CYCLE2NS(__end - __start)); \
    }                                                                          \
} while (0);

Definition at line 179 of file log_i.h.


Function Documentation

m_result_t m_logmgr_fini ( void   ) 

Shutdowns the log manager.

It flushes any dirty logs. Prints statistics.

Definition at line 226 of file mgr.c.

References m_logmgr_fini(), m_logmgr_stat_print(), m_logmgr_s::trunc_count, and m_logmgr_s::trunc_time.

Referenced by m_logmgr_fini().


Generated on Sat Apr 23 11:43:36 2011 for Mnemosyne by  doxygen 1.4.7