Blame view

fs/ceph/mds_client.h 14.1 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
2f2dc0534   Sage Weil   ceph: MDS client
2
3
4
5
  #ifndef _FS_CEPH_MDS_CLIENT_H
  #define _FS_CEPH_MDS_CLIENT_H
  
  #include <linux/completion.h>
153c8e6bf   Sage Weil   ceph: use kref fo...
6
  #include <linux/kref.h>
2f2dc0534   Sage Weil   ceph: MDS client
7
8
  #include <linux/list.h>
  #include <linux/mutex.h>
44ca18f26   Sage Weil   ceph: use rbtree ...
9
  #include <linux/rbtree.h>
2f2dc0534   Sage Weil   ceph: MDS client
10
  #include <linux/spinlock.h>
3997c01d2   Elena Reshetova   ceph: convert cep...
11
  #include <linux/refcount.h>
717e6f289   Yan, Zheng   ceph: avoid panic...
12
  #include <linux/utsname.h>
2f2dc0534   Sage Weil   ceph: MDS client
13

3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
14
15
16
  #include <linux/ceph/types.h>
  #include <linux/ceph/messenger.h>
  #include <linux/ceph/mdsmap.h>
6c4a19158   Alex Elder   ceph: define ceph...
17
  #include <linux/ceph/auth.h>
2f2dc0534   Sage Weil   ceph: MDS client
18

342ce1823   Yan, Zheng   ceph: support cep...
19
20
21
22
23
24
25
26
27
28
  /* The first 8 bits are reserved for old ceph releases */
  #define CEPHFS_FEATURE_MIMIC    8
  
  #define CEPHFS_FEATURES_ALL {           \
    0, 1, 2, 3, 4, 5, 6, 7,		\
    CEPHFS_FEATURE_MIMIC,                 \
  }
  
  #define CEPHFS_FEATURES_CLIENT_SUPPORTED CEPHFS_FEATURES_ALL
  #define CEPHFS_FEATURES_CLIENT_REQUIRED {}
2f2dc0534   Sage Weil   ceph: MDS client
29
30
31
32
33
34
35
36
  /*
   * Some lock dependencies:
   *
   * session->s_mutex
   *         mdsc->mutex
   *
   *         mdsc->snap_rwsem
   *
be655596b   Sage Weil   ceph: use i_ceph_...
37
   *         ci->i_ceph_lock
2f2dc0534   Sage Weil   ceph: MDS client
38
39
40
41
   *                 mdsc->snap_flush_lock
   *                 mdsc->cap_delay_lock
   *
   */
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
42
  struct ceph_fs_client;
2f2dc0534   Sage Weil   ceph: MDS client
43
44
45
46
47
48
49
50
  struct ceph_cap;
  
  /*
   * parsed info about a single inode.  pointers are into the encoded
   * on-wire structures within the mds reply message payload.
   */
  struct ceph_mds_reply_info_in {
  	struct ceph_mds_reply_inode *in;
14303d20f   Sage Weil   ceph: implement D...
51
  	struct ceph_dir_layout dir_layout;
2f2dc0534   Sage Weil   ceph: MDS client
52
53
54
55
  	u32 symlink_len;
  	char *symlink;
  	u32 xattr_len;
  	char *xattr_data;
fb01d1f8b   Yan, Zheng   ceph: parse inlin...
56
57
58
  	u64 inline_version;
  	u32 inline_len;
  	char *inline_data;
5ea5c5e0a   Yan, Zheng   ceph: initial CEP...
59
  	u32 pool_ns_len;
779fe0fb8   Yan, Zheng   ceph: rados pool ...
60
  	char *pool_ns_data;
fb18a5756   Luis Henriques   ceph: quota: add ...
61
62
  	u64 max_bytes;
  	u64 max_files;
2f2dc0534   Sage Weil   ceph: MDS client
63
  };
2a5beea3f   Yan, Zheng   ceph: define stru...
64
65
66
67
68
  struct ceph_mds_reply_dir_entry {
  	char                          *name;
  	u32                           name_len;
  	struct ceph_mds_reply_lease   *lease;
  	struct ceph_mds_reply_info_in inode;
8974eebd3   Yan, Zheng   ceph: record 'off...
69
  	loff_t			      offset;
2a5beea3f   Yan, Zheng   ceph: define stru...
70
  };
