glusterfs  8.2
About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x (latest version).
  Fossies Dox: glusterfs-8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

io-cache.c File Reference
#include <math.h>
#include <glusterfs/glusterfs.h>
#include <glusterfs/logging.h>
#include <glusterfs/dict.h>
#include <glusterfs/xlator.h>
#include "io-cache.h"
#include "ioc-mem-types.h"
#include <glusterfs/statedump.h>
#include <assert.h>
#include <sys/time.h>
#include "io-cache-messages.h"
Include dependency graph for io-cache.c:

Go to the source code of this file.

Functions

uint32_t ioc_get_priority (ioc_table_t *table, const char *path)
 
static uint32_t ioc_hashfn (void *data, int len)
 
int ioc_update_pages (call_frame_t *frame, ioc_inode_t *ioc_inode, struct iovec *vector, int32_t count, int op_ret, off_t offset)
 
int32_t ioc_inode_need_revalidate (ioc_inode_t *ioc_inode)
 
int64_t __ioc_inode_flush (ioc_inode_t *ioc_inode)
 
void ioc_inode_flush (ioc_inode_t *ioc_inode)
 
int32_t ioc_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *preop, struct iatt *postop, dict_t *xdata)
 
int32_t ioc_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf, int32_t valid, dict_t *xdata)
 
int32_t ioc_inode_update (xlator_t *this, inode_t *inode, char *path, struct iatt *iabuf)
 
int32_t ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, dict_t *xdata, struct iatt *postparent)
 
int32_t ioc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
 
int32_t ioc_forget (xlator_t *this, inode_t *inode)
 
static int32_t ioc_invalidate (xlator_t *this, inode_t *inode)
 
int32_t ioc_cache_validate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *stbuf, dict_t *xdata)
 
int32_t ioc_wait_on_inode (ioc_inode_t *ioc_inode, ioc_page_t *page)
 
int32_t ioc_cache_validate (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd, ioc_page_t *page)
 
static uint32_t is_match (const char *path, const char *pattern)
 
int32_t ioc_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
 
int32_t ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, struct iatt *buf, struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
 
int32_t ioc_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *buf, struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
 
int ioc_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata)
 
int32_t ioc_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, fd_t *fd, dict_t *xdata)
 
int32_t ioc_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata)
 
int32_t ioc_release (xlator_t *this, fd_t *fd)
 
int32_t ioc_need_prune (ioc_table_t *table)
 
void ioc_dispatch_requests (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd, off_t offset, size_t size)
 
int32_t ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset, uint32_t flags, dict_t *xdata)
 
int32_t ioc_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
 
int32_t ioc_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int32_t count, off_t offset, uint32_t flags, struct iobref *iobref, dict_t *xdata)
 
int32_t ioc_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
 
int32_t ioc_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
 
int32_t ioc_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, dict_t *xdata)
 
int32_t ioc_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, dict_t *xdata)
 
int32_t ioc_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct gf_flock *lock, dict_t *xdata)
 
int32_t ioc_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata)
 
int ioc_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, gf_dirent_t *entries, dict_t *xdata)
 
int ioc_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset, dict_t *dict)
 
static int32_t ioc_discard_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *pre, struct iatt *post, dict_t *xdata)
 
static int32_t ioc_discard (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, size_t len, dict_t *xdata)
 
static int32_t ioc_zerofill_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *pre, struct iatt *post, dict_t *xdata)
 
static int32_t ioc_zerofill (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, off_t len, dict_t *xdata)
 
int32_t ioc_get_priority_list (const char *opt_str, struct list_head *first)
 
int32_t mem_acct_init (xlator_t *this)
 
static bool check_cache_size_ok (xlator_t *this, uint64_t cache_size)
 
int reconfigure (xlator_t *this, dict_t *options)
 
int32_t init (xlator_t *this)
 
void ioc_page_waitq_dump (ioc_page_t *page, char *prefix)
 
void __ioc_inode_waitq_dump (ioc_inode_t *ioc_inode, char *prefix)
 
void __ioc_page_dump (ioc_page_t *page, char *prefix)
 
void __ioc_cache_dump (ioc_inode_t *ioc_inode, char *prefix)
 
int ioc_inode_dump (xlator_t *this, inode_t *inode)
 
int ioc_priv_dump (xlator_t *this)
 
void fini (xlator_t *this)
 

Variables

int ioc_log2_page_size
 
struct volume_options options []
 
struct xlator_fops fops
 
struct xlator_dumpops dumpops
 
struct xlator_cbks cbks
 
xlator_api_t xlator_api
 

Function Documentation

