Flash Translation Layer  1.0
Functions | Variables
page-core.c File Reference

core logic for page ftl More...

#include "include/device.h"
#include <errno.h>
#include <assert.h>
#include <fcntl.h>
#include <pthread.h>
#include <string.h>
#include <glib.h>
#include "include/page.h"
#include "include/log.h"
#include "include/bits.h"
Include dependency graph for page-core.c:

Functions

static size_t page_ftl_get_free_pages (struct page_ftl *pgftl)
 get number of invalid pages in the ftl More...
 
static ssize_t page_ftl_gc_from_list (struct page_ftl *pgftl, struct device_request *request)
 do garbage collection from the gc list More...
 
static void * page_ftl_gc_thread (void *data)
 do garbage collection thread More...
 
static int page_ftl_alloc_bitmap (struct page_ftl *pgftl, uint64_t **bitmap)
 allocate the segment's bitmap More...
 
int page_ftl_segment_data_init (struct page_ftl *pgftl, struct page_ftl_segment *segment)
 initialize the page ftl's segment data only More...
 
static int page_ftl_init_segment (struct page_ftl *pgftl)
 initialize each segment's metadata More...
 
int page_ftl_open (struct page_ftl *pgftl, const char *name, int flags)
 allocate the page ftl structure's members More...
 
ssize_t page_ftl_submit_request (struct page_ftl *pgftl, struct device_request *request)
 submit the request to the valid function More...
 
static void page_ftl_free_segments (struct page_ftl *pgftl)
 deallocate the ftl's segments More...
 
int page_ftl_close (struct page_ftl *pgftl)
 deallocate the page ftl structure's members More...
 

Variables

static int is_gc_thread_exit
 

Detailed Description

core logic for page ftl

Author
Gijun Oh
Version
0.2
Date
2021-09-22

Function Documentation

◆ page_ftl_alloc_bitmap()

static int page_ftl_alloc_bitmap ( struct page_ftl pgftl,
uint64_t **  bitmap 
)
static

allocate the segment's bitmap

Parameters
pgftlpointer of the page-ftl structure
bitmapdouble pointer of the bitmap
Returns
0 for successfully allocated
Here is the call graph for this function:

◆ page_ftl_close()

int page_ftl_close ( struct page_ftl pgftl)

deallocate the page ftl structure's members

Parameters
pgftlpointer of the page ftl structure
Returns
zero to success, negative number to fail
Here is the call graph for this function:

◆ page_ftl_free_segments()

static void page_ftl_free_segments ( struct page_ftl pgftl)
static

deallocate the ftl's segments

Parameters
segmentspointer of the segment array
Here is the call graph for this function:

◆ page_ftl_gc_from_list()

static ssize_t page_ftl_gc_from_list ( struct page_ftl pgftl,
struct device_request request 
)
static

do garbage collection from the gc list

Parameters
pgftlpointer of the page ftl
requestpointer of the request
Returns
number of erased segments
Here is the call graph for this function:

◆ page_ftl_gc_thread()

static void* page_ftl_gc_thread ( void *  data)
static

do garbage collection thread

Parameters
datacontaining the pointer of the page ftl structure
Returns
NULL
Here is the call graph for this function:

◆ page_ftl_get_free_pages()

static size_t page_ftl_get_free_pages ( struct page_ftl pgftl)
static

get number of invalid pages in the ftl

Parameters
pgftlpointer of the page ftl structure
Returns
number of the invalid pages
Here is the call graph for this function:

◆ page_ftl_init_segment()

static int page_ftl_init_segment ( struct page_ftl pgftl)
static

initialize each segment's metadata

Parameters
pgftlpointer of the page ftl structure
Returns
0 to success, negative value to fail
Here is the call graph for this function:

◆ page_ftl_open()

int page_ftl_open ( struct page_ftl pgftl,
const char *  name,
int  flags 
)

allocate the page ftl structure's members

Parameters
pgftlpointer of the page ftl structure
namefile's name for open
flagsflags for open
Returns
zero to success, negative number to fail
Todo:
you must make a recovery process

initialize the mapping table

Here is the call graph for this function:

◆ page_ftl_segment_data_init()

int page_ftl_segment_data_init ( struct page_ftl pgftl,
struct page_ftl_segment segment 
)

initialize the page ftl's segment data only

Parameters
pgftlpointer of the page-ftl structure
segmentpointer of the target segment
Returns
0 for successfully initialized
Here is the call graph for this function:

◆ page_ftl_submit_request()

ssize_t page_ftl_submit_request ( struct page_ftl pgftl,
struct device_request request 
)

submit the request to the valid function

Parameters
pgftlpointer of the page ftl structure
requestpointer of the request
Returns
read and write return the size of the submit, fail to return the nugative value
Note
garbage collection doesn't free the request.
Here is the call graph for this function:

Variable Documentation

◆ is_gc_thread_exit

int is_gc_thread_exit
static