2f2dc0534   Sage Weil   ceph: MDS client
71
  /*
25933abdd   Herb Shiu   ceph: Handle file...
72
73
74
75
   * parsed info about an mds reply, including information about
   * either: 1) the target inode and/or its parent directory and dentry,
   * and directory contents (for readdir results), or
   * 2) the file range lock info (for fcntl F_GETLK results).
2f2dc0534   Sage Weil   ceph: MDS client
76
77
78
   */
  struct ceph_mds_reply_info_parsed {
  	struct ceph_mds_reply_head    *head;
25933abdd   Herb Shiu   ceph: Handle file...
79
  	/* trace */
2f2dc0534   Sage Weil   ceph: MDS client
80
81
82
83
84
  	struct ceph_mds_reply_info_in diri, targeti;
  	struct ceph_mds_reply_dirfrag *dirfrag;
  	char                          *dname;
  	u32                           dname_len;
  	struct ceph_mds_reply_lease   *dlease;
25933abdd   Herb Shiu   ceph: Handle file...
85
86
87
88
89
90
91
92
  	/* extra */
  	union {
  		/* for fcntl F_GETLK results */
  		struct ceph_filelock *filelock_reply;
  
  		/* for readdir results */
  		struct {
  			struct ceph_mds_reply_dirfrag *dir_dir;
54008399d   Yan, Zheng   ceph: preallocate...
93
  			size_t			      dir_buf_size;
25933abdd   Herb Shiu   ceph: Handle file...
94
  			int                           dir_nr;
f3c4ebe65   Yan, Zheng   ceph: using hash ...
95
  			bool			      dir_end;
79162547b   Yan, Zheng   ceph: make seeky ...
96
  			bool			      dir_complete;
f3c4ebe65   Yan, Zheng   ceph: using hash ...
97
  			bool			      hash_order;
79162547b   Yan, Zheng   ceph: make seeky ...
98
  			bool			      offset_hash;
2a5beea3f   Yan, Zheng   ceph: define stru...
99
  			struct ceph_mds_reply_dir_entry  *dir_entries;
25933abdd   Herb Shiu   ceph: Handle file...
100
  		};
6e8575faa   Sam Lang   ceph: Check for c...
101
102
103
104
105
106
  
  		/* for create results */
  		struct {
  			bool has_create_ino;
  			u64 ino;
  		};
25933abdd   Herb Shiu   ceph: Handle file...
107
  	};
2f2dc0534   Sage Weil   ceph: MDS client
108
109
110
111
112
113
114
115
116
117
  
  	/* encoded blob describing snapshot contexts for certain
  	   operations (e.g., open) */
  	void *snapblob;
  	int snapblob_len;
  };
  
  
  /*
   * cap releases are batched and sent to the MDS en masse.
92475f05b   Jeff Layton   ceph: handle epoc...
118
119
120
   *
   * Account for per-message overhead of mds_cap_release header
   * and __le32 for osd epoch barrier trailing field.
2f2dc0534   Sage Weil   ceph: MDS client
121
   */
92475f05b   Jeff Layton   ceph: handle epoc...
122
  #define CEPH_CAPS_PER_RELEASE ((PAGE_SIZE - sizeof(u32) -		\
2f2dc0534   Sage Weil   ceph: MDS client
123
  				sizeof(struct ceph_mds_cap_release)) /	\
92475f05b   Jeff Layton   ceph: handle epoc...
124
  			        sizeof(struct ceph_mds_cap_item))
