Flash Translation Layer  1.0
Functions
page-gc.c File Reference

garbage collection logic for page ftl More...

#include <glib.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "include/page.h"
#include "include/log.h"
#include "include/bits.h"
Include dependency graph for page-gc.c:

Functions

gint page_ftl_gc_list_cmp (gconstpointer a, gconstpointer b)
 page ftl gc list compare function More...
 
static void page_ftl_erase_end_rq (struct device_request *request)
 erase's end request function More...
 
static struct page_ftl_segmentpage_ftl_pick_gc_target (struct page_ftl *pgftl)
 the function which chooses the appropriate garbage collection target. More...
 
static int page_ftl_segment_erase (struct page_ftl *pgftl, struct device_address paddr)
 erase the garbage collection target segment More...
 
static ssize_t page_ftl_read_valid_page (struct page_ftl *pgftl, size_t lpn, char **__buffer)
 read the valid pages from the garbage collection target segment More...
 
static ssize_t page_ftl_write_valid_page (struct page_ftl *pgftl, size_t lpn, char *buffer)
 write valid page to the other segment. More...
 
static int page_ftl_valid_page_copy (struct page_ftl *pgftl, struct page_ftl_segment *segment)
 core logic of the valid page copy More...
 
int page_ftl_do_gc (struct page_ftl *pgftl)
 core logic of the garbage collection More...
 

Detailed Description

garbage collection logic for page ftl

Author
Gijun Oh
Version
0.2
Date
2021-10-06

Function Documentation

◆ page_ftl_do_gc()

int page_ftl_do_gc ( struct page_ftl pgftl)

core logic of the garbage collection

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

◆ page_ftl_erase_end_rq()

static void page_ftl_erase_end_rq ( struct device_request request)
static

erase's end request function

Parameters
requestthe request which is submitted before
Here is the call graph for this function:

◆ page_ftl_gc_list_cmp()

gint page_ftl_gc_list_cmp ( gconstpointer  a,
gconstpointer  b 
)

page ftl gc list compare function

Parameters
acompare target 1
bcompare target 2
Returns
to make precede a segment that contains the less valid pages

◆ page_ftl_pick_gc_target()

static struct page_ftl_segment* page_ftl_pick_gc_target ( struct page_ftl pgftl)
static

the function which chooses the appropriate garbage collection target.

Parameters
pgftlpointer of the page FTL structure
Returns
garbage collection target segment's pointer
Here is the call graph for this function:

◆ page_ftl_read_valid_page()

static ssize_t page_ftl_read_valid_page ( struct page_ftl pgftl,
size_t  lpn,
char **  __buffer 
)
static

read the valid pages from the garbage collection target segment

Parameters
pgftlpointer of the page FTL structure
lpnread position which contains the logical page number
__bufferbuffer pointer's address which dynamically allocated by this function
Returns
reading data size. a negative number means fail to read
Here is the call graph for this function:

◆ page_ftl_segment_erase()

static int page_ftl_segment_erase ( struct page_ftl pgftl,
struct device_address  paddr 
)
static

erase the garbage collection target segment

Parameters
pgftlpointer of the page FTL structure
paddrthe address containing the segment number which wants to erase
Returns
0 for success, negative number for fail
Here is the call graph for this function:

◆ page_ftl_valid_page_copy()

static int page_ftl_valid_page_copy ( struct page_ftl pgftl,
struct page_ftl_segment segment 
)
static

core logic of the valid page copy

Parameters
pgftlpointer of the page FTL structure
segmentsegment which wants to copy the valid pages
Returns
0 for success, negative number for fail
Here is the call graph for this function:

◆ page_ftl_write_valid_page()

static ssize_t page_ftl_write_valid_page ( struct page_ftl pgftl,
size_t  lpn,
char *  buffer 
)
static

write valid page to the other segment.

Parameters
pgftlpointer of the page FTL structure
lpnwrite position which contains the logical page number
bufferbuffer pointer containing the valid page
Returns
writing data size. a negative number means fail to write
Here is the call graph for this function: