Motr  M0
fsync.c File Reference
#include <linux/version.h>
#include "ut/ut.h"
#include "lib/tlist.h"
#include "lib/hash.h"
#include "lib/trace.h"
#include "mdservice/fsync_fops.h"
#include "m0t1fs/linux_kernel/m0t1fs.h"
#include "m0t1fs/linux_kernel/fsync.h"
#include "lib/misc.h"
#include "reqh/reqh_service.h"
Include dependency graph for fsync.c:

Go to the source code of this file.

Macros

#define NUM_STRECORDS   10
 

Functions

static int ut_kernel_fsync (struct file *file, loff_t start, loff_t end, int datasync)
 
static int ut_post_rpc (struct m0_rpc_item *item)
 
static int ut_wait_for_reply (struct m0_rpc_item *item, m0_time_t timeout)
 
static void ut_fop_fini (struct m0_fop *fop)
 
static void ut_reset_stub_counters (void)
 
static void fake_fs_setup (void)
 
static void test_m0t1fs_fsync_request_create (void)
 
void test_m0t1fs_fsync_reply_process_init (struct m0t1fs_fsync_fop_wrapper *ffw, struct m0_reqh_service_txid *stx)
 
void call_m0t1fs_fsync_reply_process (struct m0t1fs_sb *input_csb, struct m0t1fs_inode *input_m0inode, struct m0t1fs_fsync_fop_wrapper *input_ffw, int expect_return, int expect_ut_wait_for_reply_count, int expect_ut_fop_fini_count, uint64_t expect_txid, size_t expect_locality)
 
void test_m0t1fs_fsync_reply_process (void)
 
void test_m0t1fs_fsync_record_update (void)
 
void call_m0t1fs_fsync_core (struct m0t1fs_inode *input_m0inode, int input_flag, int expect_return, int expect_ut_post_rpc_count, int expect_ut_wait_for_reply_count, int expect_ut_fop_fini_count)
 
static void test_m0t1fs_fsync_core (void)
 
void call_m0t1fs_fsync (struct file *input_file, loff_t start, loff_t end, int input_datamode, int expect_return, int expect_ut_kernel_fsync_count, int expect_ut_post_rpc_count, int expect_ut_fop_fini_count)
 
void fsync_test (void)
 

Variables

struct m0t1fs_fsync_interactions fi
 
static int ut_kernel_fsync_count = 0
 
static int ut_post_rpc_count = 0
 
static int ut_wait_for_reply_count = 0
 
static int ut_fop_fini_count = 0
 
static int ut_post_rpc_delay = 0
 
static int ut_kernel_fsync_return = -EINVAL
 
static int ut_post_rpc_early_return = -EINVAL
 
static int ut_post_rpc_return = -EINVAL
 
static int ut_wait_for_reply_return = -EINVAL
 
static int ut_wait_for_reply_remote_return = 0
 
static struct m0_fop reply_fop
 
static struct m0_fop_fsync_rep reply_data
 
static struct m0_reqh_service_txid stx [NUM_STRECORDS]
 
static struct m0t1fs_fsync_interactions copy
 
static struct file file
 
static struct dentry dentry
 
static struct super_block super_block
 
static struct m0t1fs_inode m0inode
 
static struct m0t1fs_sb csb
 
static struct m0_reqh_service_ctx service
 
struct m0_rpc_conn conn = { .c_rpc_machine = (void*)1 }
 
int default_txid = 42
 
int default_locality = 7
 

Macro Definition Documentation

◆ NUM_STRECORDS

#define NUM_STRECORDS   10

Definition at line 70 of file fsync.c.

Function Documentation

◆ call_m0t1fs_fsync()

void call_m0t1fs_fsync ( struct file input_file,
loff_t  start,
loff_t  end,
int  input_datamode,
int  expect_return,
int  expect_ut_kernel_fsync_count,
int  expect_ut_post_rpc_count,
int  expect_ut_fop_fini_count 
)

Definition at line 604 of file fsync.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ call_m0t1fs_fsync_core()

void call_m0t1fs_fsync_core ( struct m0t1fs_inode *  input_m0inode,
int  input_flag,
int  expect_return,
int  expect_ut_post_rpc_count,
int  expect_ut_wait_for_reply_count,
int  expect_ut_fop_fini_count 
)

Definition at line 501 of file fsync.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ call_m0t1fs_fsync_reply_process()

void call_m0t1fs_fsync_reply_process ( struct m0t1fs_sb *  input_csb,
struct m0t1fs_inode *  input_m0inode,
struct m0t1fs_fsync_fop_wrapper input_ffw,
int  expect_return,
int  expect_ut_wait_for_reply_count,
int  expect_ut_fop_fini_count,
uint64_t  expect_txid,
size_t  expect_locality 
)

Definition at line 316 of file fsync.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fake_fs_setup()

static void fake_fs_setup ( void  )
static

(Re-)initialises our fake filesystem of super_block, dentry and inode. These are fed to the functions we test so that their container-of mechanisms find objects of the correct type, with our fake values.