2f2dc0534   Sage Weil   ceph: MDS client
125
126
127
128
129
130
131
132
133
134
135
136
137
  
  
  /*
   * state associated with each MDS<->client session
   */
  enum {
  	CEPH_MDS_SESSION_NEW = 1,
  	CEPH_MDS_SESSION_OPENING = 2,
  	CEPH_MDS_SESSION_OPEN = 3,
  	CEPH_MDS_SESSION_HUNG = 4,
  	CEPH_MDS_SESSION_CLOSING = 5,
  	CEPH_MDS_SESSION_RESTARTING = 6,
  	CEPH_MDS_SESSION_RECONNECTING = 7,
fcff415c9   Yan, Zheng   ceph: handle CEPH...
138
  	CEPH_MDS_SESSION_REJECTED = 8,
2f2dc0534   Sage Weil   ceph: MDS client
139
140
141
142
143
144
145
146
147
148
149
  };
  
  struct ceph_mds_session {
  	struct ceph_mds_client *s_mdsc;
  	int               s_mds;
  	int               s_state;
  	unsigned long     s_ttl;      /* time until mds kills us */
  	u64               s_seq;      /* incoming msg seq # */
  	struct mutex      s_mutex;    /* serialize session messages */
  
  	struct ceph_connection s_con;
6c4a19158   Alex Elder   ceph: define ceph...
150
  	struct ceph_auth_handshake s_auth;
4e7a5dcd1   Sage Weil   ceph: negotiate a...
151

d8fb02abd   Alex Elder   ceph: create a ne...
152
153
  	/* protected by s_gen_ttl_lock */
  	spinlock_t        s_gen_ttl_lock;
2f2dc0534   Sage Weil   ceph: MDS client
154
155
  	u32               s_cap_gen;  /* inc each time we get mds stale msg */
  	unsigned long     s_cap_ttl;  /* when session caps expire */
d8fb02abd   Alex Elder   ceph: create a ne...
156
157
158
  
  	/* protected by s_cap_lock */
  	spinlock_t        s_cap_lock;
2f2dc0534   Sage Weil   ceph: MDS client
159
160
161
  	struct list_head  s_caps;     /* all caps issued by this session */
  	int               s_nr_caps, s_trim_caps;
  	int               s_num_cap_releases;
99a9c273b   Yan, Zheng   ceph: handle race...
162
  	int		  s_cap_reconnect;
03f4fcb02   Yan, Zheng   ceph: handle SESS...
163
  	int		  s_readonly;
2f2dc0534   Sage Weil   ceph: MDS client
164
  	struct list_head  s_cap_releases; /* waiting cap_release messages */
7c1332b8c   Sage Weil   ceph: fix iterate...
165
  	struct ceph_cap  *s_cap_iterator;
2f2dc0534   Sage Weil   ceph: MDS client
166
167
168
  
  	/* protected by mutex */
  	struct list_head  s_cap_flushing;     /* inodes w/ flushing caps */
2f2dc0534   Sage Weil   ceph: MDS client
169
170
  	unsigned long     s_renew_requested; /* last time we sent a renew req */
  	u64               s_renew_seq;
3997c01d2   Elena Reshetova   ceph: convert cep...
171
  	refcount_t          s_ref;
2f2dc0534   Sage Weil   ceph: MDS client
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
  	struct list_head  s_waiting;  /* waiting requests */
  	struct list_head  s_unsafe;   /* unsafe requests */
  };
  
  /*
   * modes of choosing which MDS to send a request to
   */
  enum {
  	USE_ANY_MDS,
  	USE_RANDOM_MDS,
  	USE_AUTH_MDS,   /* prefer authoritative mds for this metadata item */
  };
  
  struct ceph_mds_request;
  struct ceph_mds_client;
  
  /*
   * request completion callback
   */
  typedef void (*ceph_mds_request_callback_t) (struct ceph_mds_client *mdsc,
  					     struct ceph_mds_request *req);
9280be24d   Yan, Zheng   ceph: fix file lo...
193
194
195
196
197
  /*
   * wait for request completion callback
   */
  typedef int (*ceph_mds_request_wait_callback_t) (struct ceph_mds_client *mdsc,
  						 struct ceph_mds_request *req);
