Whamcloud - gitweb
LU-13974 llog: check stale osp object
[fs/lustre-release.git] / lustre / include / obd_target.h
1 /* GPL HEADER START
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 only,
7  * as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License version 2 for more details (a copy is included
13  * in the LICENSE file that accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License
16  * version 2 along with this program; If not, see
17  * http://www.gnu.org/licenses/gpl-2.0.html
18  *
19  * GPL HEADER END
20  */
21 /*
22  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23  * Use is subject to license terms.
24  *
25  * Copyright (c) 2011, 2014, Intel Corporation.
26  */
27 /*
28  * This file is part of Lustre, http://www.lustre.org/
29  * Lustre is a trademark of Sun Microsystems, Inc.
30  */
31
32 #ifndef __OBD_TARGET_H
33 #define __OBD_TARGET_H
34 #include <lprocfs_status.h>
35
36 /* server-side individual type definitions */
37
38 #define OBT_MAGIC       0xBDDECEAE
39 /* hold common fields for "target" device */
40 struct obd_device_target {
41         __u32                   obt_magic;
42         __u32                   obt_instance;
43         struct lu_target       *obt_lut;
44         __u64                   obt_mount_count;
45         struct obd_job_stats    obt_jobstats;
46         struct nm_config_file   *obt_nodemap_config_file;
47 };
48
49 #define OBJ_SUBDIR_COUNT 32 /* set to zero for no subdirs */
50
51 struct filter_obd {
52         /* NB this field MUST be first */
53         struct obd_device_target         fo_obt;
54 };
55
56 struct echo_obd {
57         struct obd_device_target        eo_obt;
58         struct obdo                     eo_oa;
59         spinlock_t                      eo_lock;
60         u64                             eo_lastino;
61         struct lustre_handle            eo_nl_lock;
62         atomic_t                        eo_prep;
63 };
64
65 struct ost_obd {
66         struct ptlrpc_service   *ost_service;
67         struct ptlrpc_service   *ost_create_service;
68         struct ptlrpc_service   *ost_io_service;
69         struct ptlrpc_service   *ost_seq_service;
70         struct ptlrpc_service   *ost_out_service;
71         struct mutex             ost_health_mutex;
72 };
73
74 /* Generic subset of tgts */
75 struct lu_tgt_pool {
76         __u32              *op_array;   /* array of index of
77                                          * lov_obd->lov_tgts */
78         unsigned int        op_count;   /* number of tgts in the array */
79         unsigned int        op_size;    /* allocated size of op_array */
80         struct rw_semaphore op_rw_sem;  /* to protect lu_tgt_pool use */
81 };
82
83 int tgt_pool_init(struct lu_tgt_pool *op, unsigned int count);
84 int tgt_pool_add(struct lu_tgt_pool *op, __u32 idx, unsigned int min_count);
85 int tgt_pool_remove(struct lu_tgt_pool *op, __u32 idx);
86 int tgt_pool_free(struct lu_tgt_pool *op);
87 int tgt_check_index(int idx, struct lu_tgt_pool *osts);
88 int tgt_pool_extend(struct lu_tgt_pool *op, unsigned int min_count);
89
90 #endif /* __OBD_TARGET_H */