◆ __ioc_cache_dump()

◆ __ioc_inode_flush()

int64_t __ioc_inode_flush ( ioc_inode_t ioc_inode)

◆ __ioc_inode_waitq_dump()

void __ioc_inode_waitq_dump ( ioc_inode_t ioc_inode,
char *  prefix 
)

◆ __ioc_page_dump()

void __ioc_page_dump ( ioc_page_t page,
char *  prefix 
)

◆ check_cache_size_ok()

static bool check_cache_size_ok ( xlator_t this,
uint64_t  cache_size 
)
static

◆ fini()

void fini ( xlator_t this)

Definition at line 2107 of file io-cache.c.

◆ init()

◆ ioc_cache_validate()

◆ ioc_cache_validate_cbk()

◆ ioc_create()

int32_t ioc_create ( call_frame_t frame,
xlator_t this,
loc_t loc,
int32_t  flags,
mode_t  mode,
mode_t  umask,
fd_t fd,
dict_t xdata 
)

◆ ioc_create_cbk()

◆ ioc_discard()

static int32_t ioc_discard ( call_frame_t frame,
xlator_t this,
fd_t fd,
off_t  offset,
size_t  len,
dict_t xdata 
)
static

◆ ioc_discard_cbk()

static int32_t ioc_discard_cbk ( call_frame_t frame,
void *  cookie,
xlator_t this,
int32_t  op_ret,
int32_t  op_errno,
struct iatt pre,
struct iatt post,
dict_t xdata 
)
static

Definition at line 1475 of file io-cache.c.

References STACK_UNWIND_STRICT.

Referenced by ioc_discard().

◆ ioc_dispatch_requests()

◆ ioc_forget()

int32_t ioc_forget ( xlator_t this,
inode_t inode 
)

Definition at line 369 of file io-cache.c.

References inode_ctx_get, and ioc_inode_destroy().

◆ ioc_ftruncate()

int32_t ioc_ftruncate ( call_frame_t frame,
xlator_t this,
fd_t fd,
off_t  offset,
dict_t xdata 
)

◆ ioc_ftruncate_cbk()

int32_t ioc_ftruncate_cbk ( call_frame_t frame,
void *  cookie,
xlator_t this,
int32_t  op_ret,
int32_t  op_errno,
struct iatt prebuf,
struct iatt postbuf,
dict_t xdata 
)

Definition at line 1335 of file io-cache.c.

References STACK_UNWIND_STRICT.

Referenced by ioc_ftruncate().

◆ ioc_get_priority()

uint32_t ioc_get_priority ( ioc_table_t table,
const char *  path 
)

◆ ioc_get_priority_list()

int32_t ioc_get_priority_list ( const char *  opt_str,
struct list_head first 
)

◆ ioc_hashfn()

static uint32_t ioc_hashfn ( void *  data,
int  len 
)
static

Definition at line 30 of file io-cache.c.

References ioc_log2_page_size.

Referenced by ioc_readv().

◆ ioc_inode_dump()

◆ ioc_inode_flush()

◆ ioc_inode_need_revalidate()

int32_t ioc_inode_need_revalidate ( ioc_inode_t ioc_inode)

◆ ioc_inode_update()

◆ ioc_invalidate()

static int32_t ioc_invalidate ( xlator_t this,
inode_t inode 
)
static

Definition at line 382 of file io-cache.c.

References inode_ctx_get, and ioc_inode_flush().

◆ ioc_lk()

int32_t ioc_lk ( call_frame_t frame,
xlator_t this,
fd_t fd,
int32_t  cmd,
struct gf_flock lock,
dict_t xdata 
)

◆ ioc_lk_cbk()

int32_t ioc_lk_cbk ( call_frame_t frame,
void *  cookie,
xlator_t this,
int32_t  op_ret,
int32_t  op_errno,
struct gf_flock lock,
dict_t xdata 
)

Definition at line 1395 of file io-cache.c.

References lock, and STACK_UNWIND_STRICT.

Referenced by ioc_lk().

◆ ioc_lookup()

◆ ioc_lookup_cbk()

int32_t ioc_lookup_cbk ( call_frame_t frame,
void *  cookie,
xlator_t this,
int32_t  op_ret,
int32_t  op_errno,
inode_t inode,
struct iatt stbuf,
dict_t xdata,
struct iatt postparent 
)

◆ ioc_mknod()

int ioc_mknod ( call_frame_t frame,
xlator_t this,
loc_t loc,
mode_t  mode,
dev_t  rdev,
mode_t  umask,
dict_t xdata 
)

◆ ioc_mknod_cbk()

