Whamcloud - gitweb
current branches now use lnet from HEAD
[fs/lustre-release.git] / lustre / include / linux / lustre_cmobd.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. <braam@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  * Data structures for Cache Manager 
22  *
23  */
24
25 #ifndef _LUSTRE_CMOBD_H
26 #define _LUSTRE_CMOBD_H
27
28 #include <linux/obd_class.h>
29
30 #define CMOBD_MAX_THREADS       32UL
31 #define CMOBD_NUM_THREADS       max(min_t(unsigned long, num_physpages / 8192, \
32                                           CMOBD_MAX_THREADS), 2UL)
33
34 #define CMOBD_MAX_EXTENT_SZ     PTLRPC_MAX_BRW_PAGES * PAGE_SIZE
35 #define CMOBD_MAX_EXTENTS       1024
36
37 /* for keeping the capacity of handle multi extents simultaneously */
38 struct cmobd_extent_set {
39         struct ldlm_extent       es_extent;
40         struct obdo              es_oa; 
41         
42         struct lov_stripe_md    *es_lsm;
43         struct obd_export       *es_exp;
44         
45         /* maximum length of per sub extent */ 
46         unsigned long            es_ext_sz;
47         /* sub extents count */
48         obd_count                es_count;
49         /* pages to be sent */
50         struct list_head         es_pages;        
51         /* protect the es_pages and es_count */
52         spinlock_t               es_lock;
53         
54         wait_queue_head_t        es_waitq;
55 };
56
57 struct cmobd_extent_info {
58         struct list_head         ei_link;
59         struct cmobd_extent_set *ei_set;
60         struct ldlm_extent       ei_extent;
61 };
62
63 struct cmobd_async_page {
64         struct list_head         cmap_link;
65         struct page             *cmap_page;
66         void                    *cmap_cookie;
67         struct cmobd_extent_set *cmap_es;
68 };
69
70 struct cmobd_write_service {
71         struct list_head        ws_threads;
72         int                     ws_nthreads;
73         spinlock_t              ws_thread_lock;
74
75         struct list_head        ws_extents;
76         int                     ws_nextents;
77         spinlock_t              ws_extent_lock;
78         wait_queue_head_t       ws_waitq_provider;      /* extent provider queue */
79         wait_queue_head_t       ws_waitq_consumer;      /* extent consumer queue */
80 };
81
82 #endif /* _LUSTRE_CMOBD_H */