2f2dc0534   Sage Weil   ceph: MDS client
198
199
200
201
202
203
  
  /*
   * an in-flight mds request
   */
  struct ceph_mds_request {
  	u64 r_tid;                   /* transaction id */
44ca18f26   Sage Weil   ceph: use rbtree ...
204
  	struct rb_node r_node;
37151668b   Yehuda Sadeh   ceph: do caps acc...
205
  	struct ceph_mds_client *r_mdsc;
2f2dc0534   Sage Weil   ceph: MDS client
206
207
  
  	int r_op;                    /* mds op code */
2f2dc0534   Sage Weil   ceph: MDS client
208
209
210
211
212
  
  	/* operation on what? */
  	struct inode *r_inode;              /* arg1 */
  	struct dentry *r_dentry;            /* arg1 */
  	struct dentry *r_old_dentry;        /* arg2: rename from or link from */
41b02e1f9   Sage Weil   ceph: explicitly ...
213
  	struct inode *r_old_dentry_dir;     /* arg2: old dentry's parent dir */
2f2dc0534   Sage Weil   ceph: MDS client
214
215
  	char *r_path1, *r_path2;
  	struct ceph_vino r_ino1, r_ino2;
3dd69aabc   Jeff Layton   ceph: add a new f...
216
  	struct inode *r_parent;		    /* parent dir inode */
2f2dc0534   Sage Weil   ceph: MDS client
217
  	struct inode *r_target_inode;       /* resulting inode */
bc2de10dc   Jeff Layton   ceph: convert boo...
218
219
220
221
222
223
  #define CEPH_MDS_R_DIRECT_IS_HASH	(1) /* r_direct_hash is valid */
  #define CEPH_MDS_R_ABORTED		(2) /* call was aborted */
  #define CEPH_MDS_R_GOT_UNSAFE		(3) /* got an unsafe reply */
  #define CEPH_MDS_R_GOT_SAFE		(4) /* got a safe reply */
  #define CEPH_MDS_R_GOT_RESULT		(5) /* got a result */
  #define CEPH_MDS_R_DID_PREPOPULATE	(6) /* prepopulated readdir */
3dd69aabc   Jeff Layton   ceph: add a new f...
224
  #define CEPH_MDS_R_PARENT_LOCKED	(7) /* is r_parent->i_rwsem wlocked? */
bc2de10dc   Jeff Layton   ceph: convert boo...
225
  	unsigned long	r_req_flags;
b4556396f   Sage Weil   ceph: fix race be...
226
  	struct mutex r_fill_mutex;
2f2dc0534   Sage Weil   ceph: MDS client
227
228
  	union ceph_mds_request_args r_args;
  	int r_fmode;        /* file mode, if expecting cap */
ff3d00466   Eric W. Biederman   ceph: Convert str...
229
230
  	kuid_t r_uid;
  	kgid_t r_gid;
0ed1e90a0   Arnd Bergmann   ceph: use timespe...
231
  	struct timespec64 r_stamp;
2f2dc0534   Sage Weil   ceph: MDS client
232
233
234
235
  
  	/* for choosing which mds to send this request to */
  	int r_direct_mode;
  	u32 r_direct_hash;      /* choose dir frag based on this dentry hash */
2f2dc0534   Sage Weil   ceph: MDS client
236
237
  
  	/* data payload is used for xattr ops */
25e6bae35   Yan, Zheng   ceph: use pagelis...
238
  	struct ceph_pagelist *r_pagelist;
2f2dc0534   Sage Weil   ceph: MDS client
239
240
241
242
243
244
245
246
247
  
  	/* what caps shall we drop? */
  	int r_inode_drop, r_inode_unless;
  	int r_dentry_drop, r_dentry_unless;
  	int r_old_dentry_drop, r_old_dentry_unless;
  	struct inode *r_old_inode;
  	int r_old_inode_drop, r_old_inode_unless;
  
  	struct ceph_msg  *r_request;  /* original request */
e979cf503   Sage Weil   ceph: do not incl...
248
  	int r_request_release_offset;
2f2dc0534   Sage Weil   ceph: MDS client
249
250
  	struct ceph_msg  *r_reply;
  	struct ceph_mds_reply_info_parsed r_reply_info;
01deead04   Yan, Zheng   ceph: use getattr...
251
  	struct page *r_locked_page;
2f2dc0534   Sage Weil   ceph: MDS client
252
  	int r_err;
a319bf56a   Ilya Dryomov   libceph: store ti...
253
  	unsigned long r_timeout;  /* optional.  jiffies, 0 is "wait forever" */
2f2dc0534   Sage Weil   ceph: MDS client
254
255
256
257
258
259
260
  	unsigned long r_started;  /* start time to measure timeout against */
  	unsigned long r_request_started; /* start time for mds request only,
  					    used to measure lease durations */
  
  	/* link unsafe requests to parent directory, for fsync */
  	struct inode	*r_unsafe_dir;
  	struct list_head r_unsafe_dir_item;
68cd5b4b7   Yan, Zheng   ceph: make fsync(...
261
262
  	/* unsafe requests that modify the target inode */
  	struct list_head r_unsafe_target_item;
2f2dc0534   Sage Weil   ceph: MDS client
263
264
265
266
  	struct ceph_mds_session *r_session;
  
  	int               r_attempts;   /* resend attempts */
  	int               r_num_fwd;    /* number of forward attempts */
2f2dc0534   Sage Weil   ceph: MDS client
267
  	int               r_resend_mds; /* mds to resend to next, if any*/
e55b71f80   Greg Farnum   ceph: handle ESTA...
268
  	u32               r_sent_on_mseq; /* cap mseq request was sent at*/
2f2dc0534   Sage Weil   ceph: MDS client
269

153c8e6bf   Sage Weil   ceph: use kref fo...
270
  	struct kref       r_kref;
2f2dc0534   Sage Weil   ceph: MDS client
271
272
273
274
  	struct list_head  r_wait;
  	struct completion r_completion;
  	struct completion r_safe_completion;
  	ceph_mds_request_callback_t r_callback;
9280be24d   Yan, Zheng   ceph: fix file lo...
275
  	ceph_mds_request_wait_callback_t r_wait_for_completion;
2f2dc0534   Sage Weil   ceph: MDS client
276
  	struct list_head  r_unsafe_item;  /* per-session unsafe list item */
2f2dc0534   Sage Weil   ceph: MDS client
277

fdd4e1583   Yan, Zheng   ceph: rework dcac...
278
279
280
  	long long	  r_dir_release_cnt;
  	long long	  r_dir_ordered_cnt;
  	int		  r_readdir_cache_idx;
2f2dc0534   Sage Weil   ceph: MDS client
281
282
283
284
285
  	u32               r_readdir_offset;
  
  	struct ceph_cap_reservation r_caps_reservation;
  	int r_num_caps;
  };
10183a695   Yan, Zheng   ceph: check OSD c...
286
287
  struct ceph_pool_perm {
  	struct rb_node node;
10183a695   Yan, Zheng   ceph: check OSD c...
288
  	int perm;
7627151ea   Yan, Zheng   libceph: define n...
289
  	s64 pool;
779fe0fb8   Yan, Zheng   ceph: rados pool ...
290
291
  	size_t pool_ns_len;
  	char pool_ns[];
10183a695   Yan, Zheng   ceph: check OSD c...
292
  };
2f2dc0534   Sage Weil   ceph: MDS client
293
294
295
296
  /*
   * mds client state
   */
  struct ceph_mds_client {
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
297
  	struct ceph_fs_client  *fsc;
2f2dc0534   Sage Weil   ceph: MDS client
298
299
300
  	struct mutex            mutex;         /* all nested structures */
  
  	struct ceph_mdsmap      *mdsmap;
f3c60c591   Sage Weil   ceph: fix multipl...
301
302
  	struct completion       safe_umount_waiters;
  	wait_queue_head_t       session_close_wq;
2f2dc0534   Sage Weil   ceph: MDS client
303
  	struct list_head        waiting_for_map;
430afbadd   Yan, Zheng   ceph: mount non-d...
304
  	int 			mdsmap_err;
2f2dc0534   Sage Weil   ceph: MDS client
305
306
  
  	struct ceph_mds_session **sessions;    /* NULL for mds if no session */
86d8f67b2   Yan, Zheng   ceph: avoid block...
307
  	atomic_t		num_sessions;
2f2dc0534   Sage Weil   ceph: MDS client
308
309
  	int                     max_sessions;  /* len of s_mds_sessions */
  	int                     stopping;      /* true if shutting down */
d557c48db   Luis Henriques   ceph: quota: add ...
310
  	atomic64_t		quotarealms_count; /* # realms with quota */
2f2dc0534   Sage Weil   ceph: MDS client
311
312
313
314
315
316
317
  	/*
  	 * snap_rwsem will cover cap linkage into snaprealms, and
  	 * realm snap contexts.  (later, we can do per-realm snap
  	 * contexts locks..)  the empty list contains realms with no
  	 * references (implying they contain no inodes with caps) that
  	 * should be destroyed.
  	 */
affbc19a6   Yan, Zheng   ceph: make sure s...
318
  	u64			last_snap_seq;
2f2dc0534   Sage Weil   ceph: MDS client
319
  	struct rw_semaphore     snap_rwsem;
a105f00cf   Sage Weil   ceph: use rbtree ...
320
  	struct rb_root          snap_realms;
2f2dc0534   Sage Weil   ceph: MDS client
321
322
323
324
  	struct list_head        snap_empty;
  	spinlock_t              snap_empty_lock;  /* protect snap_empty */
  
  	u64                    last_tid;      /* most recent mds request */
e8a7b8b12   Yan, Zheng   ceph: exclude set...
325
326
  	u64                    oldest_tid;    /* oldest incomplete mds request,
  						 excluding setfilelock requests */
44ca18f26   Sage Weil   ceph: use rbtree ...
327
  	struct rb_root         request_tree;  /* pending mds requests */
2f2dc0534   Sage Weil   ceph: MDS client
328
329
330
331
332
333
  	struct delayed_work    delayed_work;  /* delayed work */
  	unsigned long    last_renew_caps;  /* last time we renewed our caps */
  	struct list_head cap_delay_list;   /* caps with delayed release */
  	spinlock_t       cap_delay_lock;   /* protects cap_delay_list */
  	struct list_head snap_flush_list;  /* cap_snaps ready to flush */
  	spinlock_t       snap_flush_lock;
553adfd94   Yan, Zheng   ceph: track pendi...
334
  	u64               last_cap_flush_tid;
e4500b5e3   Yan, Zheng   ceph: use list in...
335
  	struct list_head  cap_flush_list;
2f2dc0534   Sage Weil   ceph: MDS client
336
  	struct list_head  cap_dirty;        /* inodes with dirty caps */
db3540522   Sage Weil   ceph: fix cap flu...
337
  	struct list_head  cap_dirty_migrating; /* ...that are migration... */
2f2dc0534   Sage Weil   ceph: MDS client
338
339
340
  	int               num_cap_flushing; /* # caps we are flushing */
  	spinlock_t        cap_dirty_lock;   /* protects above items */
  	wait_queue_head_t cap_flushing_wq;
37151668b   Yehuda Sadeh   ceph: do caps acc...
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
  	/*
  	 * Cap reservations
  	 *
  	 * Maintain a global pool of preallocated struct ceph_caps, referenced
  	 * by struct ceph_caps_reservations.  This ensures that we preallocate
  	 * memory needed to successfully process an MDS response.  (If an MDS
  	 * sends us cap information and we fail to process it, we will have
  	 * problems due to the client and MDS being out of sync.)
  	 *
  	 * Reservations are 'owned' by a ceph_cap_reservation context.
  	 */
  	spinlock_t	caps_list_lock;
  	struct		list_head caps_list; /* unused (reserved or
  						unreserved) */
  	int		caps_total_count;    /* total caps allocated */
  	int		caps_use_count;      /* in use */
  	int		caps_reserve_count;  /* unused, reserved */
  	int		caps_avail_count;    /* unused, unreserved */
  	int		caps_min_count;      /* keep at least this many
  						(unreserved) */
2f2dc0534   Sage Weil   ceph: MDS client
361
362
363
  	spinlock_t	  dentry_lru_lock;
  	struct list_head  dentry_lru;
  	int		  num_dentry;
10183a695   Yan, Zheng   ceph: check OSD c...
364
365
366
  
  	struct rw_semaphore     pool_perm_rwsem;
  	struct rb_root		pool_perm_tree;
717e6f289   Yan, Zheng   ceph: avoid panic...
367
368
  
  	char nodename[__NEW_UTS_LEN + 1];
2f2dc0534   Sage Weil   ceph: MDS client
369
370
371
372
373
374
375
376
377
378
  };
  
  extern const char *ceph_mds_op_name(int op);
  
  extern struct ceph_mds_session *
  __ceph_lookup_mds_session(struct ceph_mds_client *, int mds);
  
  static inline struct ceph_mds_session *
  ceph_get_mds_session(struct ceph_mds_session *s)
  {
3997c01d2   Elena Reshetova   ceph: convert cep...
379
  	refcount_inc(&s->s_ref);
2f2dc0534   Sage Weil   ceph: MDS client
380
381
  	return s;
  }
a687ecaf5   John Spray   ceph: export ceph...
382
  extern const char *ceph_session_state_name(int s);
2f2dc0534   Sage Weil   ceph: MDS client
383
384
385
386
  extern void ceph_put_mds_session(struct ceph_mds_session *s);
  
  extern int ceph_send_msg_mds(struct ceph_mds_client *mdsc,
  			     struct ceph_msg *msg, int mds);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
387
  extern int ceph_mdsc_init(struct ceph_fs_client *fsc);
2f2dc0534   Sage Weil   ceph: MDS client
388
  extern void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc);
