cl_io
[clio]


Data Structures

struct  cl_io_slice
 IO state private for a layer. More...
struct  cl_io_operations
 Per-layer io operations. More...
struct  cl_io_lock_link
 Link between lock and io. More...
struct  cl_lockset
 Lock-set represents a collection of locks, that io needs at a time. More...
struct  cl_io_rw_common
struct  cl_io
 State for io. More...
struct  cl_io
 State for io. More...

Defines

#define CL_IO_SLICE_CLEAN(foo_io, base)

Enumerations

enum  cl_io_type {
  CIT_READ, CIT_WRITE, CIT_SETATTR, CIT_FAULT,
  CIT_MISC, CIT_OP_NR
}
 IO types. More...
enum  cl_io_state {
  CIS_ZERO, CIS_INIT, CIS_IT_STARTED, CIS_LOCKED,
  CIS_IO_GOING, CIS_IO_FINISHED, CIS_UNLOCKED, CIS_IT_ENDED,
  CIS_FINI
}
 States of cl_io state machine. More...
enum  cl_req_priority { CRP_NORMAL, CRP_CANCEL }
enum  cl_io_lock_dmd { CILR_MANDATORY = 0, CILR_MAYBE, CILR_NEVER }
 Lock requirements(demand) for IO. More...

Functions

int cl_io_init (const struct lu_env *env, struct cl_io *io, enum cl_io_type iot, struct cl_object *obj)
 Initialize io, by calling cl_io_operations::cio_init() top-to-bottom.
int cl_io_sub_init (const struct lu_env *env, struct cl_io *io, enum cl_io_type iot, struct cl_object *obj)
 Initialize sub-io, by calling cl_io_operations::cio_init() top-to-bottom.
int cl_io_rw_init (const struct lu_env *env, struct cl_io *io, enum cl_io_type iot, loff_t pos, size_t count)
 Initialize read or write io.
int cl_io_loop (const struct lu_env *env, struct cl_io *io)
 Main io loop.
void cl_io_fini (const struct lu_env *env, struct cl_io *io)
 Finalize io, by calling cl_io_operations::cio_fini() bottom-to-top.
int cl_io_iter_init (const struct lu_env *env, struct cl_io *io)
 Prepares next iteration of io.
void cl_io_iter_fini (const struct lu_env *env, struct cl_io *io)
 Finalizes io iteration.
int cl_io_lock (const struct lu_env *env, struct cl_io *io)
 Takes locks necessary for the current iteration of io.
void cl_io_unlock (const struct lu_env *env, struct cl_io *io)
 Release locks takes by io.
int cl_io_start (const struct lu_env *env, struct cl_io *io)
 Starts io by calling cl_io_operations::cio_start() top-to-bottom.
void cl_io_end (const struct lu_env *env, struct cl_io *io)
 Wait until current io iteration is finished by calling cl_io_operations::cio_end() bottom-to-top.
int cl_io_lock_add (const struct lu_env *env, struct cl_io *io, struct cl_io_lock_link *link)
 Adds a lock to a lockset.
int cl_io_lock_alloc_add (const struct lu_env *env, struct cl_io *io, struct cl_lock_descr *descr)
 Allocates new lock link, and uses it to add a lock to a lockset.
int cl_io_read_page (const struct lu_env *env, struct cl_io *io, struct cl_page *page)
 Called by read io, when page has to be read from the server.
int cl_io_prepare_write (const struct lu_env *env, struct cl_io *io, struct cl_page *page, unsigned from, unsigned to)
 Called by write io to prepare page to receive data from user buffer.
int cl_io_commit_write (const struct lu_env *env, struct cl_io *io, struct cl_page *page, unsigned from, unsigned to)
 Called by write io after user data were copied into a page.
int cl_io_submit_rw (const struct lu_env *env, struct cl_io *io, enum cl_req_type iot, struct cl_2queue *queue, enum cl_req_priority priority)
 Submits a list of pages for immediate io.
int cl_io_submit_sync (const struct lu_env *env, struct cl_io *io, enum cl_req_type iot, struct cl_2queue *queue, enum cl_req_priority priority, long timeout)
 Submit a sync_io and wait for the IO to be finished, or error happens.
void cl_io_rw_advance (const struct lu_env *env, struct cl_io *io, size_t nob)
 Records that read or write io progressed nob bytes forward.
int cl_io_cancel (const struct lu_env *env, struct cl_io *io, struct cl_page_list *queue)
 Cancel an IO which has been submitted by cl_io_submit_rw.
int cl_io_is_going (const struct lu_env *env)
 Returns true iff there is an IO ongoing in the given environment.
cl_iocl_io_top (struct cl_io *io)
 Returns top-level io.
void cl_io_print (const struct lu_env *env, void *cookie, lu_printer_t printer, const struct cl_io *io)
 Prints human readable representation of io to the f.

Define Documentation

#define CL_IO_SLICE_CLEAN ( foo_io,
base   ) 

Value:

do {                                                                    \
        typeof(foo_io) __foo_io = (foo_io);                             \
                                                                        \
        CLASSERT(offsetof(typeof(*__foo_io), base) == 0);               \
        memset(&__foo_io->base + 1, 0,                                  \
               (sizeof *__foo_io) - sizeof __foo_io->base);             \
} while (0)


Enumeration Type Documentation

enum cl_io_lock_dmd

Lock requirements(demand) for IO.

