Android-cuttlefish cvd tool
Macros | Functions | Variables
libf2fs_io.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <stdbool.h>
#include <assert.h>
#include <inttypes.h>
#include "f2fs_fs.h"
Include dependency graph for libf2fs_io.c:

Macros

#define F_LINUX_SPECIFIC_BASE   1024
 
#define F_SET_RW_HINT   (F_LINUX_SPECIFIC_BASE + 12)
 
#define MIN_NUM_CACHE_ENTRY   1024L
 
#define MAX_MAX_HASH_COLLISION   16
 
#define MAX_CHUNK_SIZE   (1 * 1024 * 1024 * 1024ULL)
 
#define MAX_CHUNK_COUNT   (MAX_CHUNK_SIZE / F2FS_BLKSIZE)
 

Functions

static int __get_device_fd (__u64 *offset)
 
static void dcache_print_statistics (void)
 
void dcache_release (void)
 
static int dcache_alloc_all (long n)
 
static void dcache_relocate_init (void)
 
void dcache_init (void)
 
static char * dcache_addr (long entry)
 
static long dcache_relocate (long entry, int n)
 
static long dcache_find (__u64 blk)
 
static int dcache_io_read (long entry, __u64 offset, off_t blk)
 
static int dcache_update_rw (void *buf, __u64 offset, size_t byte_count, bool is_write)
 
int dcache_update_cache (void *buf, __u64 offset, size_t count)
 
int dcache_read (void *buf, __u64 offset, size_t count)
 
int dev_read_version (void *buf, __u64 offset, size_t len)
 
static int sparse_read_blk (__u64 UNUSED(block), int UNUSED(count), void *UNUSED(buf))
 
static int sparse_write_blk (__u64 UNUSED(block), int UNUSED(count), const void *UNUSED(buf))
 
static int sparse_write_zeroed_blk (__u64 UNUSED(block), int UNUSED(count))
 
int dev_read (void *buf, __u64 offset, size_t len)
 
int dev_readahead (__u64 offset, size_t UNUSED(len))
 
enum rw_hint f2fs_io_type_to_rw_hint (int seg_type)
 
static int __dev_write (void *buf, __u64 offset, size_t len, enum rw_hint whint)
 
int dev_write (void *buf, __u64 offset, size_t len, enum rw_hint whint)
 
int dev_write_block (void *buf, __u64 blk_addr, enum rw_hint whint)
 
int dev_write_dump (void *buf, __u64 offset, size_t len)
 
int dev_write_symlink (char *buf, size_t len)
 
int dev_fill (void *buf, __u64 offset, size_t len, enum rw_hint whint)
 
int dev_fill_block (void *buf, __u64 blk_addr, enum rw_hint whint)
 
int dev_read_block (void *buf, __u64 blk_addr)
 
int dev_reada_block (__u64 blk_addr)
 
int f2fs_fsync_device (void)
 
int f2fs_init_sparse_file (void)
 
void f2fs_release_sparse_resource (void)
 
int f2fs_finalize_device (void)
 

Variables

struct f2fs_configuration c
 
static bool * dcache_valid
 
static off_t * dcache_blk
 
static uint64_t * dcache_lastused
 
static char * dcache_buf
 
static uint64_t dcache_usetick
 
static uint64_t dcache_raccess
 
static uint64_t dcache_rhit
 
static uint64_t dcache_rmiss
 
static uint64_t dcache_rreplace
 
static bool dcache_exit_registered = false
 
static dev_cache_config_t dcache_config = {0, 16, 1}
 
static bool dcache_initialized = false
 
static long dcache_relocate_offset0 []
 
static int dcache_relocate_offset [16]
 

Macro Definition Documentation

◆ F_LINUX_SPECIFIC_BASE

#define F_LINUX_SPECIFIC_BASE   1024

libf2fs.c

Copyright (c) 2013 Samsung Electronics Co., Ltd. http://www.samsung.com/ Copyright (c) 2019 Google Inc. http://www.google.com/ Copyright (c) 2020 Google Inc. Robin Hsu robin.nosp@m.hsu@.nosp@m.googl.nosp@m.e.co.nosp@m.m : add quick-buffer for sload compression support

Dual licensed under the GPL or LGPL version 2 licenses.

◆ F_SET_RW_HINT

#define F_SET_RW_HINT   (F_LINUX_SPECIFIC_BASE + 12)

◆ MAX_CHUNK_COUNT

#define MAX_CHUNK_COUNT   (MAX_CHUNK_SIZE / F2FS_BLKSIZE)

◆ MAX_CHUNK_SIZE

#define MAX_CHUNK_SIZE   (1 * 1024 * 1024 * 1024ULL)

◆ MAX_MAX_HASH_COLLISION

#define MAX_MAX_HASH_COLLISION   16

◆ MIN_NUM_CACHE_ENTRY

#define MIN_NUM_CACHE_ENTRY   1024L

Function Documentation

