Whamcloud - gitweb
a751b437d90951af003a7fe4f872102dcb6cb544
[fs/lustre-release.git] / lustre / ost / ost_internal.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  */
30 /*
31  * This file is part of Lustre, http://www.lustre.org/
32  * Lustre is a trademark of Sun Microsystems, Inc.
33  */
34
35 #ifndef OST_INTERNAL_H
36 #define OST_INTERNAL_H
37
38 #define OSS_SERVICE_WATCHDOG_FACTOR 2
39
40 /*
41  * tunables for per-thread page pool (bug 5137)
42  */
43 #define OST_THREAD_POOL_SIZE PTLRPC_MAX_BRW_PAGES  /* pool size in pages */
44 #define OST_THREAD_POOL_GFP  CFS_ALLOC_HIGHUSER    /* GFP mask for pool pages */
45
46 struct page;
47 struct niobuf_local;
48 struct niobuf_remote;
49 struct ptlrpc_request;
50
51 /*
52  * struct ost_thread_local_cache is allocated and initialized for each OST
53  * thread by ost_thread_init().
54  */
55 struct ost_thread_local_cache {
56         /*
57          * pool of nio buffers used by write-path
58          */
59         struct niobuf_local   local[OST_THREAD_POOL_SIZE];
60         unsigned int          temporary:1;
61 };
62
63 struct ost_thread_local_cache *ost_tls(struct ptlrpc_request *r);
64
65 /* threads for handling "create" request */
66 #define OSS_CR_THREADS_MIN      2UL
67 #define OSS_CR_THREADS_MAX      16UL
68
69 /* Quota stuff */
70 extern quota_interface_t *quota_interface;
71
72 #ifdef LPROCFS
73 void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars);
74 #else
75 static void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars)
76 {
77         memset(lvars, 0, sizeof(*lvars));
78 }
79 #endif
80
81 /* Here "ostid" maybe part of "oa", the return value of "ostid_id()" depends on
82  * the original "ostid->oi_seq", which maybe changed by the assignment of
83  * "oa->o_seq = ostid_seq(ostid)", so keep the order of setting "oa->o_id" and
84  * "oa->o_seq". */
85 static inline void obdo_from_ostid(struct obdo *oa, struct ost_id *ostid)
86 {
87         oa->o_id  = ostid_id(ostid);
88         oa->o_seq = ostid_seq(ostid);
89 }
90
91 static inline void ioobj_from_obdo(struct obd_ioobj *ioobj, struct obdo *oa)
92 {
93         ioobj->ioo_id  = oa->o_id;
94         ioobj->ioo_seq = oa->o_seq;
95 }
96
97 #endif /* OST_INTERNAL_H */