It should be cl_io_lock_req, but 'req' is always to be thought as 'request' :-)

Enumerator:
CILR_MANDATORY  Always lock data (e.g., O_APPEND).
CILR_MAYBE  Layers are free to decide between local and global locking.
CILR_NEVER  Never lock: there is no cache (e.g., liblustre).

enum cl_io_state

States of cl_io state machine.

Enumerator:
CIS_ZERO  Not initialized.
CIS_INIT  Initialized.
CIS_IT_STARTED  IO iteration started.
CIS_LOCKED  Locks taken.
CIS_IO_GOING  Actual IO is in progress.
CIS_IO_FINISHED  IO for the current iteration finished.
CIS_UNLOCKED  Locks released.
CIS_IT_ENDED  Iteration completed.
CIS_FINI  cl_io finalized.

enum cl_io_type

IO types.

Enumerator:
CIT_READ  read system call
CIT_WRITE  write system call
CIT_SETATTR  truncate, utime system calls
CIT_FAULT  page fault handling
CIT_MISC  Miscellaneous io.

This is used for occasional io activity that doesn't fit into other types. Currently this is used for:

  • cancellation of an extent lock. This io exists as a context to write dirty pages from under the lock being canceled back to the server;

  • VM induced page write-out. An io context for writing page out for memory cleansing;

  • glimpse. An io context to acquire glimpse lock.

  • grouplock. An io context to acquire group lock.

CIT_MISC io is used simply as a context in which locks and pages are manipulated. Such io has no internal "process", that is, cl_io_loop() is never called for it.


Function Documentation

int cl_io_commit_write ( const struct lu_env env,
struct cl_io io,
struct cl_page page,
unsigned  from,
unsigned  to 
)

Called by write io after user data were copied into a page.

See also:
cl_io_operations::cio_commit_write()

int cl_io_init ( const struct lu_env env,
struct cl_io io,
enum cl_io_type  iot,
struct cl_object obj 
)

Initialize io, by calling cl_io_operations::cio_init() top-to-bottom.

Caller has to call cl_io_fini() after a call to cl_io_init(), no matter what the latter returned.

Precondition:
obj == cl_object_top(obj)

cl_io_type_is_valid(iot)

Postcondition:
cl_io_type_is_valid(io->ci_type) && io->ci_type == iot

void cl_io_iter_fini ( const struct lu_env env,
struct cl_io io 
)

Finalizes io iteration.

Calls cl_io_operations::cio_iter_fini() bottom-to-top.

int cl_io_iter_init ( const struct lu_env env,
struct cl_io io 
)

Prepares next iteration of io.

Calls cl_io_operations::cio_iter_init() top-to-bottom. This exists to give layers a chance to modify io parameters, e.g., so that lov can restrict io to a single stripe.

int cl_io_lock ( const struct lu_env env,
struct cl_io io 
)

Takes locks necessary for the current iteration of io.

Calls cl_io_operations::cio_lock() top-to-bottom to collect locks required by layers for the current iteration. Then sort locks (to avoid dead-locks), and acquire them.

int cl_io_loop ( const struct lu_env env,
struct cl_io io 
)

Main io loop.

Pumps io through iterations calling

repeatedly until there is no more io to do.

int cl_io_prepare_write ( const struct lu_env env,
struct cl_io io,
struct cl_page page,
unsigned  from,
unsigned  to 
)

Called by write io to prepare page to receive data from user buffer.

See also:
cl_io_operations::cio_prepare_write()

int cl_io_read_page ( const struct lu_env env,
struct cl_io io,
struct cl_page page 
)

Called by read io, when page has to be read from the server.

See also:
cl_io_operations::cio_read_page()

int cl_io_rw_init ( const struct lu_env env,
struct cl_io io,
enum cl_io_type  iot,
loff_t  pos,
size_t  count 
)

Initialize read or write io.

Precondition:
iot == CIT_READ || iot == CIT_WRITE

int cl_io_sub_init ( const struct lu_env env,
struct cl_io io,
enum cl_io_type  iot,
struct cl_object obj 
)

Initialize sub-io, by calling cl_io_operations::cio_init() top-to-bottom.

Precondition:
obj != cl_object_top(obj)

int cl_io_submit_rw ( const struct lu_env env,
struct cl_io io,
enum cl_req_type  crt,
struct cl_2queue queue,
enum cl_req_priority  priority 
)

Submits a list of pages for immediate io.

After the function gets returned, The submitted pages are moved to queue->c2_qout queue, and queue->c2_qin contain both the pages don't need to be submitted, and the pages are errant to submit.

Returns:
0 if at least one page was submitted, error code otherwise.
See also:
cl_io_operations::cio_submit()

int cl_io_submit_sync ( const struct lu_env env,
struct cl_io io,
enum cl_req_type  iot,
struct cl_2queue queue,
enum cl_req_priority  prio,
long  timeout 
)

Submit a sync_io and wait for the IO to be finished, or error happens.

If timeout is zero, it means to wait for the IO unconditionally.

struct cl_io* cl_io_top ( struct cl_io io  ) 

Returns top-level io.

See also:
cl_object_top(), cl_page_top().


Generated on Mon Apr 12 04:18:21 2010 for Lustre 1.10.0.40-0-g9a80ff7 by doxygen 1.4.7

Contact | About Sun | News | Employment | Privacy | Terms of Use | Trademarks | (C) 2008 Sun Microsystems, Inc.