3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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
22 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Use is subject to license terms.
25 * Copyright (c) 2011, 2014, Intel Corporation.
28 * This file is part of Lustre, http://www.lustre.org/
31 #ifndef __OBD_TARGET_H
32 #define __OBD_TARGET_H
33 #include <lprocfs_status.h>
36 /* server-side individual type definitions */
38 #define OBT_MAGIC 0xBDDECEAE
39 /* hold common fields for "target" device */
40 struct obd_device_target {
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;
49 #define OBJ_SUBDIR_COUNT 32 /* set to zero for no subdirs */
52 struct obd_device_target eo_obt;
56 struct lustre_handle eo_nl_lock;
61 struct ptlrpc_service *ost_service;
62 struct ptlrpc_service *ost_create_service;
63 struct ptlrpc_service *ost_io_service;
64 struct ptlrpc_service *ost_seq_service;
65 struct ptlrpc_service *ost_out_service;
66 struct mutex ost_health_mutex;
69 static inline struct obd_device_target *obd2obt(struct obd_device *obd)
71 struct obd_device_target *obt;
73 BUILD_BUG_ON(sizeof(obd->u) < sizeof(*obt));
77 obt = (void *)&obd->u;
78 LASSERT(obt->obt_magic == OBT_MAGIC);
82 static inline struct obd_device_target *obd_obt_init(struct obd_device *obd)
84 struct obd_device_target *obt;
86 obt = (void *)&obd->u;
87 obt->obt_magic = OBT_MAGIC;
88 obt->obt_instance = 0;
93 static inline struct echo_obd *obd2echo(struct obd_device *obd)
95 struct echo_obd *echo;
97 BUILD_BUG_ON(sizeof(obd->u) < sizeof(*echo));
101 echo = (void *)&obd->u;
106 static inline struct ost_obd *obd2ost(struct obd_device *obd)
110 BUILD_BUG_ON(sizeof(obd->u) < sizeof(*ost));
114 ost = (void *)&obd->u;
119 #endif /* __OBD_TARGET_H */