Whamcloud - gitweb
b=16098
[fs/lustre-release.git] / lustre / include / lustre_commit_confd.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see [sun.com URL with a
20  * copy of GPLv2].
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright  2008 Sun Microsystems, Inc. All rights reserved
30  * Use is subject to license terms.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lustre/include/lustre_commit_confd.h
37  *
38  * Structures relating to the log commit thread.
39  */
40
41 #ifndef _LUSTRE_COMMIT_CONFD_H
42 #define _LUSTRE_COMMIT_CONFD_H
43
44 #include <lustre_log.h>
45
46 struct llog_canceld_ctxt {
47         struct list_head           llcd_list;  /* free or pending struct list */
48         struct llog_ctxt          *llcd_ctxt;
49         struct llog_commit_master *llcd_lcm;
50         int                        llcd_size;
51         int                        llcd_cookiebytes;
52         struct llog_cookie         llcd_cookies[0];
53 };
54
55 struct llog_commit_master {
56         struct list_head        lcm_thread_busy;  /* list of busy daemons */
57         struct list_head        lcm_thread_idle;  /* list of idle daemons */
58         spinlock_t              lcm_thread_lock;  /* protects thread_list */
59         atomic_t                lcm_thread_numidle;/* number of idle threads */
60         atomic_t                lcm_thread_total; /* total number of threads */
61         int                     lcm_thread_max;   /* <= num_osts normally */
62
63         int                     lcm_flags;
64         cfs_waitq_t             lcm_waitq;
65
66         struct list_head        lcm_llcd_pending; /* llog_canceld_ctxt to send */
67         struct list_head        lcm_llcd_resend;  /* try to resend this data */
68         struct list_head        lcm_llcd_free;    /* free llog_canceld_ctxt */
69         spinlock_t              lcm_llcd_lock;    /* protects llcd_free */
70         atomic_t                lcm_llcd_numfree; /* items on llcd_free */
71         int                     lcm_llcd_minfree; /* min free on llcd_free */
72         int                     lcm_llcd_maxfree; /* max free on llcd_free */
73 };
74
75 #define LLOG_LCM_FL_EXIT        0x01
76 #define LLOG_LCM_FL_EXIT_FORCE  0x02
77
78 /* the thread data that collects local commits and makes rpc's */
79 struct llog_commit_daemon {
80         struct list_head           lcd_lcm_list;  /* list of daemon threads */
81         struct list_head           lcd_llcd_list; /* list of pending RPCs */
82         struct llog_commit_master *lcd_lcm;       /* pointer back to parent */
83 };
84
85 /* ptlrpc/recov_thread.c */
86 int llog_start_commit_thread(struct llog_commit_master *);
87
88 int llog_init_commit_master(struct llog_commit_master *);
89 int llog_cleanup_commit_master(struct llog_commit_master *lcm, int force);
90 #endif /* _LUSTRE_COMMIT_CONFD_H */