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"
core logic for page ftl
- Author
- Gijun Oh
- Version
- 0.2
- Date
- 2021-09-22
◆ page_ftl_alloc_bitmap()
static int page_ftl_alloc_bitmap |
( |
struct page_ftl * |
pgftl, |
|
|
uint64_t ** |
bitmap |
|
) |
| |
|
static |
allocate the segment's bitmap
- Parameters
-
pgftl | pointer of the page-ftl structure |
bitmap | double pointer of the bitmap |
- Returns
- 0 for successfully allocated
◆ page_ftl_close()
int page_ftl_close |
( |
struct page_ftl * |
pgftl | ) |
|
deallocate the page ftl structure's members
- Parameters
-
pgftl | pointer of the page ftl structure |
- Returns
- zero to success, negative number to fail
◆ page_ftl_free_segments()
static void page_ftl_free_segments |
( |
struct page_ftl * |
pgftl | ) |
|
|
static |
deallocate the ftl's segments
- Parameters
-
segments | pointer of the segment array |
◆ page_ftl_gc_from_list()
do garbage collection from the gc list
- Parameters
-
pgftl | pointer of the page ftl |
request | pointer of the request |
- Returns
- number of erased segments
◆ page_ftl_gc_thread()
static void* page_ftl_gc_thread |
( |
void * |
data | ) |
|
|
static |
do garbage collection thread
- Parameters
-
data | containing the pointer of the page ftl structure |
- Returns
- NULL
◆ 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
-
pgftl | pointer of the page ftl structure |
- Returns
- number of the invalid pages
◆ page_ftl_init_segment()
static int page_ftl_init_segment |
( |
struct page_ftl * |
pgftl | ) |
|
|
static |
initialize each segment's metadata
- Parameters
-
pgftl | pointer of the page ftl structure |
- Returns
- 0 to success, negative value to fail
◆ page_ftl_open()
int page_ftl_open |
( |
struct page_ftl * |
pgftl, |
|
|
const char * |
name, |
|
|
int |
flags |
|
) |
| |
allocate the page ftl structure's members
- Parameters
-
pgftl | pointer of the page ftl structure |
name | file's name for open |
flags | flags for open |
- Returns
- zero to success, negative number to fail
- Todo:
- you must make a recovery process
initialize the mapping table
◆ page_ftl_segment_data_init()
initialize the page ftl's segment data only
- Parameters
-
pgftl | pointer of the page-ftl structure |
segment | pointer of the target segment |
- Returns
- 0 for successfully initialized
◆ page_ftl_submit_request()
submit the request to the valid function
- Parameters
-
pgftl | pointer of the page ftl structure |
request | pointer 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.
◆ is_gc_thread_exit