48fec5d0a   Yan, Zheng   ceph: EIO all ope...
389
  extern void ceph_mdsc_force_umount(struct ceph_mds_client *mdsc);
3d14c5d2b   Yehuda Sadeh   ceph: factor out ...
390
  extern void ceph_mdsc_destroy(struct ceph_fs_client *fsc);
2f2dc0534   Sage Weil   ceph: MDS client
391
392
  
  extern void ceph_mdsc_sync(struct ceph_mds_client *mdsc);
167c9e352   Sage Weil   ceph: use common ...
393
  extern void ceph_invalidate_dir_request(struct ceph_mds_request *req);
54008399d   Yan, Zheng   ceph: preallocate...
394
395
  extern int ceph_alloc_readdir_reply_buffer(struct ceph_mds_request *req,
  					   struct inode *dir);
2f2dc0534   Sage Weil   ceph: MDS client
396
397
398
399
400
401
402
403
404
  extern struct ceph_mds_request *
  ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode);
  extern void ceph_mdsc_submit_request(struct ceph_mds_client *mdsc,
  				     struct ceph_mds_request *req);
  extern int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
  				struct inode *dir,
  				struct ceph_mds_request *req);
  static inline void ceph_mdsc_get_request(struct ceph_mds_request *req)
  {
153c8e6bf   Sage Weil   ceph: use kref fo...
405
406
407
408
409
410
  	kref_get(&req->r_kref);
  }
  extern void ceph_mdsc_release_request(struct kref *kref);
  static inline void ceph_mdsc_put_request(struct ceph_mds_request *req)
  {
  	kref_put(&req->r_kref, ceph_mdsc_release_request);
2f2dc0534   Sage Weil   ceph: MDS client
411
  }
