Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
glock.h File Reference
#include <linux/sched.h>
#include <linux/parser.h>
#include "incore.h"

Go to the source code of this file.

Data Structures

struct  lm_lockops
 

Macros

#define LM_TYPE_RESERVED   0x00
 
#define LM_TYPE_NONDISK   0x01
 
#define LM_TYPE_INODE   0x02
 
#define LM_TYPE_RGRP   0x03
 
#define LM_TYPE_META   0x04
 
#define LM_TYPE_IOPEN   0x05
 
#define LM_TYPE_FLOCK   0x06
 
#define LM_TYPE_PLOCK   0x07
 
#define LM_TYPE_QUOTA   0x08
 
#define LM_TYPE_JOURNAL   0x09
 
#define LM_ST_UNLOCKED   0
 
#define LM_ST_EXCLUSIVE   1
 
#define LM_ST_DEFERRED   2
 
#define LM_ST_SHARED   3
 
#define LM_FLAG_TRY   0x00000001
 
#define LM_FLAG_TRY_1CB   0x00000002
 
#define LM_FLAG_NOEXP   0x00000004
 
#define LM_FLAG_ANY   0x00000008
 
#define LM_FLAG_PRIORITY   0x00000010
 
#define GL_ASYNC   0x00000040
 
#define GL_EXACT   0x00000080
 
#define GL_SKIP   0x00000100
 
#define GL_NOCACHE   0x00000400
 
#define LM_OUT_ST_MASK   0x00000003
 
#define LM_OUT_CANCELED   0x00000008
 
#define LM_OUT_ERROR   0x00000004
 
#define LM_RD_GAVEUP   308
 
#define LM_RD_SUCCESS   309
 
#define GLR_TRYFAILED   13
 
#define GL_GLOCK_MAX_HOLD   (long)(HZ / 5)
 
#define GL_GLOCK_DFT_HOLD   (long)(HZ / 5)
 
#define GL_GLOCK_MIN_HOLD   (long)(10)
 
#define GL_GLOCK_HOLD_INCR   (long)(HZ / 20)
 
#define GL_GLOCK_HOLD_DECR   (long)(HZ / 40)
 

Enumerations

enum  {
  Opt_jid, Opt_id, Opt_first, Opt_nodir,
  Opt_err
}
 

Functions

int gfs2_glock_get (struct gfs2_sbd *sdp, u64 number, const struct gfs2_glock_operations *glops, int create, struct gfs2_glock **glp)
 
void gfs2_glock_hold (struct gfs2_glock *gl)
 
void gfs2_glock_put_nolock (struct gfs2_glock *gl)
 
void gfs2_glock_put (struct gfs2_glock *gl)
 
void gfs2_holder_init (struct gfs2_glock *gl, unsigned int state, unsigned flags, struct gfs2_holder *gh)
 
void gfs2_holder_reinit (unsigned int state, unsigned flags, struct gfs2_holder *gh)
 
void gfs2_holder_uninit (struct gfs2_holder *gh)
 
int gfs2_glock_nq (struct gfs2_holder *gh)
 
int gfs2_glock_poll (struct gfs2_holder *gh)
 
int gfs2_glock_wait (struct gfs2_holder *gh)
 
void gfs2_glock_dq (struct gfs2_holder *gh)
 
void gfs2_glock_dq_wait (struct gfs2_holder *gh)
 
void gfs2_glock_dq_uninit (struct gfs2_holder *gh)
 
int gfs2_glock_nq_num (struct gfs2_sbd *sdp, u64 number, const struct gfs2_glock_operations *glops, unsigned int state, int flags, struct gfs2_holder *gh)
 
int gfs2_glock_nq_m (unsigned int num_gh, struct gfs2_holder *ghs)
 
void gfs2_glock_dq_m (unsigned int num_gh, struct gfs2_holder *ghs)
 
