linux/fs/ceph/mds_client.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _FS_CEPH_MDS_CLIENT_H
#define _FS_CEPH_MDS_CLIENT_H

#include <linux/completion.h>
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/rbtree.h>
#include <linux/spinlock.h>
#include <linux/refcount.h>
#include <linux/utsname.h>
#include <linux/ktime.h>

#include <linux/ceph/types.h>
#include <linux/ceph/messenger.h>
#include <linux/ceph/auth.h>

#include "mdsmap.h"
#include "metric.h"
#include "super.h"

/* The first 8 bits are reserved for old ceph releases */
enum ceph_feature_type {};

#define CEPHFS_FEATURES_CLIENT_SUPPORTED

/*
 * Some lock dependencies:
 *
 * session->s_mutex
 *         mdsc->mutex
 *
 *         mdsc->snap_rwsem
 *
 *         ci->i_ceph_lock
 *                 mdsc->snap_flush_lock
 *                 mdsc->cap_delay_lock
 *
 */

struct ceph_fs_client;
struct ceph_cap;

#define MDS_AUTH_UID_ANY

struct ceph_mds_cap_match {};

struct ceph_mds_cap_auth {};

/*
 * 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_dir_entry {};

struct ceph_mds_reply_xattr {};

/*
 * 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).
 */
struct ceph_mds_reply_info_parsed {};


/*
 * cap releases are batched and sent to the MDS en masse.
 *
 * Account for per-message overhead of mds_cap_release header
 * and __le32 for osd epoch barrier trailing field.
 */
#define CEPH_CAPS_PER_RELEASE


/*
 * state associated with each MDS<->client session
 */
enum {};

struct ceph_mds_session {};

/*
 * modes of choosing which MDS to send a request to
 */
enum {};

struct ceph_mds_request;
struct ceph_mds_client;

/*
 * request completion callback
 */
ceph_mds_request_callback_t;
/*
 * wait for request completion callback
 */
ceph_mds_request_wait_callback_t;

/*
 * an in-flight mds request
 */
struct ceph_mds_request {};

struct ceph_pool_perm {};

struct ceph_snapid_map {};

/*
 * node for list of quotarealm inodes that are not visible from the filesystem
 * mountpoint, but required to handle, e.g. quotas.
 */
struct ceph_quotarealm_inode {};

#ifdef CONFIG_DEBUG_FS

struct cap_wait {};

#endif

enum {};

/*
 * mds client state
 */
struct ceph_mds_client {};

extern const char *ceph_mds_op_name(int op);

extern bool check_session_state(struct ceph_mds_session *s);
void inc_session_sequence(struct ceph_mds_session *s);

extern struct ceph_mds_session *
__ceph_lookup_mds_session(struct ceph_mds_client *, int mds);

extern const char *ceph_session_state_name(int s);

extern struct ceph_mds_session *
ceph_get_mds_session(struct ceph_mds_session *s);
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);

extern int ceph_mdsc_init(struct ceph_fs_client *fsc);
extern void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc);
extern void ceph_mdsc_force_umount(struct ceph_mds_client *mdsc);
extern void ceph_mdsc_destroy(struct ceph_fs_client *fsc);

extern void ceph_mdsc_sync(struct ceph_mds_client *mdsc);

extern void ceph_invalidate_dir_request(struct ceph_mds_request *req);
extern int ceph_alloc_readdir_reply_buffer(struct ceph_mds_request *req,
					   struct inode *dir);
extern struct ceph_mds_request *
ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode);
extern int ceph_mdsc_submit_request(struct ceph_mds_client *mdsc,
				    struct inode *dir,
				    struct ceph_mds_request *req);
int ceph_mdsc_wait_request(struct ceph_mds_client *mdsc,
			struct ceph_mds_request *req,
			ceph_mds_request_wait_callback_t wait_func);
extern int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
				struct inode *dir,
				struct ceph_mds_request *req);
extern void ceph_mdsc_release_dir_caps(struct ceph_mds_request *req);
extern void ceph_mdsc_release_dir_caps_async(struct ceph_mds_request *req);
static inline void ceph_mdsc_get_request(struct ceph_mds_request *req)
{}
extern void ceph_mdsc_release_request(struct kref *kref);
static inline void ceph_mdsc_put_request(struct ceph_mds_request *req)
{}

extern void send_flush_mdlog(struct ceph_mds_session *s);
extern void ceph_mdsc_iterate_sessions(struct ceph_mds_client *mdsc,
				       void (*cb)(struct ceph_mds_session *),
				       bool check_state);
extern struct ceph_msg *ceph_create_session_msg(u32 op, u64 seq);
extern void __ceph_queue_cap_release(struct ceph_mds_session *session,
				    struct ceph_cap *cap);
extern void ceph_flush_cap_releases(struct ceph_mds_client *mdsc,
				    struct ceph_mds_session *session);
extern void ceph_queue_cap_reclaim_work(struct ceph_mds_client *mdsc);
extern void ceph_reclaim_caps_nr(struct ceph_mds_client *mdsc, int nr);
extern void ceph_queue_cap_unlink_work(struct ceph_mds_client *mdsc);
extern int ceph_iterate_session_caps(struct ceph_mds_session *session,
				     int (*cb)(struct inode *, int mds, void *),
				     void *arg);
extern int ceph_mds_check_access(struct ceph_mds_client *mdsc, char *tpath,
				 int mask);

extern void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc);

static inline void ceph_mdsc_free_path(char *path, int len)
{}

extern char *ceph_mdsc_build_path(struct ceph_mds_client *mdsc,
				  struct dentry *dentry, int *plen, u64 *base,
				  int for_wire);

extern void __ceph_mdsc_drop_dentry_lease(struct dentry *dentry);
extern void ceph_mdsc_lease_send_msg(struct ceph_mds_session *session,
				     struct dentry *dentry, char action,
				     u32 seq);

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);

extern struct ceph_mds_session *
ceph_mdsc_open_export_target_session(struct ceph_mds_client *mdsc, int target);
extern void ceph_mdsc_open_export_target_sessions(struct ceph_mds_client *mdsc,
					  struct ceph_mds_session *session);

extern int ceph_trim_caps(struct ceph_mds_client *mdsc,
			  struct ceph_mds_session *session,
			  int max_caps);

static inline int ceph_wait_on_async_create(struct inode *inode)
{}

extern int ceph_wait_on_conflict_unlink(struct dentry *dentry);
extern u64 ceph_get_deleg_ino(struct ceph_mds_session *session);
extern int ceph_restore_deleg_ino(struct ceph_mds_session *session, u64 ino);

extern bool enable_unsafe_idmap;
#endif