2f2dc0534   Sage Weil   ceph: MDS client
412

3d7ded4d8   Sage Weil   ceph: release cap...
413
414
  extern void ceph_send_cap_releases(struct ceph_mds_client *mdsc,
  				   struct ceph_mds_session *session);
2f2dc0534   Sage Weil   ceph: MDS client
415
416
417
418
419
420
421
422
423
424
  extern void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc);
  
  extern char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base,
  				  int stop_on_nosnap);
  
  extern void __ceph_mdsc_drop_dentry_lease(struct dentry *dentry);
  extern void ceph_mdsc_lease_send_msg(struct ceph_mds_session *session,
  				     struct inode *inode,
  				     struct dentry *dentry, char action,
  				     u32 seq);
430afbadd   Yan, Zheng   ceph: mount non-d...
425
426
427
428
  extern void ceph_mdsc_handle_mdsmap(struct ceph_mds_client *mdsc,
  				    struct ceph_msg *msg);
  extern void ceph_mdsc_handle_fsmap(struct ceph_mds_client *mdsc,
  				   struct ceph_msg *msg);
2f2dc0534   Sage Weil   ceph: MDS client
429

5d72d13c4   Yan, Zheng   ceph: add open ex...
430
431
  extern struct ceph_mds_session *
  ceph_mdsc_open_export_target_session(struct ceph_mds_client *mdsc, int target);
154f42c2c   Sage Weil   ceph: connect to ...
432
433
  extern void ceph_mdsc_open_export_target_sessions(struct ceph_mds_client *mdsc,
  					  struct ceph_mds_session *session);
e30ee5812   Zhi Zhang   ceph: try to allo...
434
435
436
  extern int ceph_trim_caps(struct ceph_mds_client *mdsc,
  			  struct ceph_mds_session *session,
  			  int max_caps);
2f2dc0534   Sage Weil   ceph: MDS client
437
  #endif