void gfs2_glock_dq_uninit_m (unsigned int num_gh, struct gfs2_holder *ghs)
 
 __printf (2, 3) void gfs2_print_dbg(struct seq_file *seq
 
void gfs2_glock_cb (struct gfs2_glock *gl, unsigned int state)
 
void gfs2_glock_complete (struct gfs2_glock *gl, int ret)
 
void gfs2_gl_hash_clear (struct gfs2_sbd *sdp)
 
void gfs2_glock_finish_truncate (struct gfs2_inode *ip)
 
void gfs2_glock_thaw (struct gfs2_sbd *sdp)
 
void gfs2_glock_add_to_lru (struct gfs2_glock *gl)
 
void gfs2_glock_free (struct gfs2_glock *gl)
 
int __init gfs2_glock_init (void)
 
void gfs2_glock_exit (void)
 
int gfs2_create_debugfs_file (struct gfs2_sbd *sdp)
 
void gfs2_delete_debugfs_file (struct gfs2_sbd *sdp)
 
int gfs2_register_debugfs (void)
 
void gfs2_unregister_debugfs (void)
 

Variables

struct workqueue_structgfs2_delete_workqueue
 
const charfmt
 
struct lm_lockops gfs2_dlm_ops
 

Macro Definition Documentation

#define GL_ASYNC   0x00000040

Definition at line 87 of file glock.h.

#define GL_EXACT   0x00000080

Definition at line 88 of file glock.h.

#define GL_GLOCK_DFT_HOLD   (long)(HZ / 5)

Definition at line 117 of file glock.h.

#define GL_GLOCK_HOLD_DECR   (long)(HZ / 40)

Definition at line 120 of file glock.h.

#define GL_GLOCK_HOLD_INCR   (long)(HZ / 20)

Definition at line 119 of file glock.h.

#define GL_GLOCK_MAX_HOLD   (long)(HZ / 5)

Definition at line 116 of file glock.h.

#define GL_GLOCK_MIN_HOLD   (long)(10)

Definition at line 118 of file glock.h.

#define GL_NOCACHE   0x00000400

Definition at line 90 of file glock.h.

#define GL_SKIP   0x00000100

Definition at line 89 of file glock.h.

#define GLR_TRYFAILED   13

Definition at line 114 of file glock.h.

#define LM_FLAG_ANY   0x00000008

Definition at line 85 of file glock.h.

#define LM_FLAG_NOEXP   0x00000004

Definition at line 84 of file glock.h.

#define LM_FLAG_PRIORITY   0x00000010

Definition at line 86 of file glock.h.

#define LM_FLAG_TRY   0x00000001

Definition at line 82 of file glock.h.

#define LM_FLAG_TRY_1CB   0x00000002

Definition at line 83 of file glock.h.

#define LM_OUT_CANCELED   0x00000008

Definition at line 104 of file glock.h.

#define LM_OUT_ERROR   0x00000004

Definition at line 105 of file glock.h.

#define LM_OUT_ST_MASK   0x00000003

Definition at line 103 of file glock.h.

#define LM_RD_GAVEUP   308

Definition at line 111 of file glock.h.

#define LM_RD_SUCCESS   309

Definition at line 112 of file glock.h.

#define LM_ST_DEFERRED   2

Definition at line 51 of file glock.h.

#define LM_ST_EXCLUSIVE   1

Definition at line 50 of file glock.h.

#define LM_ST_SHARED   3

Definition at line 52 of file glock.h.

#define LM_ST_UNLOCKED   0

Definition at line 49 of file glock.h.

#define LM_TYPE_FLOCK   0x06

Definition at line 37 of file glock.h.

#define LM_TYPE_INODE   0x02

Definition at line 33 of file glock.h.

#define LM_TYPE_IOPEN   0x05

Definition at line 36 of file glock.h.

#define LM_TYPE_JOURNAL   0x09

Definition at line 40 of file glock.h.

#define LM_TYPE_META   0x04

Definition at line 35 of file glock.h.

#define LM_TYPE_NONDISK   0x01

Definition at line 32 of file glock.h.

#define LM_TYPE_PLOCK   0x07

Definition at line 38 of file glock.h.

#define LM_TYPE_QUOTA   0x08

Definition at line 39 of file glock.h.

#define LM_TYPE_RESERVED   0x00

Definition at line 31 of file glock.h.

#define LM_TYPE_RGRP   0x03

Definition at line 34 of file glock.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
Opt_jid 
Opt_id 
Opt_first 
Opt_nodir 
Opt_err 

Definition at line 19 of file glock.h.

Function Documentation

__printf ( ,
 
)
int gfs2_create_debugfs_file ( struct gfs2_sbd sdp)

Definition at line 2024 of file glock.c.

void gfs2_delete_debugfs_file ( struct gfs2_sbd sdp)

Definition at line 2056 of file glock.c.

void gfs2_gl_hash_clear ( struct gfs2_sbd sdp)

gfs2_gl_hash_clear - Empty out the glock hash table : the filesystem : wait until it's all gone

Called when unmounting the filesystem.

Definition at line 1529 of file glock.c.

void gfs2_glock_add_to_lru ( struct gfs2_glock gl)

Definition at line 158 of file glock.c.

void gfs2_glock_cb ( struct gfs2_glock gl,
unsigned int  state 
)

Definition at line 1283 of file glock.c.

void gfs2_glock_complete ( struct gfs2_glock gl,
int  ret 
)

gfs2_glock_complete - Callback used by locking : Pointer to the glock : The return value from the dlm

The gl_reply field is under the gl_spin lock so that it is ok to use a bitfield shared with other glock state fields.

Definition at line 1345 of file glock.c.

void gfs2_glock_dq ( struct gfs2_holder gh)

gfs2_glock_dq - dequeue a struct gfs2_holder from a glock (release a glock) : the glock holder

Definition at line 1073 of file glock.c.

void gfs2_glock_dq_m ( unsigned int  num_gh,
struct gfs2_holder ghs 
)

gfs2_glock_dq_m - release multiple glocks : the number of structures : an array of struct gfs2_holder structures

Definition at line 1264 of file glock.c.

void gfs2_glock_dq_uninit ( struct gfs2_holder gh)

gfs2_glock_dq_uninit - dequeue a holder from a glock and initialize it : the holder structure

Definition at line 1129 of file glock.c.

void gfs2_glock_dq_uninit_m ( unsigned int  num_gh,
struct gfs2_holder ghs 
)

gfs2_glock_dq_uninit_m - release multiple glocks : the number of structures : an array of struct gfs2_holder structures

Definition at line 1277 of file glock.c.

void gfs2_glock_dq_wait ( struct gfs2_holder gh)

Definition at line 1115 of file glock.c.

void gfs2_glock_exit ( void  )

Definition at line 1806 of file glock.c.

void gfs2_glock_finish_truncate ( struct gfs2_inode ip)

Definition at line 1537 of file glock.c.

void gfs2_glock_free ( struct gfs2_glock gl)

Definition at line 116 of file glock.c.

int gfs2_glock_get ( struct gfs2_sbd sdp,
u64  number,
const struct gfs2_glock_operations glops,
int  create,
struct gfs2_glock **  glp 
)

gfs2_glock_get() - Get a glock, or create one if one doesn't exist : The GFS2 superblock : the lock number : The glock_operations to use : If 0, don't create the glock if it doesn't exist : the glock is returned here

This does not lock a glock, just finds/creates structures for one.

Returns: errno

Definition at line 710 of file glock.c.

void gfs2_glock_hold ( struct gfs2_glock gl)

gfs2_glock_hold() - increment reference count on glock : The glock to hold

Definition at line 131 of file glock.c.

int __init gfs2_glock_init ( void  )

Definition at line 1782 of file glock.c.

int gfs2_glock_nq ( struct gfs2_holder gh)

gfs2_glock_nq - enqueue a struct gfs2_holder onto a glock (acquire a glock) : the holder structure

if (gh->gh_flags & GL_ASYNC), this never returns an error

Returns: 0, GLR_TRYFAILED, or errno on failure

Definition at line 1029 of file glock.c.

int gfs2_glock_nq_m ( unsigned int  num_gh,
struct gfs2_holder ghs 
)

gfs2_glock_nq_m - acquire multiple glocks : the number of structures : an array of struct gfs2_holder structures

Returns: 0 on success (all glocks acquired), errno on failure (no glocks acquired)

Definition at line 1229 of file glock.c.

int gfs2_glock_nq_num ( struct gfs2_sbd sdp,
u64  number,
const struct gfs2_glock_operations glops,
unsigned int  state,
int  flags,
struct gfs2_holder gh 
)

gfs2_glock_nq_num - acquire a glock based on lock number : the filesystem : the lock number : the glock operations for the type of glock : the state to acquire the glock in : modifier flags for the acquisition : the struct gfs2_holder

Returns: errno

Definition at line 1147 of file glock.c.

int gfs2_glock_poll ( struct gfs2_holder gh)

gfs2_glock_poll - poll to see if an async request has been completed : the holder

Returns: 1 if the request is ready to be gfs2_glock_wait()ed on

Definition at line 1062 of file glock.c.

void gfs2_glock_put ( struct gfs2_glock gl)

gfs2_glock_put() - Decrement reference count on glock : The glock to put

Definition at line 208 of file glock.c.

void gfs2_glock_put_nolock ( struct gfs2_glock gl)

gfs2_glock_put_nolock() - Decrement reference count on glock : The glock to put

This function should only be used if the caller has its own reference to the glock, in addition to the one it is dropping.

Definition at line 196 of file glock.c.

void gfs2_glock_thaw ( struct gfs2_sbd sdp)

gfs2_glock_thaw - Thaw any frozen glocks : The super block

Definition at line 1502 of file glock.c.

int gfs2_glock_wait ( struct gfs2_holder gh)

gfs2_glock_wait - wait on a glock acquisition : the glock holder

Returns: 0 on success

Definition at line 879 of file glock.c.

void gfs2_holder_init ( struct gfs2_glock gl,
unsigned int  state,
unsigned  flags,
struct gfs2_holder gh 
)

gfs2_holder_init - initialize a struct gfs2_holder in the default way : the glock : the state we're requesting : the modifier flags : the holder structure

Definition at line 802 of file glock.c.

void gfs2_holder_reinit ( unsigned int  state,
unsigned  flags,
struct gfs2_holder gh 
)

gfs2_holder_reinit - reinitialize a struct gfs2_holder so we can requeue it : the state we're requesting : the modifier flags : the holder structure

Don't mess with the glock.

Definition at line 826 of file glock.c.

void gfs2_holder_uninit ( struct gfs2_holder gh)

gfs2_holder_uninit - uninitialize a holder structure (drop glock reference) : the holder structure

Definition at line 843 of file glock.c.

int gfs2_register_debugfs ( void  )

Definition at line 2076 of file glock.c.

void gfs2_unregister_debugfs ( void  )

Definition at line 2082 of file glock.c.

Variable Documentation

const char* fmt

Definition at line 208 of file glock.h.

struct workqueue_struct* gfs2_delete_workqueue

Definition at line 64 of file glock.c.

struct lm_lockops gfs2_dlm_ops

Definition at line 1312 of file lock_dlm.c.