2009-10-06 22:31:09 +04:00
|
|
|
#ifndef _FS_CEPH_MDS_CLIENT_H
|
|
|
|
#define _FS_CEPH_MDS_CLIENT_H
|
|
|
|
|
|
|
|
#include <linux/completion.h>
|
2009-12-07 23:31:09 +03:00
|
|
|
#include <linux/kref.h>
|
2009-10-06 22:31:09 +04:00
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/mutex.h>
|
2010-02-15 23:08:46 +03:00
|
|
|
#include <linux/rbtree.h>
|
2009-10-06 22:31:09 +04:00
|
|
|
#include <linux/spinlock.h>
|
|
|
|
|
2010-04-07 02:14:15 +04:00
|
|
|
#include <linux/ceph/types.h>
|
|
|
|
#include <linux/ceph/messenger.h>
|
|
|
|
#include <linux/ceph/mdsmap.h>
|
2012-05-17 00:16:38 +04:00
|
|
|
#include <linux/ceph/auth.h>
|
2009-10-06 22:31:09 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Some lock dependencies:
|
|
|
|
*
|
|
|
|
* session->s_mutex
|
|
|
|
* mdsc->mutex
|
|
|
|
*
|
|
|
|
* mdsc->snap_rwsem
|
|
|
|
*
|
2011-11-30 21:47:09 +04:00
|
|
|
* ci->i_ceph_lock
|
2009-10-06 22:31:09 +04:00
|
|
|
* mdsc->snap_flush_lock
|
|
|
|
* mdsc->cap_delay_lock
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-04-07 02:14:15 +04:00
|
|
|
struct ceph_fs_client;
|
2009-10-06 22:31:09 +04:00
|
|
|
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;
|
2010-12-15 04:37:52 +03:00
|
|
|
struct ceph_dir_layout dir_layout;
|
2009-10-06 22:31:09 +04:00
|
|
|
u32 symlink_len;
|
|
|
|
char *symlink;
|
|
|
|
u32 xattr_len;
|
|
|
|
char *xattr_data;
|
2014-11-14 16:29:55 +03:00
|
|
|
u64 inline_version;
|
|
|
|
u32 inline_len;
|
|
|
|
char *inline_data;
|
2016-02-14 13:06:41 +03:00
|
|
|
u32 pool_ns_len;
|
2016-03-07 04:35:06 +03:00
|
|
|
char *pool_ns_data;
|
2009-10-06 22:31:09 +04:00
|
|
|
};
|
|
|
|
|
2016-04-28 04:37:39 +03:00
|
|
|
struct ceph_mds_reply_dir_entry {
|
|
|
|
char *name;
|
|
|
|
u32 name_len;
|
|
|
|
struct ceph_mds_reply_lease *lease;
|
|
|
|
struct ceph_mds_reply_info_in inode;
|
2016-04-28 10:17:40 +03:00
|
|
|
loff_t offset;
|
2016-04-28 04:37:39 +03:00
|
|
|
};
|
|
|
|
|
2009-10-06 22:31:09 +04:00
|
|
|
/*
|
2010-12-02 01:14:38 +03:00
|
|
|
* 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).
|
2009-10-06 22:31:09 +04:00
|
|
|
*/
|
|
|
|
struct ceph_mds_reply_info_parsed {
|
|
|
|
struct ceph_mds_reply_head *head;
|
|
|
|
|
2010-12-02 01:14:38 +03:00
|
|
|
/* trace */
|
2009-10-06 22:31:09 +04:00
|
|
|
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;
|
|
|
|
|
2010-12-02 01:14:38 +03:00
|
|
|
/* extra */
|
|
|
|
union {
|
|
|
|
/* for fcntl F_GETLK results */
|
|
|
|
struct ceph_filelock *filelock_reply;
|
|
|
|
|
|
|
|
/* for readdir results */
|
|
|
|
struct {
|
|
|
|
struct ceph_mds_reply_dirfrag *dir_dir;
|
2014-03-29 09:41:15 +04:00
|
|
|
size_t dir_buf_size;
|
2010-12-02 01:14:38 +03:00
|
|
|
int dir_nr;
|
2016-04-29 06:27:30 +03:00
|
|
|
bool dir_complete;
|
|
|
|
bool dir_end;
|
|
|
|
bool hash_order;
|
2016-04-28 04:37:39 +03:00
|
|
|
struct ceph_mds_reply_dir_entry *dir_entries;
|
2010-12-02 01:14:38 +03:00
|
|
|
};
|
2012-12-28 21:56:46 +04:00
|
|
|
|
|
|
|
/* for create results */
|
|
|
|
struct {
|
|
|
|
bool has_create_ino;
|
|
|
|
u64 ino;
|
|
|
|
};
|
2010-12-02 01:14:38 +03:00
|
|
|
};
|
2009-10-06 22:31:09 +04:00
|
|
|
|
|
|
|
/* 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.
|
|
|
|
*/
|
mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros
PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
ago with promise that one day it will be possible to implement page
cache with bigger chunks than PAGE_SIZE.
This promise never materialized. And unlikely will.
We have many places where PAGE_CACHE_SIZE assumed to be equal to
PAGE_SIZE. And it's constant source of confusion on whether
PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
especially on the border between fs and mm.
Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
breakage to be doable.
Let's stop pretending that pages in page cache are special. They are
not.
The changes are pretty straight-forward:
- <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
- <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
- PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
- page_cache_get() -> get_page();
- page_cache_release() -> put_page();
This patch contains automated changes generated with coccinelle using
script below. For some reason, coccinelle doesn't patch header files.
I've called spatch for them manually.
The only adjustment after coccinelle is revert of changes to
PAGE_CAHCE_ALIGN definition: we are going to drop it later.
There are few places in the code where coccinelle didn't reach. I'll
fix them manually in a separate patch. Comments and documentation also
will be addressed with the separate patch.
virtual patch
@@
expression E;
@@
- E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
+ E
@@
expression E;
@@
- E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
+ E
@@
@@
- PAGE_CACHE_SHIFT
+ PAGE_SHIFT
@@
@@
- PAGE_CACHE_SIZE
+ PAGE_SIZE
@@
@@
- PAGE_CACHE_MASK
+ PAGE_MASK
@@
expression E;
@@
- PAGE_CACHE_ALIGN(E)
+ PAGE_ALIGN(E)
@@
expression E;
@@
- page_cache_get(E)
+ get_page(E)
@@
expression E;
@@
- page_cache_release(E)
+ put_page(E)
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-04-01 15:29:47 +03:00
|
|
|
#define CEPH_CAPS_PER_RELEASE ((PAGE_SIZE - \
|
2009-10-06 22:31:09 +04:00
|
|
|
sizeof(struct ceph_mds_cap_release)) / \
|
|
|
|
sizeof(struct ceph_mds_cap_item))
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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,
|
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2012-05-17 00:16:38 +04:00
|
|
|
struct ceph_auth_handshake s_auth;
|
2009-11-19 03:19:57 +03:00
|
|
|
|
2012-01-13 05:48:10 +04:00
|
|
|
/* protected by s_gen_ttl_lock */
|
|
|
|
spinlock_t s_gen_ttl_lock;
|
2009-10-06 22:31:09 +04:00
|
|
|
u32 s_cap_gen; /* inc each time we get mds stale msg */
|
|
|
|
unsigned long s_cap_ttl; /* when session caps expire */
|
2012-01-13 05:48:10 +04:00
|
|
|
|
|
|
|
/* protected by s_cap_lock */
|
|
|
|
spinlock_t s_cap_lock;
|
2009-10-06 22:31:09 +04:00
|
|
|
struct list_head s_caps; /* all caps issued by this session */
|
|
|
|
int s_nr_caps, s_trim_caps;
|
|
|
|
int s_num_cap_releases;
|
2013-09-22 07:08:14 +04:00
|
|
|
int s_cap_reconnect;
|
2015-01-05 06:04:04 +03:00
|
|
|
int s_readonly;
|
2009-10-06 22:31:09 +04:00
|
|
|
struct list_head s_cap_releases; /* waiting cap_release messages */
|
ceph: fix iterate_caps removal race
We need to be able to iterate over all caps on a session with a
possibly slow callback on each cap. To allow this, we used to
prevent cap reordering while we were iterating. However, we were
not safe from races with removal: removing the 'next' cap would
make the next pointer from list_for_each_entry_safe be invalid,
and cause a lock up or similar badness.
Instead, we keep an iterator pointer in the session pointing to
the current cap. As before, we avoid reordering. For removal,
if the cap isn't the current cap we are iterating over, we are
fine. If it is, we clear cap->ci (to mark the cap as pending
removal) but leave it in the session list. In iterate_caps, we
can safely finish removal and get the next cap pointer.
While we're at it, clean up put_cap to not take a cap reservation
context, as it was never used.
Signed-off-by: Sage Weil <sage@newdream.net>
2010-02-16 22:39:45 +03:00
|
|
|
struct ceph_cap *s_cap_iterator;
|
2009-10-06 22:31:09 +04:00
|
|
|
|
|
|
|
/* protected by mutex */
|
|
|
|
struct list_head s_cap_flushing; /* inodes w/ flushing caps */
|
|
|
|
unsigned long s_renew_requested; /* last time we sent a renew req */
|
|
|
|
u64 s_renew_seq;
|
|
|
|
|
|
|
|
atomic_t s_ref;
|
|
|
|
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);
|
2014-10-14 06:33:35 +04:00
|
|
|
/*
|
|
|
|
* wait for request completion callback
|
|
|
|
*/
|
|
|
|
typedef int (*ceph_mds_request_wait_callback_t) (struct ceph_mds_client *mdsc,
|
|
|
|
struct ceph_mds_request *req);
|
2009-10-06 22:31:09 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* an in-flight mds request
|
|
|
|
*/
|
|
|
|
struct ceph_mds_request {
|
|
|
|
u64 r_tid; /* transaction id */
|
2010-02-15 23:08:46 +03:00
|
|
|
struct rb_node r_node;
|
2010-06-18 03:16:12 +04:00
|
|
|
struct ceph_mds_client *r_mdsc;
|
2009-10-06 22:31:09 +04:00
|
|
|
|
|
|
|
int r_op; /* mds op code */
|
|
|
|
|
|
|
|
/* operation on what? */
|
|
|
|
struct inode *r_inode; /* arg1 */
|
|
|
|
struct dentry *r_dentry; /* arg1 */
|
|
|
|
struct dentry *r_old_dentry; /* arg2: rename from or link from */
|
2011-07-26 22:31:14 +04:00
|
|
|
struct inode *r_old_dentry_dir; /* arg2: old dentry's parent dir */
|
2009-10-06 22:31:09 +04:00
|
|
|
char *r_path1, *r_path2;
|
|
|
|
struct ceph_vino r_ino1, r_ino2;
|
|
|
|
|
|
|
|
struct inode *r_locked_dir; /* dir (if any) i_mutex locked by vfs */
|
|
|
|
struct inode *r_target_inode; /* resulting inode */
|
|
|
|
|
2010-05-13 23:01:13 +04:00
|
|
|
struct mutex r_fill_mutex;
|
|
|
|
|
2009-10-06 22:31:09 +04:00
|
|
|
union ceph_mds_request_args r_args;
|
|
|
|
int r_fmode; /* file mode, if expecting cap */
|
2013-01-31 16:01:53 +04:00
|
|
|
kuid_t r_uid;
|
|
|
|
kgid_t r_gid;
|
2014-05-22 04:41:08 +04:00
|
|
|
struct timespec r_stamp;
|
2009-10-06 22:31:09 +04:00
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
bool r_direct_is_hash; /* true if r_direct_hash is valid */
|
|
|
|
|
|
|
|
/* data payload is used for xattr ops */
|
2014-09-16 15:15:28 +04:00
|
|
|
struct ceph_pagelist *r_pagelist;
|
2009-10-06 22:31:09 +04:00
|
|
|
|
|
|
|
/* 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 */
|
2010-07-16 01:58:39 +04:00
|
|
|
int r_request_release_offset;
|
2009-10-06 22:31:09 +04:00
|
|
|
struct ceph_msg *r_reply;
|
|
|
|
struct ceph_mds_reply_info_parsed r_reply_info;
|
2014-11-14 16:56:29 +03:00
|
|
|
struct page *r_locked_page;
|
2009-10-06 22:31:09 +04:00
|
|
|
int r_err;
|
2010-01-25 22:33:08 +03:00
|
|
|
bool r_aborted;
|
2009-10-06 22:31:09 +04:00
|
|
|
|
2015-05-15 12:02:17 +03:00
|
|
|
unsigned long r_timeout; /* optional. jiffies, 0 is "wait forever" */
|
2009-10-06 22:31:09 +04:00
|
|
|
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;
|
|
|
|
|
2015-10-27 13:36:06 +03:00
|
|
|
/* unsafe requests that modify the target inode */
|
|
|
|
struct list_head r_unsafe_target_item;
|
|
|
|
|
2009-10-06 22:31:09 +04:00
|
|
|
struct ceph_mds_session *r_session;
|
|
|
|
|
|
|
|
int r_attempts; /* resend attempts */
|
|
|
|
int r_num_fwd; /* number of forward attempts */
|
|
|
|
int r_resend_mds; /* mds to resend to next, if any*/
|
2010-06-23 02:58:01 +04:00
|
|
|
u32 r_sent_on_mseq; /* cap mseq request was sent at*/
|
2009-10-06 22:31:09 +04:00
|
|
|
|
2009-12-07 23:31:09 +03:00
|
|
|
struct kref r_kref;
|
2009-10-06 22:31:09 +04:00
|
|
|
struct list_head r_wait;
|
|
|
|
struct completion r_completion;
|
|
|
|
struct completion r_safe_completion;
|
|
|
|
ceph_mds_request_callback_t r_callback;
|
2014-10-14 06:33:35 +04:00
|
|
|
ceph_mds_request_wait_callback_t r_wait_for_completion;
|
2009-10-06 22:31:09 +04:00
|
|
|
struct list_head r_unsafe_item; /* per-session unsafe list item */
|
2010-05-13 22:19:06 +04:00
|
|
|
bool r_got_unsafe, r_got_safe, r_got_result;
|
2009-10-06 22:31:09 +04:00
|
|
|
|
|
|
|
bool r_did_prepopulate;
|
2015-06-16 15:48:56 +03:00
|
|
|
long long r_dir_release_cnt;
|
|
|
|
long long r_dir_ordered_cnt;
|
|
|
|
int r_readdir_cache_idx;
|
2009-10-06 22:31:09 +04:00
|
|
|
u32 r_readdir_offset;
|
|
|
|
|
|
|
|
struct ceph_cap_reservation r_caps_reservation;
|
|
|
|
int r_num_caps;
|
|
|
|
};
|
|
|
|
|
2015-04-27 10:33:28 +03:00
|
|
|
struct ceph_pool_perm {
|
|
|
|
struct rb_node node;
|
|
|
|
int perm;
|
2016-02-03 16:24:49 +03:00
|
|
|
s64 pool;
|
2016-03-07 04:35:06 +03:00
|
|
|
size_t pool_ns_len;
|
|
|
|
char pool_ns[];
|
2015-04-27 10:33:28 +03:00
|
|
|
};
|
|
|
|
|
2009-10-06 22:31:09 +04:00
|
|
|
/*
|
|
|
|
* mds client state
|
|
|
|
*/
|
|
|
|
struct ceph_mds_client {
|
2010-04-07 02:14:15 +04:00
|
|
|
struct ceph_fs_client *fsc;
|
2009-10-06 22:31:09 +04:00
|
|
|
struct mutex mutex; /* all nested structures */
|
|
|
|
|
|
|
|
struct ceph_mdsmap *mdsmap;
|
2010-08-12 01:51:23 +04:00
|
|
|
struct completion safe_umount_waiters;
|
|
|
|
wait_queue_head_t session_close_wq;
|
2009-10-06 22:31:09 +04:00
|
|
|
struct list_head waiting_for_map;
|
2016-07-08 06:25:38 +03:00
|
|
|
int mdsmap_err;
|
2009-10-06 22:31:09 +04:00
|
|
|
|
|
|
|
struct ceph_mds_session **sessions; /* NULL for mds if no session */
|
2015-01-09 12:00:42 +03:00
|
|
|
atomic_t num_sessions;
|
2009-10-06 22:31:09 +04:00
|
|
|
int max_sessions; /* len of s_mds_sessions */
|
|
|
|
int stopping; /* true if shutting down */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2015-05-05 16:22:13 +03:00
|
|
|
u64 last_snap_seq;
|
2009-10-06 22:31:09 +04:00
|
|
|
struct rw_semaphore snap_rwsem;
|
2010-02-16 01:37:55 +03:00
|
|
|
struct rb_root snap_realms;
|
2009-10-06 22:31:09 +04:00
|
|
|
struct list_head snap_empty;
|
|
|
|
spinlock_t snap_empty_lock; /* protect snap_empty */
|
|
|
|
|
|
|
|
u64 last_tid; /* most recent mds request */
|
2015-05-19 13:54:40 +03:00
|
|
|
u64 oldest_tid; /* oldest incomplete mds request,
|
|
|
|
excluding setfilelock requests */
|
2010-02-15 23:08:46 +03:00
|
|
|
struct rb_root request_tree; /* pending mds requests */
|
2009-10-06 22:31:09 +04:00
|
|
|
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;
|
|
|
|
|
2015-06-09 10:48:57 +03:00
|
|
|
u64 last_cap_flush_tid;
|
2016-07-06 06:12:56 +03:00
|
|
|
struct list_head cap_flush_list;
|
2009-10-06 22:31:09 +04:00
|
|
|
struct list_head cap_dirty; /* inodes with dirty caps */
|
2011-05-24 22:46:31 +04:00
|
|
|
struct list_head cap_dirty_migrating; /* ...that are migration... */
|
2009-10-06 22:31:09 +04:00
|
|
|
int num_cap_flushing; /* # caps we are flushing */
|
|
|
|
spinlock_t cap_dirty_lock; /* protects above items */
|
|
|
|
wait_queue_head_t cap_flushing_wq;
|
|
|
|
|
2010-06-18 03:16:12 +04:00
|
|
|
/*
|
|
|
|
* 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) */
|
2009-10-06 22:31:09 +04:00
|
|
|
spinlock_t dentry_lru_lock;
|
|
|
|
struct list_head dentry_lru;
|
|
|
|
int num_dentry;
|
2015-04-27 10:33:28 +03:00
|
|
|
|
|
|
|
struct rw_semaphore pool_perm_rwsem;
|
|
|
|
struct rb_root pool_perm_tree;
|
2009-10-06 22:31:09 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
atomic_inc(&s->s_ref);
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2014-09-19 16:51:08 +04:00
|
|
|
extern const char *ceph_session_state_name(int s);
|
|
|
|
|
2009-10-06 22:31:09 +04:00
|
|
|
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);
|
|
|
|
|
2010-04-07 02:14:15 +04:00
|
|
|
extern int ceph_mdsc_init(struct ceph_fs_client *fsc);
|
2009-10-06 22:31:09 +04:00
|
|
|
extern void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc);
|
2015-07-01 11:27:46 +03:00
|
|
|
extern void ceph_mdsc_force_umount(struct ceph_mds_client *mdsc);
|
2010-04-07 02:14:15 +04:00
|
|
|
extern void ceph_mdsc_destroy(struct ceph_fs_client *fsc);
|
2009-10-06 22:31:09 +04:00
|
|
|
|
|
|
|
extern void ceph_mdsc_sync(struct ceph_mds_client *mdsc);
|
|
|
|
|
2010-05-14 21:02:57 +04:00
|
|
|
extern void ceph_invalidate_dir_request(struct ceph_mds_request *req);
|
2014-03-29 09:41:15 +04:00
|
|
|
extern int ceph_alloc_readdir_reply_buffer(struct ceph_mds_request *req,
|
|
|
|
struct inode *dir);
|
2009-10-06 22:31:09 +04:00
|
|
|
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)
|
|
|
|
{
|
2009-12-07 23:31:09 +03:00
|
|
|
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);
|
2009-10-06 22:31:09 +04:00
|
|
|
}
|
|
|
|
|
2010-06-10 03:47:10 +04:00
|
|
|
extern void ceph_send_cap_releases(struct ceph_mds_client *mdsc,
|
|
|
|
struct ceph_mds_session *session);
|
|
|
|
|
2009-10-06 22:31:09 +04:00
|
|
|
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);
|
|
|
|
|
2016-07-08 06:25:38 +03:00
|
|
|
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);
|
2009-10-06 22:31:09 +04:00
|
|
|
|
2013-11-24 10:33:01 +04:00
|
|
|
extern struct ceph_mds_session *
|
|
|
|
ceph_mdsc_open_export_target_session(struct ceph_mds_client *mdsc, int target);
|
2010-06-22 00:45:04 +04:00
|
|
|
extern void ceph_mdsc_open_export_target_sessions(struct ceph_mds_client *mdsc,
|
|
|
|
struct ceph_mds_session *session);
|
|
|
|
|
2009-10-06 22:31:09 +04:00
|
|
|
#endif
|