1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37#ifndef _LUSTRE_LU_TARGET_H
38#define _LUSTRE_LU_TARGET_H
39
40#include <dt_object.h>
41#include <lustre_disk.h>
42
43struct lu_target {
44 struct obd_device *lut_obd;
45 struct dt_device *lut_bottom;
46
47 struct dt_object *lut_last_rcvd;
48
49 struct dt_txn_callback lut_txn_cb;
50
51 struct lr_server_data lut_lsd;
52
53 __u64 lut_last_transno;
54
55 spinlock_t lut_translock;
56
57 spinlock_t lut_client_bitmap_lock;
58
59 unsigned long *lut_client_bitmap;
60};
61
62typedef void (*tgt_cb_t)(struct lu_target *lut, __u64 transno,
63 void *data, int err);
64struct tgt_commit_cb {
65 tgt_cb_t tgt_cb_func;
66 void *tgt_cb_data;
67};
68
69void tgt_boot_epoch_update(struct lu_target *lut);
70int tgt_last_commit_cb_add(struct thandle *th, struct lu_target *lut,
71 struct obd_export *exp, __u64 transno);
72int tgt_new_client_cb_add(struct thandle *th, struct obd_export *exp);
73int tgt_init(const struct lu_env *env, struct lu_target *lut,
74 struct obd_device *obd, struct dt_device *dt);
75void tgt_fini(const struct lu_env *env, struct lu_target *lut);
76int tgt_client_alloc(struct obd_export *exp);
77void tgt_client_free(struct obd_export *exp);
78int tgt_client_del(const struct lu_env *env, struct obd_export *exp);
79int tgt_client_add(const struct lu_env *env, struct obd_export *exp, int);
80int tgt_client_new(const struct lu_env *env, struct obd_export *exp);
81int tgt_client_data_read(const struct lu_env *env, struct lu_target *tg,
82 struct lsd_client_data *lcd, loff_t *off, int index);
83int 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);
85int tgt_server_data_read(const struct lu_env *env, struct lu_target *tg);
86int tgt_server_data_write(const struct lu_env *env, struct lu_target *tg,
87 struct thandle *th);
88int tgt_server_data_update(const struct lu_env *env, struct lu_target *tg, int sync);
89int tgt_truncate_last_rcvd(const struct lu_env *env, struct lu_target *tg, loff_t off);
90
91#endif
92