int32_t ioc_mknod_cbk ( call_frame_t frame,
void *  cookie,
xlator_t this,
int32_t  op_ret,
int32_t  op_errno,
inode_t inode,
struct iatt buf,
struct iatt preparent,
struct iatt postparent,
dict_t xdata 
)

◆ ioc_need_prune()

int32_t ioc_need_prune ( ioc_table_t table)

◆ ioc_open()

int32_t ioc_open ( call_frame_t frame,
xlator_t this,
loc_t loc,
int32_t  flags,
fd_t fd,
dict_t xdata 
)

◆ ioc_open_cbk()

◆ ioc_page_waitq_dump()

void ioc_page_waitq_dump ( ioc_page_t page,
char *  prefix 
)

◆ ioc_priv_dump()

◆ ioc_readdirp()

int ioc_readdirp ( call_frame_t frame,
xlator_t this,
fd_t fd,
size_t  size,
off_t  offset,
dict_t dict 
)

◆ ioc_readdirp_cbk()

int ioc_readdirp_cbk ( call_frame_t frame,
void *  cookie,
xlator_t this,
int  op_ret,
int  op_errno,
gf_dirent_t entries,
dict_t xdata 
)

◆ ioc_readv()

◆ ioc_release()

int32_t ioc_release ( xlator_t this,
fd_t fd 
)

Definition at line 927 of file io-cache.c.

◆ ioc_setattr()

int32_t ioc_setattr ( call_frame_t frame,
xlator_t this,
loc_t loc,
struct iatt stbuf,
int32_t  valid,
dict_t xdata 
)

◆ ioc_setattr_cbk()

int32_t ioc_setattr_cbk ( call_frame_t frame,
void *  cookie,
xlator_t this,
int32_t  op_ret,
int32_t  op_errno,
struct iatt preop,
struct iatt postop,
dict_t xdata 
)

Definition at line 203 of file io-cache.c.

References STACK_UNWIND_STRICT.

Referenced by ioc_setattr().

◆ ioc_truncate()

int32_t ioc_truncate ( call_frame_t frame,
xlator_t this,
loc_t loc,
off_t  offset,
dict_t xdata 
)

◆ ioc_truncate_cbk()

int32_t ioc_truncate_cbk ( call_frame_t frame,
void *  cookie,
xlator_t this,
int32_t  op_ret,
int32_t  op_errno,
struct iatt prebuf,
struct iatt postbuf,
dict_t xdata 
)

Definition at line 1314 of file io-cache.c.

References STACK_UNWIND_STRICT.

Referenced by ioc_truncate().

◆ ioc_update_pages()

int ioc_update_pages ( call_frame_t frame,
ioc_inode_t ioc_inode,
struct iovec *  vector,
int32_t  count,
int  op_ret,
off_t  offset 
)

◆ ioc_wait_on_inode()

◆ ioc_writev()

int32_t ioc_writev ( call_frame_t frame,
xlator_t this,
fd_t fd,
struct iovec *  vector,
int32_t  count,
off_t  offset,
uint32_t  flags,
struct iobref iobref,
dict_t xdata 
)

◆ ioc_writev_cbk()

int32_t ioc_writev_cbk ( call_frame_t frame,
void *  cookie,
xlator_t this,
int32_t  op_ret,
int32_t  op_errno,
struct iatt prebuf,
struct iatt postbuf,
dict_t xdata 
)

◆ ioc_zerofill()

static int32_t ioc_zerofill ( call_frame_t frame,
xlator_t this,
fd_t fd,
off_t  offset,
off_t  len,
dict_t xdata 
)
static

◆ ioc_zerofill_cbk()

static int32_t ioc_zerofill_cbk ( call_frame_t frame,
void *  cookie,
xlator_t this,
int32_t  op_ret,
int32_t  op_errno,
struct iatt pre,
struct iatt post,
dict_t xdata 
)
static

Definition at line 1500 of file io-cache.c.

References STACK_UNWIND_STRICT.

Referenced by ioc_zerofill().

◆ is_match()

static uint32_t is_match ( const char *  path,
const char *  pattern 
)
static

Definition at line 563 of file io-cache.c.

Referenced by ioc_get_priority().

◆ mem_acct_init()

int32_t mem_acct_init ( xlator_t this)

◆ reconfigure()

Variable Documentation

◆ cbks

struct xlator_cbks cbks
Initial value:
= {
.forget = ioc_forget,
.release = ioc_release,
.invalidate = ioc_invalidate,
}

Definition at line 2107 of file io-cache.c.

◆ dumpops

