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 LUSTRE_CMOBD_NAME "cmobd"
32 #define CMOBD_MAX_THREADS 32UL
34 #define CMOBD_NUM_THREADS max(min_t(unsigned long, num_physpages / 8192, \
35 CMOBD_MAX_THREADS), 2UL)
37 #define CMOBD_MAX_EXTENT_SZ PTLRPC_MAX_BRW_PAGES * PAGE_SIZE
39 #define CMOBD_MAX_EXTENTS 1024
41 /* for keeping the capacity of handle multi extents simultaneously */
42 struct cmobd_extent_set {
43 struct ldlm_extent es_extent;
46 struct lov_stripe_md *es_lsm;
47 struct obd_export *es_exp;
49 /* maximum length of per sub extent */
50 unsigned long es_ext_sz;
51 /* sub extents count */
53 /* pages to be sent */
54 struct list_head es_pages;
55 /* protect the es_pages and es_count */
58 wait_queue_head_t es_waitq;
61 struct cmobd_extent_info {
62 struct list_head ei_link;
63 struct cmobd_extent_set *ei_set;
64 struct ldlm_extent ei_extent;
67 struct cmobd_async_page {
68 struct list_head cmap_link;
69 struct page *cmap_page;
71 struct cmobd_extent_set *cmap_es;
74 struct cmobd_write_service {
75 struct list_head ws_threads;
77 spinlock_t ws_thread_lock;
79 struct list_head ws_extents;
81 spinlock_t ws_extent_lock;
82 wait_queue_head_t ws_waitq_provider; /* extent provider queue */
83 wait_queue_head_t ws_waitq_consumer; /* extent consumer queue */
86 #endif /* _LUSTRE_CMOBD_H */