Whamcloud - gitweb
Land b_orphan on HEAD (20040130_1601)
[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 llog_ctxt          *llcd_ctxt;
32         struct llog_commit_master *llcd_lcm;
33         int                        llcd_tries; /* number of tries to send */
34         int                        llcd_cookiebytes;
35         struct llog_cookie         llcd_cookies[0];
36 };
37
38 struct llog_commit_master {
39         struct list_head        lcm_thread_busy;  /* list of busy daemons */
40         struct list_head        lcm_thread_idle;  /* list of idle daemons */
41         spinlock_t              lcm_thread_lock;  /* protects thread_list */
42         atomic_t                lcm_thread_numidle;/* number of idle threads */
43         atomic_t                lcm_thread_total; /* total number of threads */
44         int                     lcm_thread_max;   /* <= num_osts normally */
45
46         int                     lcm_flags;
47         wait_queue_head_t       lcm_waitq;
48
49         struct list_head        lcm_llcd_pending; /* llog_canceld_ctxt to send */
50         struct list_head        lcm_llcd_resend;  /* try to resend this data */
51         struct list_head        lcm_llcd_free;    /* free llog_canceld_ctxt */
52         spinlock_t              lcm_llcd_lock;    /* protects llcd_free */
53         atomic_t                lcm_llcd_numfree; /* items on llcd_free */
54         int                     lcm_llcd_minfree; /* min free on llcd_free */
55         int                     lcm_llcd_maxfree; /* max free on llcd_free */
56 };
57
58 #define LLOG_LCM_FL_EXIT        0x01
59 #define LLOG_LCM_FL_EXIT_FORCE  0x02
60
61 /* the thread data that collects local commits and makes rpc's */
62 struct llog_commit_daemon {
63         struct list_head           lcd_lcm_list;  /* list of daemon threads */
64         struct list_head           lcd_llcd_list; /* list of pending RPCs */
65         struct llog_commit_master *lcd_lcm;       /* pointer back to parent */
66 };
67
68 /* ptlrpc/recov_thread.c */
69 int llog_start_commit_thread(void);
70 struct llog_canceld_ctxt *llcd_grab(void);
71 void llcd_send(struct llog_canceld_ctxt *llcd);
72
73 #endif /* _LUSTRE_COMMIT_CONFD_H */