block: avoid unconditionally freeing previously allocated request_queue
[safe/jmp/linux-2.6] / fs / dlm / dlm_internal.h
index d30ea8b..f632b58 100644 (file)
@@ -2,7 +2,7 @@
 *******************************************************************************
 **
 **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
-**  Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2010 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
 #include <linux/jhash.h>
 #include <linux/miscdevice.h>
 #include <linux/mutex.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #include <linux/dlm.h>
 #include "config.h"
 
-#define DLM_LOCKSPACE_LEN      64
-
 /* Size of the temp buffer midcomms allocates on the stack.
    We try to make this large enough so most messages fit.
    FIXME: should sctp make this unnecessary? */
@@ -102,13 +99,13 @@ struct dlm_direntry {
 
 struct dlm_dirtable {
        struct list_head        list;
-       rwlock_t                lock;
+       spinlock_t              lock;
 };
 
 struct dlm_rsbtable {
        struct list_head        list;
        struct list_head        toss;
-       rwlock_t                lock;
+       spinlock_t              lock;
 };
 
 struct dlm_lkbtable {
@@ -133,8 +130,10 @@ struct dlm_member {
 
 struct dlm_recover {
        struct list_head        list;
-       int                     *nodeids;
+       int                     *nodeids;   /* nodeids of all members */
        int                     node_count;
+       int                     *new;       /* nodeids of new members */
+       int                     new_count;
        uint64_t                seq;
 };
 
@@ -233,11 +232,17 @@ struct dlm_lkb {
        int8_t                  lkb_status;     /* granted, waiting, convert */
        int8_t                  lkb_rqmode;     /* requested lock mode */
        int8_t                  lkb_grmode;     /* granted lock mode */
-       int8_t                  lkb_bastmode;   /* requested mode */
        int8_t                  lkb_highbast;   /* highest mode bast sent for */
+
        int8_t                  lkb_wait_type;  /* type of reply waiting for */
        int8_t                  lkb_wait_count;
        int8_t                  lkb_ast_type;   /* type of ast queued for */
+       int8_t                  lkb_ast_first;  /* type of first ast queued */
+
+       int8_t                  lkb_bastmode;   /* req mode of queued bast */
+       int8_t                  lkb_castmode;   /* gr mode of queued cast */
+       int8_t                  lkb_bastmode_done; /* last delivered bastmode */
+       int8_t                  lkb_castmode_done; /* last delivered castmode */
 
        struct list_head        lkb_idtbl_list; /* lockspace lkbtbl */
        struct list_head        lkb_statequeue; /* rsb g/c/w list */
@@ -246,7 +251,8 @@ struct dlm_lkb {
        struct list_head        lkb_astqueue;   /* need ast to be sent */
        struct list_head        lkb_ownqueue;   /* list of locks for a process */
        struct list_head        lkb_time_list;
-       unsigned long           lkb_timestamp;
+       ktime_t                 lkb_time_bast;  /* for debugging */
+       ktime_t                 lkb_timestamp;
        unsigned long           lkb_timeout_cs;
 
        char                    *lkb_lvbptr;
@@ -442,8 +448,11 @@ struct dlm_ls {
        uint32_t                ls_global_id;   /* global unique lockspace ID */
        uint32_t                ls_exflags;
        int                     ls_lvblen;
-       int                     ls_count;       /* reference count */
+       int                     ls_count;       /* refcount of processes in
+                                                  the dlm using this ls */
+       int                     ls_create_count; /* create/release refcount */
        unsigned long           ls_flags;       /* LSFL_ */
+       unsigned long           ls_scan_time;
        struct kobject          ls_kobj;
 
        struct dlm_rsbtable     *ls_rsbtbl;
@@ -470,7 +479,6 @@ struct dlm_ls {
        int                     ls_low_nodeid;
        int                     ls_total_weight;
        int                     *ls_node_array;
-       gfp_t                   ls_allocation;
 
        struct dlm_rsb          ls_stub_rsb;    /* for returning errors */
        struct dlm_lkb          ls_stub_lkb;    /* for returning errors */
@@ -479,6 +487,7 @@ struct dlm_ls {
        struct dentry           *ls_debug_rsb_dentry; /* debugfs */
        struct dentry           *ls_debug_waiters_dentry; /* debugfs */
        struct dentry           *ls_debug_locks_dentry; /* debugfs */
+       struct dentry           *ls_debug_all_dentry; /* debugfs */
 
        wait_queue_head_t       ls_uevent_wait; /* user part of join/leave */
        int                     ls_uevent_result;
@@ -580,6 +589,8 @@ static inline int dlm_no_directory(struct dlm_ls *ls)
 int dlm_netlink_init(void);
 void dlm_netlink_exit(void);
 void dlm_timeout_warn(struct dlm_lkb *lkb);
+int dlm_plock_init(void);
+void dlm_plock_exit(void);
 
 #ifdef CONFIG_DLM_DEBUG
 int dlm_register_debugfs(void);