◆ __dev_write()

static int __dev_write ( void *  buf,
__u64  offset,
size_t  len,
enum rw_hint  whint 
)
static

◆ __get_device_fd()

static int __get_device_fd ( __u64 offset)
static

◆ dcache_addr()

static char * dcache_addr ( long  entry)
inlinestatic

◆ dcache_alloc_all()

static int dcache_alloc_all ( long  n)
static

◆ dcache_find()

static long dcache_find ( __u64  blk)
static

◆ dcache_init()

void dcache_init ( void  )

◆ dcache_io_read()

static int dcache_io_read ( long  entry,
__u64  offset,
off_t  blk 
)
static

◆ dcache_print_statistics()

static void dcache_print_statistics ( void  )
static

◆ dcache_read()

int dcache_read ( void *  buf,
__u64  offset,
size_t  count 
)

◆ dcache_release()

void dcache_release ( void  )

◆ dcache_relocate()

static long dcache_relocate ( long  entry,
int  n 
)
inlinestatic

◆ dcache_relocate_init()

static void dcache_relocate_init ( void  )
static

◆ dcache_update_cache()

int dcache_update_cache ( void *  buf,
__u64  offset,
size_t  count 
)

◆ dcache_update_rw()

static int dcache_update_rw ( void *  buf,
__u64  offset,
size_t  byte_count,
bool  is_write 
)
static

◆ dev_fill()

int dev_fill ( void *  buf,
__u64  offset,
size_t  len,
enum rw_hint  whint 
)

◆ dev_fill_block()

int dev_fill_block ( void *  buf,
__u64  blk_addr,
enum rw_hint  whint 
)

◆ dev_read()

int dev_read ( void *  buf,
__u64  offset,
size_t  len 
)

◆ dev_read_block()

int dev_read_block ( void *  buf,
__u64  blk_addr 
)

◆ dev_read_version()

int dev_read_version ( void *  buf,
__u64  offset,
size_t  len 
)

◆ dev_reada_block()

int dev_reada_block ( __u64  blk_addr)

◆ dev_readahead()

int dev_readahead ( __u64  offset,
size_t   UNUSEDlen 
)

◆ dev_write()

int dev_write ( void *  buf,
__u64  offset,
size_t  len,
enum rw_hint  whint 
)

◆ dev_write_block()

int dev_write_block ( void *  buf,
__u64  blk_addr,
enum rw_hint  whint 
)

◆ dev_write_dump()

int dev_write_dump ( void *  buf,
__u64  offset,
size_t  len 
)

◆ dev_write_symlink()

int dev_write_symlink ( char *  buf,
size_t  len 
)

◆ f2fs_finalize_device()

int f2fs_finalize_device ( void  )

◆ f2fs_fsync_device()

int f2fs_fsync_device ( void  )

◆ f2fs_init_sparse_file()

int f2fs_init_sparse_file ( void  )

◆ f2fs_io_type_to_rw_hint()

enum rw_hint f2fs_io_type_to_rw_hint ( int  seg_type)

◆ f2fs_release_sparse_resource()

void f2fs_release_sparse_resource ( void  )

◆ sparse_read_blk()

static int sparse_read_blk ( __u64   UNUSEDblock,
int   UNUSEDcount,
void *  UNUSEDbuf 
)
static

◆ sparse_write_blk()

static int sparse_write_blk ( __u64   UNUSEDblock,
int   UNUSEDcount,
const void *  UNUSEDbuf 
)
static

◆ sparse_write_zeroed_blk()

static int sparse_write_zeroed_blk ( __u64   UNUSEDblock,
int   UNUSEDcount 
)
static

Variable Documentation

◆ c

f2fs_format.c

Copyright (c) 2012 Samsung Electronics Co., Ltd. http://www.samsung.com/

Dual licensed under the GPL or LGPL version 2 licenses.

◆ dcache_blk

off_t* dcache_blk
static

◆ dcache_buf

char* dcache_buf
static

◆ dcache_config

dev_cache_config_t dcache_config = {0, 16, 1}
static

◆ dcache_exit_registered

bool dcache_exit_registered = false
static

◆ dcache_initialized

bool dcache_initialized = false
static

◆ dcache_lastused

uint64_t* dcache_lastused
static

◆ dcache_raccess

uint64_t dcache_raccess
static

◆ dcache_relocate_offset

int dcache_relocate_offset[16]
static

◆ dcache_relocate_offset0

long dcache_relocate_offset0[]
static
Initial value:
= {
20, -20, 40, -40, 80, -80, 160, -160,
320, -320, 640, -640, 1280, -1280, 2560, -2560,
}

◆ dcache_rhit

uint64_t dcache_rhit
static

◆ dcache_rmiss

uint64_t dcache_rmiss
static

◆ dcache_rreplace

uint64_t dcache_rreplace
static

◆ dcache_usetick

uint64_t dcache_usetick
static

◆ dcache_valid

bool* dcache_valid
static