#define pr_fmt(fmt) …
#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/hash.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 <linux/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 <linux/list_sort.h>
#include <linux/lockref.h>
#include <linux/rhashtable.h>
#include <linux/pid_namespace.h>
#include <linux/fdtable.h>
#include <linux/file.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"
#define CREATE_TRACE_POINTS
#include "trace_gfs2.h"
struct gfs2_glock_iter { … };
glock_examiner;
static void do_xmote(struct gfs2_glock *gl, struct gfs2_holder *gh, unsigned int target);
static void request_demote(struct gfs2_glock *gl, unsigned int state,
unsigned long delay, bool remote);
static struct dentry *gfs2_root;
static LIST_HEAD(lru_list);
static atomic_t lru_count = …;
static DEFINE_SPINLOCK(lru_lock);
#define GFS2_GL_HASH_SHIFT …
#define GFS2_GL_HASH_SIZE …
static const struct rhashtable_params ht_parms = …;
static struct rhashtable gl_hash_table;
#define GLOCK_WAIT_TABLE_BITS …
#define GLOCK_WAIT_TABLE_SIZE …
static wait_queue_head_t glock_wait_table[GLOCK_WAIT_TABLE_SIZE] __cacheline_aligned;
struct wait_glock_queue { … };
static int glock_wake_function(wait_queue_entry_t *wait, unsigned int mode,
int sync, void *key)
{ … }
static wait_queue_head_t *glock_waitqueue(struct lm_lockname *name)
{ … }
static void wake_up_glock(struct gfs2_glock *gl)
{ … }
static void gfs2_glock_dealloc(struct rcu_head *rcu)
{ … }
static bool glock_blocked_by_withdraw(struct gfs2_glock *gl)
{ … }
static void __gfs2_glock_free(struct gfs2_glock *gl)
{ … }
void gfs2_glock_free(struct gfs2_glock *gl) { … }
void gfs2_glock_free_later(struct gfs2_glock *gl) { … }
static void gfs2_free_dead_glocks(struct gfs2_sbd *sdp)
{ … }
struct gfs2_glock *gfs2_glock_hold(struct gfs2_glock *gl)
{ … }
static void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
{ … }
static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl)
{ … }
static void gfs2_glock_queue_work(struct gfs2_glock *gl, unsigned long delay) { … }
static void __gfs2_glock_put(struct gfs2_glock *gl)
{ … }
static bool __gfs2_glock_put_or_lock(struct gfs2_glock *gl)
{ … }
void gfs2_glock_put(struct gfs2_glock *gl)
{ … }
void gfs2_glock_put_async(struct gfs2_glock *gl)
{ … }
static inline bool may_grant(struct gfs2_glock *gl,
struct gfs2_holder *current_gh,
struct gfs2_holder *gh)
{ … }
static void gfs2_holder_wake(struct gfs2_holder *gh)
{ … }
static void do_error(struct gfs2_glock *gl, const int ret)
{ … }
static inline struct gfs2_holder *find_first_holder(const struct gfs2_glock *gl)
{ … }
int gfs2_instantiate(struct gfs2_holder *gh)
{ … }
static bool do_promote(struct gfs2_glock *gl)
{ … }
static inline struct gfs2_holder *find_first_waiter(const struct gfs2_glock *gl)
{ … }
static inline struct gfs2_holder *find_last_waiter(const struct gfs2_glock *gl)
{ … }
static void state_change(struct gfs2_glock *gl, unsigned int new_state)
{ … }
static void gfs2_set_demote(struct gfs2_glock *gl)
{ … }
static void gfs2_demote_wake(struct gfs2_glock *gl)
{ … }
static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
{ … }
static bool is_system_glock(struct gfs2_glock *gl)
{ … }
static void do_xmote(struct gfs2_glock *gl, struct gfs2_holder *gh,
unsigned int target)
__releases(&gl->gl_lockref.lock)
__acquires(&gl->gl_lockref.lock)
{ … }
static void run_queue(struct gfs2_glock *gl, const int nonblock)
__releases(&gl->gl_lockref.lock)
__acquires(&gl->gl_lockref.lock)
{ … }
void glock_set_object(struct gfs2_glock *gl, void *object)
{ … }
void glock_clear_object(struct gfs2_glock *gl, void *object)
{ … }
void gfs2_inode_remember_delete(struct gfs2_glock *gl, u64 generation)
{ … }
bool gfs2_inode_already_deleted(struct gfs2_glock *gl, u64 generation)
{ … }
static void gfs2_glock_poke(struct gfs2_glock *gl)
{ … }
static bool gfs2_try_evict(struct gfs2_glock *gl)
{ … }
bool gfs2_queue_try_to_evict(struct gfs2_glock *gl)
{ … }
static bool gfs2_queue_verify_evict(struct gfs2_glock *gl)
{ … }
static void delete_work_func(struct work_struct *work)
{ … }
static void glock_work_func(struct work_struct *work)
{ … }
static struct gfs2_glock *find_insert_glock(struct lm_lockname *name,
struct gfs2_glock *new)
{ … }
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, u16 flags,
struct gfs2_holder *gh, unsigned long ip)
{ … }
void gfs2_holder_reinit(unsigned int state, u16 flags, struct gfs2_holder *gh)
{ … }
void gfs2_holder_uninit(struct gfs2_holder *gh)
{ … }
static void gfs2_glock_update_hold_time(struct gfs2_glock *gl,
unsigned long start_time)
{ … }
int gfs2_glock_holder_ready(struct gfs2_holder *gh)
{ … }
int gfs2_glock_wait(struct gfs2_holder *gh)
{ … }
static int glocks_pending(unsigned int num_gh, struct gfs2_holder *ghs)
{ … }
int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs)
{ … }
static void request_demote(struct gfs2_glock *gl, unsigned int state,
unsigned long delay, bool remote)
{ … }
void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...)
{ … }
static inline bool pid_is_meaningful(const struct gfs2_holder *gh)
{ … }
static inline void add_to_queue(struct gfs2_holder *gh)
__releases(&gl->gl_lockref.lock)
__acquires(&gl->gl_lockref.lock)
{ … }
int gfs2_glock_nq(struct gfs2_holder *gh)
{ … }
int gfs2_glock_poll(struct gfs2_holder *gh)
{ … }
static inline bool needs_demote(struct gfs2_glock *gl)
{ … }
static void __gfs2_glock_dq(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, u16 flags, struct gfs2_holder *gh)
{ … }
static int glock_compare(const void *arg_a, const void *arg_b)
{ … }
static int nq_m_sync(unsigned int num_gh, struct gfs2_holder *ghs,
struct gfs2_holder **p)
{ … }
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_cb(struct gfs2_glock *gl, unsigned int state)
{ … }
static int gfs2_should_freeze(const struct gfs2_glock *gl)
{ … }
void gfs2_glock_complete(struct gfs2_glock *gl, int ret)
{ … }
static int glock_cmp(void *priv, const struct list_head *a,
const struct list_head *b)
{ … }
static bool can_free_glock(struct gfs2_glock *gl)
{ … }
static unsigned long gfs2_dispose_glock_lru(struct list_head *list)
__releases(&lru_lock)
__acquires(&lru_lock)
{ … }
static unsigned long gfs2_scan_glock_lru(unsigned long nr)
{ … }
static unsigned long gfs2_glock_shrink_scan(struct shrinker *shrink,
struct shrink_control *sc)
{ … }
static unsigned long gfs2_glock_shrink_count(struct shrinker *shrink,
struct shrink_control *sc)
{ … }
static struct shrinker *glock_shrinker;
static void glock_hash_walk(glock_examiner examiner, const struct gfs2_sbd *sdp)
{ … }
void gfs2_cancel_delete_work(struct gfs2_glock *gl)
{ … }
static void flush_delete_work(struct gfs2_glock *gl)
{ … }
void gfs2_flush_delete_work(struct gfs2_sbd *sdp)
{ … }
static void thaw_glock(struct gfs2_glock *gl)
{ … }
static void clear_glock(struct gfs2_glock *gl)
{ … }
void gfs2_glock_thaw(struct gfs2_sbd *sdp)
{ … }
static void dump_glock(struct seq_file *seq, struct gfs2_glock *gl, bool fsid)
{ … }
static void dump_glock_func(struct gfs2_glock *gl)
{ … }
static void withdraw_dq(struct gfs2_glock *gl)
{ … }
void gfs2_gl_dq_holders(struct gfs2_sbd *sdp)
{ … }
void gfs2_gl_hash_clear(struct gfs2_sbd *sdp)
{ … }
static const char *state2str(unsigned state)
{ … }
static const char *hflags2str(char *buf, u16 flags, unsigned long iflags)
{ … }
static void dump_holder(struct seq_file *seq, const struct gfs2_holder *gh,
const char *fs_id_buf)
{ … }
static const char *gflags2str(char *buf, const struct gfs2_glock *gl)
{ … }
void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl, bool fsid)
{ … }
static int gfs2_glstats_seq_show(struct seq_file *seq, void *iter_ptr)
{ … }
static const char *gfs2_gltype[] = …;
static const char *gfs2_stype[] = …;
#define GFS2_NR_SBSTATS …
static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr)
{ … }
int __init gfs2_glock_init(void)
{ … }
void gfs2_glock_exit(void)
{ … }
static void gfs2_glock_iter_next(struct gfs2_glock_iter *gi, loff_t n)
{ … }
static void *gfs2_glock_seq_start(struct seq_file *seq, loff_t *pos)
__acquires(RCU)
{ … }
static void *gfs2_glock_seq_next(struct seq_file *seq, void *iter_ptr,
loff_t *pos)
{ … }
static void gfs2_glock_seq_stop(struct seq_file *seq, void *iter_ptr)
__releases(RCU)
{ … }
static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr)
{ … }
static void *gfs2_sbstats_seq_start(struct seq_file *seq, loff_t *pos)
{ … }
static void *gfs2_sbstats_seq_next(struct seq_file *seq, void *iter_ptr,
loff_t *pos)
{ … }
static void gfs2_sbstats_seq_stop(struct seq_file *seq, void *iter_ptr)
{ … }
static const struct seq_operations gfs2_glock_seq_ops = …;
static const struct seq_operations gfs2_glstats_seq_ops = …;
static const struct seq_operations gfs2_sbstats_sops = …;
#define GFS2_SEQ_GOODSIZE …
static int __gfs2_glocks_open(struct inode *inode, struct file *file,
const struct seq_operations *ops)
{ … }
static int gfs2_glocks_open(struct inode *inode, struct file *file)
{ … }
static int gfs2_glocks_release(struct inode *inode, struct file *file)
{ … }
static int gfs2_glstats_open(struct inode *inode, struct file *file)
{ … }
static const struct file_operations gfs2_glocks_fops = …;
static const struct file_operations gfs2_glstats_fops = …;
struct gfs2_glockfd_iter { … };
static struct task_struct *gfs2_glockfd_next_task(struct gfs2_glockfd_iter *i)
{ … }
static struct file *gfs2_glockfd_next_file(struct gfs2_glockfd_iter *i)
{ … }
static void *gfs2_glockfd_seq_start(struct seq_file *seq, loff_t *pos)
{ … }
static void *gfs2_glockfd_seq_next(struct seq_file *seq, void *iter_ptr,
loff_t *pos)
{ … }
static void gfs2_glockfd_seq_stop(struct seq_file *seq, void *iter_ptr)
{ … }
static void gfs2_glockfd_seq_show_flock(struct seq_file *seq,
struct gfs2_glockfd_iter *i)
{ … }
static int gfs2_glockfd_seq_show(struct seq_file *seq, void *iter_ptr)
{ … }
static const struct seq_operations gfs2_glockfd_seq_ops = …;
static int gfs2_glockfd_open(struct inode *inode, struct file *file)
{ … }
static const struct file_operations gfs2_glockfd_fops = …;
DEFINE_SEQ_ATTRIBUTE(…);
void gfs2_create_debugfs_file(struct gfs2_sbd *sdp)
{ … }
void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp)
{ … }
void gfs2_register_debugfs(void)
{ … }
void gfs2_unregister_debugfs(void)
{ … }