struct xlator_dumpops dumpops
Initial value:
= {
.priv = ioc_priv_dump,
.inodectx = ioc_inode_dump,
}

Definition at line 2107 of file io-cache.c.

◆ fops

struct xlator_fops fops
Initial value:
= {
.open = ioc_open,
.create = ioc_create,
.readv = ioc_readv,
.writev = ioc_writev,
.truncate = ioc_truncate,
.ftruncate = ioc_ftruncate,
.lookup = ioc_lookup,
.lk = ioc_lk,
.setattr = ioc_setattr,
.mknod = ioc_mknod,
.readdirp = ioc_readdirp,
.discard = ioc_discard,
.zerofill = ioc_zerofill,
}

Definition at line 2107 of file io-cache.c.

Referenced by ioc_create(), ioc_discard(), ioc_ftruncate(), ioc_lk(), ioc_lookup(), ioc_mknod(), ioc_open(), ioc_readdirp(), ioc_readv(), ioc_setattr(), ioc_truncate(), ioc_writev(), and ioc_zerofill().

◆ ioc_log2_page_size

int ioc_log2_page_size

Definition at line 22 of file io-cache.c.

Referenced by init(), and ioc_hashfn().

◆ options

struct volume_options options[]

Definition at line 25 of file io-cache.c.

Referenced by init(), and reconfigure().

◆ xlator_api

xlator_api_t xlator_api
Initial value:
= {
.init = init,
.fini = fini,
.reconfigure = reconfigure,
.mem_acct_init = mem_acct_init,
.op_version = {1},
.dumpops = &dumpops,
.fops = &fops,
.cbks = &cbks,
.options = options,
.identifier = "io-cache",
}

Definition at line 2235 of file io-cache.c.

ioc_zerofill
static int32_t ioc_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, off_t len, dict_t *xdata)
Definition: io-cache.c:1509
ioc_lk
int32_t ioc_lk(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata)
Definition: io-cache.c:1403
ioc_readdirp
int ioc_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset, dict_t *dict)
Definition: io-cache.c:1463
ioc_forget
int32_t ioc_forget(xlator_t *this, inode_t *inode)
Definition: io-cache.c:369
ioc_setattr
int32_t ioc_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf, int32_t valid, dict_t *xdata)
Definition: io-cache.c:212
ioc_lookup
int32_t ioc_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
Definition: io-cache.c:323
ioc_writev
int32_t ioc_writev(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int32_t count, off_t offset, uint32_t flags, struct iobref *iobref, dict_t *xdata)
Definition: io-cache.c:1268
init
int32_t init(xlator_t *this)
Definition: io-cache.c:1746
ioc_open
int32_t ioc_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, fd_t *fd, dict_t *xdata)
Definition: io-cache.c:859
ioc_priv_dump
int ioc_priv_dump(xlator_t *this)
Definition: io-cache.c:2049
reconfigure
int reconfigure(xlator_t *this, dict_t *options)
Definition: io-cache.c:1674
ioc_mknod
int ioc_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata)
Definition: io-cache.c:812
ioc_readv
int32_t ioc_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset, uint32_t flags, dict_t *xdata)
Definition: io-cache.c:1114
ioc_invalidate
static int32_t ioc_invalidate(xlator_t *this, inode_t *inode)
Definition: io-cache.c:382
dumpops
struct xlator_dumpops dumpops
Definition: io-cache.c:2164
options
struct volume_options options[]
Definition: io-cache.c:27
fops
struct xlator_fops fops
Definition: io-cache.c:2147
ioc_ftruncate
int32_t ioc_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, dict_t *xdata)
Definition: io-cache.c:1379
fini
void fini(xlator_t *this)
Definition: io-cache.c:2107
volume_options::category
gf_category_t category
Definition: options.h:143
GF_MAINTAINED
@ GF_MAINTAINED
Definition: glusterfs.h:401
ioc_inode_dump
int ioc_inode_dump(xlator_t *this, inode_t *inode)
Definition: io-cache.c:1981
ioc_create
int32_t ioc_create(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata)
Definition: io-cache.c:894
mem_acct_init
int32_t mem_acct_init(xlator_t *this)
Definition: io-cache.c:1619
ioc_truncate
int32_t ioc_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, dict_t *xdata)
Definition: io-cache.c:1354
ioc_discard
static int32_t ioc_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, size_t len, dict_t *xdata)
Definition: io-cache.c:1484
cbks
struct xlator_cbks cbks
Definition: io-cache.c:2169
ioc_release
int32_t ioc_release(xlator_t *this, fd_t *fd)
Definition: io-cache.c:927