4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, Whamcloud, Inc.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
37 #ifndef _LUSTRE_LU_TARGET_H
38 #define _LUSTRE_LU_TARGET_H
40 #include <dt_object.h>
41 #include <lustre_disk.h>
44 struct obd_device *lut_obd;
45 struct dt_device *lut_bottom;
47 struct dt_object *lut_last_rcvd;
48 /* transaction callbacks */
49 struct dt_txn_callback lut_txn_cb;
50 /** server data in last_rcvd file */
51 struct lr_server_data lut_lsd;
52 /** Server last transaction number */
53 __u64 lut_last_transno;
54 /** Lock protecting last transaction number */
55 spinlock_t lut_translock;
56 /** Lock protecting client bitmap */
57 spinlock_t lut_client_bitmap_lock;
58 /** Bitmap of known clients */
59 unsigned long *lut_client_bitmap;
62 typedef void (*tgt_cb_t)(struct lu_target *lut, __u64 transno,
64 struct tgt_commit_cb {
69 void tgt_boot_epoch_update(struct lu_target *lut);
70 int tgt_last_commit_cb_add(struct thandle *th, struct lu_target *lut,
71 struct obd_export *exp, __u64 transno);
72 int tgt_new_client_cb_add(struct thandle *th, struct obd_export *exp);
73 int tgt_init(const struct lu_env *env, struct lu_target *lut,
74 struct obd_device *obd, struct dt_device *dt);
75 void tgt_fini(const struct lu_env *env, struct lu_target *lut);
76 int tgt_client_alloc(struct obd_export *exp);
77 void tgt_client_free(struct obd_export *exp);
78 int tgt_client_del(const struct lu_env *env, struct obd_export *exp);
79 int tgt_client_add(const struct lu_env *env, struct obd_export *exp, int);
80 int tgt_client_new(const struct lu_env *env, struct obd_export *exp);
81 int tgt_client_data_read(const struct lu_env *env, struct lu_target *tg,
82 struct lsd_client_data *lcd, loff_t *off, int index);
83 int tgt_client_data_write(const struct lu_env *env, struct lu_target *tg,
84 struct lsd_client_data *lcd, loff_t *off, struct thandle *th);
85 int tgt_server_data_read(const struct lu_env *env, struct lu_target *tg);
86 int tgt_server_data_write(const struct lu_env *env, struct lu_target *tg,
88 int tgt_server_data_update(const struct lu_env *env, struct lu_target *tg, int sync);
89 int tgt_truncate_last_rcvd(const struct lu_env *env, struct lu_target *tg, loff_t off);
91 #endif /* __LUSTRE_LU_TARGET_H */