Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
glock.c File Reference
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/buffer_head.h>
#include <linux/delay.h>
#include <linux/sort.h>
#include <linux/jhash.h>
#include <linux/kallsyms.h>
#include <linux/gfs2_ondisk.h>
#include <linux/list.h>
#include <linux/wait.h>
#include <linux/module.h>
#include <asm/uaccess.h>
#include <linux/seq_file.h>
#include <linux/debugfs.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/workqueue.h>
#include <linux/jiffies.h>
#include <linux/rcupdate.h>
#include <linux/rculist_bl.h>
#include <linux/bit_spinlock.h>
#include <linux/percpu.h>
#include "gfs2.h"
#include "incore.h"
#include "glock.h"
#include "glops.h"
#include "inode.h"
#include "lops.h"
#include "meta_io.h"
#include "quota.h"
#include "super.h"
#include "util.h"
#include "bmap.h"
#include "trace_gfs2.h"

Go to the source code of this file.

Data Structures

struct  gfs2_glock_iter
 

Macros

#define CREATE_TRACE_POINTS
 
#define GLOCK_BUG_ON(gl, x)   do { if (unlikely(x)) { __dump_glock(NULL, gl); BUG(); } } while(0)
 
#define GFS2_GL_HASH_SHIFT   15
 
#define GFS2_GL_HASH_SIZE   (1 << GFS2_GL_HASH_SHIFT)
 
#define GFS2_GL_HASH_MASK   (GFS2_GL_HASH_SIZE - 1)
 

Typedefs

typedef void(* glock_examiner )(struct gfs2_glock *gl)
 

Functions

void gfs2_glock_free (struct gfs2_glock *gl)
 
void gfs2_glock_hold (struct gfs2_glock *gl)
 
void gfs2_glock_add_to_lru (struct gfs2_glock *gl)
 
void gfs2_glock_put_nolock (struct gfs2_glock *gl)
 
void gfs2_glock_put (struct gfs2_glock *gl)
 

Variables

struct workqueue_structgfs2_delete_workqueue
 

: The lock name

search_bucket() - Find struct gfs2_glock by lock number : the bucket to search

Returns: NULL, or the struct gfs2_glock with the requested number

#define GFS2_NR_SBSTATS   (ARRAY_SIZE(gfs2_gltype) * ARRAY_SIZE(gfs2_stype))
 
#define GFS2_SEQ_GOODSIZE   min(PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER, 65536UL)
 
int gfs2_glock_get (struct gfs2_sbd *sdp, u64 number, const struct gfs2_glock_operations *glops, int create, struct gfs2_glock **glp)
 
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_wait (struct gfs2_holder *gh)
 
void gfs2_print_dbg (struct seq_file *seq, const char *fmt,...)
 
int gfs2_glock_nq (struct gfs2_holder *gh)
 
int gfs2_glock_poll (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)
 
void gfs2_glock_cb (struct gfs2_glock *gl, unsigned int state)
 
void gfs2_glock_complete (struct gfs2_glock *gl, int ret)
 
void gfs2_glock_thaw (struct gfs2_sbd *sdp)
 
void gfs2_gl_hash_clear (struct gfs2_sbd *sdp)
 
void gfs2_glock_finish_truncate (struct gfs2_inode *ip)
 
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)
 

Macro Definition Documentation

#define CREATE_TRACE_POINTS

Definition at line 45 of file glock.c.

#define GFS2_GL_HASH_MASK   (GFS2_GL_HASH_SIZE - 1)

Definition at line 71 of file glock.c.

#define GFS2_GL_HASH_SHIFT   15

Definition at line 69 of file glock.c.

#define GFS2_GL_HASH_SIZE   (1 << GFS2_GL_HASH_SHIFT)

Definition at line 70 of file glock.c.

#define GFS2_NR_SBSTATS   (ARRAY_SIZE(gfs2_gltype) * ARRAY_SIZE(gfs2_stype))

Definition at line 1752 of file glock.c.

#define GFS2_SEQ_GOODSIZE   min(PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER, 65536UL)

Definition at line 1956 of file glock.c.

#define GLOCK_BUG_ON (   gl,
  x 
)    do { if (unlikely(x)) { __dump_glock(NULL, gl); BUG(); } } while(0)

Definition at line 59 of file glock.c.

Typedef Documentation

typedef void(* glock_examiner)(struct gfs2_glock *gl)

Definition at line 56 of file glock.c.

Function Documentation

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.

void gfs2_print_dbg ( struct seq_file seq,
const char fmt,
  ... 
)

Definition at line 920 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

struct workqueue_struct* gfs2_delete_workqueue

Definition at line 64 of file glock.c.