1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
6 * This file is part of Lustre, http://www.lustre.org.
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.
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.
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.
21 * Data structures for Cache Manager
25 #ifndef _LUSTRE_CMOBD_H
26 #define _LUSTRE_CMOBD_H
28 #include <linux/obd_class.h>
30 #define CMOBD_MAX_THREADS 32UL
31 #define CMOBD_NUM_THREADS max(min_t(unsigned long, num_physpages / 8192, \
32 CMOBD_MAX_THREADS), 2UL)
34 #define CMOBD_MAX_EXTENT_SZ PTLRPC_MAX_BRW_PAGES * PAGE_SIZE
35 #define CMOBD_MAX_EXTENTS 1024
37 /* for keeping the capacity of handle multi extents simultaneously */
38 struct cmobd_extent_set {
39 struct ldlm_extent es_extent;
42 struct lov_stripe_md *es_lsm;
43 struct obd_export *es_exp;
45 /* maximum length of per sub extent */
46 unsigned long es_ext_sz;
47 /* sub extents count */
49 /* pages to be sent */
50 struct list_head es_pages;
51 /* protect the es_pages and es_count */
54 wait_queue_head_t es_waitq;
57 struct cmobd_extent_info {
58 struct list_head ei_link;
59 struct cmobd_extent_set *ei_set;
60 struct ldlm_extent ei_extent;
63 struct cmobd_async_page {
64 struct list_head cmap_link;
65 struct page *cmap_page;
67 struct cmobd_extent_set *cmap_es;
70 struct cmobd_write_service {
71 struct list_head ws_threads;
73 spinlock_t ws_thread_lock;
75 struct list_head ws_extents;
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 */
82 #endif /* _LUSTRE_CMOBD_H */