Definition at line 184 of file fsync.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fsync_test()

void fsync_test ( void  )

Definition at line 630 of file fsync.c.

Here is the call graph for this function:

◆ test_m0t1fs_fsync_core()

static void test_m0t1fs_fsync_core ( void  )
static

Tests the m0t1fs_fsync_core function.

Definition at line 519 of file fsync.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_m0t1fs_fsync_record_update()

void test_m0t1fs_fsync_record_update ( void  )

Tests the m0t1fs_fsync_record_update function.

Definition at line 473 of file fsync.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_m0t1fs_fsync_reply_process()

void test_m0t1fs_fsync_reply_process ( void  )

Tests the m0t1fs_fsync_reply_process function.

Definition at line 339 of file fsync.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_m0t1fs_fsync_reply_process_init()

void test_m0t1fs_fsync_reply_process_init ( struct m0t1fs_fsync_fop_wrapper ffw,
struct m0_reqh_service_txid stx 
)

Definition at line 292 of file fsync.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_m0t1fs_fsync_request_create()

static void test_m0t1fs_fsync_request_create ( void  )
static

Tests the m0t1fs_fsync_request_create function.

Definition at line 233 of file fsync.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ut_fop_fini()

static void ut_fop_fini ( struct m0_fop fop)
static

Stub for fop_fini, frees any memory allocated to a fop, without the rpc_item reference counting getting upset that the fop was never sent/received.

Definition at line 156 of file fsync.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ut_kernel_fsync()

static int ut_kernel_fsync ( struct file file,
loff_t  start,
loff_t  end,
int  datasync 
)
static

Definition at line 100 of file fsync.c.

Here is the caller graph for this function:

◆ ut_post_rpc()

static int ut_post_rpc ( struct m0_rpc_item item)
static

Definition at line 112 of file fsync.c.

Here is the caller graph for this function:

◆ ut_reset_stub_counters()

static void ut_reset_stub_counters ( void  )
static

Resets the stub counters.

Definition at line 168 of file fsync.c.

Here is the caller graph for this function:

◆ ut_wait_for_reply()

static int ut_wait_for_reply ( struct m0_rpc_item item,
m0_time_t  timeout 
)
static

Definition at line 126 of file fsync.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ conn

struct m0_rpc_conn conn = { .c_rpc_machine = (void*)1 }

Definition at line 96 of file fsync.c.

◆ copy

struct m0t1fs_fsync_interactions copy
static

Definition at line 75 of file fsync.c.

◆ csb

struct m0t1fs_sb csb
static

Definition at line 90 of file fsync.c.

◆ default_locality

int default_locality = 7

Definition at line 289 of file fsync.c.

◆ default_txid

int default_txid = 42

Definition at line 288 of file fsync.c.

◆ dentry

struct dentry dentry
static

Definition at line 81 of file fsync.c.

◆ fi

Ugly abstraction of m0t1fs_fsync interactions with wider motr code

  • purely to facilitate unit testing

Definition at line 55 of file fsync.c.

◆ file

struct file file
static

Definition at line 78 of file fsync.c.

◆ m0inode

struct m0t1fs_inode m0inode
static

Definition at line 87 of file fsync.c.

◆ reply_data

struct m0_fop_fsync_rep reply_data
static

Definition at line 67 of file fsync.c.

◆ reply_fop

struct m0_fop reply_fop
static

Definition at line 64 of file fsync.c.

◆ service

struct m0_reqh_service_ctx service
static

Definition at line 93 of file fsync.c.

◆ stx

struct m0_reqh_service_txid stx[NUM_STRECORDS]
static

Definition at line 71 of file fsync.c.

◆ super_block

struct super_block super_block
static

Definition at line 84 of file fsync.c.

◆ ut_fop_fini_count

int ut_fop_fini_count = 0
static

Definition at line 53 of file fsync.c.

◆ ut_kernel_fsync_count

int ut_kernel_fsync_count = 0
static

Definition at line 50 of file fsync.c.

◆ ut_kernel_fsync_return

int ut_kernel_fsync_return = -EINVAL
static

Definition at line 57 of file fsync.c.

◆ ut_post_rpc_count

int ut_post_rpc_count = 0
static

Definition at line 51 of file fsync.c.

◆ ut_post_rpc_delay

int ut_post_rpc_delay = 0
static

Definition at line 56 of file fsync.c.

◆ ut_post_rpc_early_return

int ut_post_rpc_early_return = -EINVAL
static

Definition at line 58 of file fsync.c.

◆ ut_post_rpc_return

int ut_post_rpc_return = -EINVAL
static

Definition at line 59 of file fsync.c.

◆ ut_wait_for_reply_count

int ut_wait_for_reply_count = 0
static

Definition at line 52 of file fsync.c.

◆ ut_wait_for_reply_remote_return

int ut_wait_for_reply_remote_return = 0
static

Definition at line 61 of file fsync.c.

◆ ut_wait_for_reply_return

int ut_wait_for_reply_return = -EINVAL
static

Definition at line 60 of file fsync.c.