Whamcloud - gitweb
land v0.9.1 on HEAD, in preparation for a 1.0.x branch
[fs/lustre-release.git] / lustre / include / linux / lustre_commit_confd.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2001 Cluster File Systems, Inc. <info@clusterfs.com>
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
8  *   Lustre is free software; you can redistribute it and/or
9  *   modify it under the terms of version 2 of the GNU General Public
10  *   License as published by the Free Software Foundation.
11  *
12  *   Lustre is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with Lustre; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  * Structures relating to the log commit thread.
22  */
23
24 #ifndef _LUSTRE_COMMIT_CONFD_H
25 #define _LUSTRE_COMMIT_CONFD_H
26
27 #include <linux/lustre_log.h>
28
29 struct llog_canceld_ctxt {
30         struct list_head           llcd_list;  /* free or pending struct list */
31         struct obd_import         *llcd_import;
32         struct llog_commit_master *llcd_lcm;
33         int                        llcd_tries; /* number of tries to send */
34         struct llog_ctxt_gen       llcd_gen; 
35         int                        llcd_cookiebytes;
36         struct llog_cookie         llcd_cookies[0];
37 };
38
39 struct llog_commit_master {
40         struct list_head        lcm_thread_busy;  /* list of busy daemons */
41         struct list_head        lcm_thread_idle;  /* list of idle daemons */
42         spinlock_t              lcm_thread_lock;  /* protects thread_list */
43         atomic_t                lcm_thread_numidle;/* number of idle threads */
44         atomic_t                lcm_thread_total; /* total number of threads */
45         int                     lcm_thread_max;   /* <= num_osts normally */
46
47         int                     lcm_flags;
48         wait_queue_head_t       lcm_waitq;
49
50         struct list_head        lcm_llcd_pending; /* llog_canceld_ctxt to send */
51         struct list_head        lcm_llcd_resend;  /* try to resend this data */
52         struct list_head        lcm_llcd_free;    /* free llog_canceld_ctxt */
53         spinlock_t              lcm_llcd_lock;    /* protects llcd_free */
54         atomic_t                lcm_llcd_numfree; /* items on llcd_free */
55         int                     lcm_llcd_minfree; /* min free on llcd_free */
56         int                     lcm_llcd_maxfree; /* max free on llcd_free */
57 };
58
59 #define LLOG_LCM_FL_EXIT        0x01
60 #define LLOG_LCM_FL_EXIT_FORCE  0x02
61
62 /* the thread data that collects local commits and makes rpc's */
63 struct llog_commit_daemon {
64         struct list_head           lcd_lcm_list;  /* list of daemon threads */
65         struct list_head           lcd_llcd_list; /* list of pending RPCs */
66         struct llog_commit_master *lcd_lcm;       /* pointer back to parent */
67 };
68
69 /* ptlrpc/recov_thread.c */
70 int llog_start_commit_thread(void);
71 struct llog_canceld_ctxt *llcd_grab(void);
72 void llcd_send(struct llog_canceld_ctxt *llcd);
73
74 #endif /* _LUSTRE_COMMIT_CONFD_H */