linux/fs/ceph/super.h

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

#include <linux/ceph/ceph_debug.h>
#include <linux/ceph/osd_client.h>

#include <asm/unaligned.h>
#include <linux/backing-dev.h>
#include <linux/completion.h>
#include <linux/exportfs.h>
#include <linux/fs.h>
#include <linux/mempool.h>
#include <linux/pagemap.h>
#include <linux/wait.h>
#include <linux/writeback.h>
#include <linux/slab.h>
#include <linux/posix_acl.h>
#include <linux/refcount.h>
#include <linux/security.h>
#include <linux/netfs.h>
#include <linux/fscache.h>
#include <linux/hashtable.h>

#include <linux/ceph/libceph.h>
#include "crypto.h"

/* large granularity for statfs utilization stats to facilitate
 * large volume sizes on 32-bit machines. */
#define CEPH_BLOCK_SHIFT
#define CEPH_BLOCK
#define CEPH_4K_BLOCK_SHIFT

#define CEPH_MOUNT_OPT_CLEANRECOVER
#define CEPH_MOUNT_OPT_DIRSTAT
#define CEPH_MOUNT_OPT_RBYTES
#define CEPH_MOUNT_OPT_NOASYNCREADDIR
#define CEPH_MOUNT_OPT_INO32
#define CEPH_MOUNT_OPT_DCACHE
#define CEPH_MOUNT_OPT_FSCACHE
#define CEPH_MOUNT_OPT_NOPOOLPERM
#define CEPH_MOUNT_OPT_MOUNTWAIT
#define CEPH_MOUNT_OPT_NOQUOTADF
#define CEPH_MOUNT_OPT_NOCOPYFROM
#define CEPH_MOUNT_OPT_ASYNC_DIROPS
#define CEPH_MOUNT_OPT_NOPAGECACHE
#define CEPH_MOUNT_OPT_SPARSEREAD

#define CEPH_MOUNT_OPT_DEFAULT

#define ceph_set_mount_opt(fsc, opt)
#define ceph_clear_mount_opt(fsc, opt)
#define ceph_test_mount_opt(fsc, opt)

/* max size of osd read request, limited by libceph */
#define CEPH_MAX_READ_SIZE
/* osd has a configurable limitaion of max write size.
 * CEPH_MSG_MAX_DATA_LEN should be small enough. */
#define CEPH_MAX_WRITE_SIZE
#define CEPH_RASIZE_DEFAULT
#define CEPH_MAX_READDIR_DEFAULT
#define CEPH_MAX_READDIR_BYTES_DEFAULT
#define CEPH_SNAPDIRNAME_DEFAULT

/*
 * Delay telling the MDS we no longer want caps, in case we reopen
 * the file.  Delay a minimum amount of time, even if we send a cap
 * message for some other reason.  Otherwise, take the oppotunity to
 * update the mds to avoid sending another message later.
 */
#define CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT
#define CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT

struct ceph_mount_options {};

/* mount state */
enum {};

#define CEPH_ASYNC_CREATE_CONFLICT_BITS

struct ceph_fs_client {};

/*
 * File i/o capability.  This tracks shared state with the metadata
 * server that allows us to cache or writeback attributes or to read
 * and write data.  For any given inode, we should have one or more
 * capabilities, one issued by each metadata server, and our
 * cumulative access is the OR of all issued capabilities.
 *
 * Each cap is referenced by the inode's i_caps rbtree and by per-mds
 * session capability lists.
 */
struct ceph_cap {};

#define CHECK_CAPS_AUTHONLY
#define CHECK_CAPS_FLUSH
#define CHECK_CAPS_NOINVAL
#define CHECK_CAPS_FLUSH_FORCE

struct ceph_cap_flush {};

/*
 * Snapped cap state that is pending flush to mds.  When a snapshot occurs,
 * we first complete any in-process sync writes and writeback any dirty
 * data before flushing the snapped state (tracked here) back to the MDS.
 */
struct ceph_cap_snap {};

static inline void ceph_put_cap_snap(struct ceph_cap_snap *capsnap)
{}

/*
 * The frag tree describes how a directory is fragmented, potentially across
 * multiple metadata servers.  It is also used to indicate points where
 * metadata authority is delegated, and whether/where metadata is replicated.
 *
 * A _leaf_ frag will be present in the i_fragtree IFF there is
 * delegation info.  That is, if mds >= 0 || ndist > 0.
 */
#define CEPH_MAX_DIRFRAG_REP

struct ceph_inode_frag {};

/*
 * We cache inode xattrs as an encoded blob until they are first used,
 * at which point we parse them into an rbtree.
 */
struct ceph_inode_xattr {};

/*
 * Ceph dentry state
 */
struct ceph_dentry_info {};

#define CEPH_DENTRY_REFERENCED
#define CEPH_DENTRY_LEASE_LIST
#define CEPH_DENTRY_SHRINK_LIST
#define CEPH_DENTRY_PRIMARY_LINK
#define CEPH_DENTRY_ASYNC_UNLINK_BIT
#define CEPH_DENTRY_ASYNC_UNLINK
#define CEPH_DENTRY_ASYNC_CREATE_BIT
#define CEPH_DENTRY_ASYNC_CREATE

struct ceph_inode_xattrs_info {};

/*
 * Ceph inode.
 */
struct ceph_inode_info {};

struct ceph_netfs_request_data {};

static inline struct ceph_inode_info *
ceph_inode(const struct inode *inode)
{}

static inline struct ceph_fs_client *
ceph_inode_to_fs_client(const struct inode *inode)
{}

static inline struct ceph_fs_client *
ceph_sb_to_fs_client(const struct super_block *sb)
{}

static inline struct ceph_mds_client *
ceph_sb_to_mdsc(const struct super_block *sb)
{}

static inline struct ceph_client *
ceph_inode_to_client(const struct inode *inode)
{}

static inline struct ceph_vino
ceph_vino(const struct inode *inode)
{}

static inline u32 ceph_ino_to_ino32(u64 vino)
{}

/*
 * Inode numbers in cephfs are 64 bits, but inode->i_ino is 32-bits on
 * some arches. We generally do not use this value inside the ceph driver, but
 * we do want to set it to something, so that generic vfs code has an
 * appropriate value for tracepoints and the like.
 */
static inline ino_t ceph_vino_to_ino_t(struct ceph_vino vino)
{}

/* for printf-style formatting */
#define ceph_vinop(i)

static inline u64 ceph_ino(struct inode *inode)
{}

static inline u64 ceph_snap(struct inode *inode)
{}

/**
 * ceph_present_ino - format an inode number for presentation to userland
 * @sb: superblock where the inode lives
 * @ino: inode number to (possibly) convert
 *
 * If the user mounted with the ino32 option, then the 64-bit value needs
 * to be converted to something that can fit inside 32 bits. Note that
 * internal kernel code never uses this value, so this is entirely for
 * userland consumption.
 */
static inline u64 ceph_present_ino(struct super_block *sb, u64 ino)
{}

static inline u64 ceph_present_inode(struct inode *inode)
{}

static inline int ceph_ino_compare(struct inode *inode, void *data)
{}

/*
 * The MDS reserves a set of inodes for its own usage. These should never
 * be accessible by clients, and so the MDS has no reason to ever hand these
 * out. The range is CEPH_MDS_INO_MDSDIR_OFFSET..CEPH_INO_SYSTEM_BASE.
 *
 * These come from src/mds/mdstypes.h in the ceph sources.
 */
#define CEPH_MAX_MDS
#define CEPH_NUM_STRAY
#define CEPH_MDS_INO_MDSDIR_OFFSET
#define CEPH_MDS_INO_LOG_OFFSET
#define CEPH_INO_SYSTEM_BASE

static inline bool ceph_vino_is_reserved(const struct ceph_vino vino)
{}

static inline struct inode *ceph_find_inode(struct super_block *sb,
					    struct ceph_vino vino)
{}


/*
 * Ceph inode.
 */
#define CEPH_I_DIR_ORDERED
#define CEPH_I_FLUSH
#define CEPH_I_POOL_PERM
#define CEPH_I_POOL_RD
#define CEPH_I_POOL_WR
#define CEPH_I_SEC_INITED
#define CEPH_I_KICK_FLUSH
#define CEPH_I_FLUSH_SNAPS
#define CEPH_I_ERROR_WRITE
#define CEPH_I_ERROR_FILELOCK
#define CEPH_I_ODIRECT
#define CEPH_ASYNC_CREATE_BIT
#define CEPH_I_ASYNC_CREATE
#define CEPH_I_SHUTDOWN
#define CEPH_I_ASYNC_CHECK_CAPS

/*
 * Masks of ceph inode work.
 */
#define CEPH_I_WORK_WRITEBACK
#define CEPH_I_WORK_INVALIDATE_PAGES
#define CEPH_I_WORK_VMTRUNCATE
#define CEPH_I_WORK_CHECK_CAPS
#define CEPH_I_WORK_FLUSH_SNAPS

/*
 * We set the ERROR_WRITE bit when we start seeing write errors on an inode
 * and then clear it when they start succeeding. Note that we do a lockless
 * check first, and only take the lock if it looks like it needs to be changed.
 * The write submission code just takes this as a hint, so we're not too
 * worried if a few slip through in either direction.
 */
static inline void ceph_set_error_write(struct ceph_inode_info *ci)
{}

static inline void ceph_clear_error_write(struct ceph_inode_info *ci)
{}

static inline void __ceph_dir_set_complete(struct ceph_inode_info *ci,
					   long long release_count,
					   long long ordered_count)
{}

static inline void __ceph_dir_clear_complete(struct ceph_inode_info *ci)
{}

static inline void __ceph_dir_clear_ordered(struct ceph_inode_info *ci)
{}

static inline bool __ceph_dir_is_complete(struct ceph_inode_info *ci)
{}

static inline bool __ceph_dir_is_complete_ordered(struct ceph_inode_info *ci)
{}

static inline void ceph_dir_clear_complete(struct inode *inode)
{}

static inline void ceph_dir_clear_ordered(struct inode *inode)
{}

static inline bool ceph_dir_is_complete_ordered(struct inode *inode)
{}

/* find a specific frag @f */
extern struct ceph_inode_frag *__ceph_find_frag(struct ceph_inode_info *ci,
						u32 f);

/*
 * choose fragment for value @v.  copy frag content to pfrag, if leaf
 * exists
 */
extern u32 ceph_choose_frag(struct ceph_inode_info *ci, u32 v,
			    struct ceph_inode_frag *pfrag,
			    int *found);

static inline struct ceph_dentry_info *ceph_dentry(const struct dentry *dentry)
{}

/*
 * caps helpers
 */
static inline bool __ceph_is_any_real_caps(struct ceph_inode_info *ci)
{}

extern int __ceph_caps_issued(struct ceph_inode_info *ci, int *implemented);
extern int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int t);
extern int __ceph_caps_issued_mask_metric(struct ceph_inode_info *ci, int mask,
					  int t);
extern int __ceph_caps_issued_other(struct ceph_inode_info *ci,
				    struct ceph_cap *cap);

static inline int ceph_caps_issued(struct ceph_inode_info *ci)
{}

static inline int ceph_caps_issued_mask_metric(struct ceph_inode_info *ci,
					       int mask, int touch)
{}

static inline int __ceph_caps_dirty(struct ceph_inode_info *ci)
{}
extern struct ceph_cap_flush *ceph_alloc_cap_flush(void);
extern void ceph_free_cap_flush(struct ceph_cap_flush *cf);
extern int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask,
				  struct ceph_cap_flush **pcf);

extern int __ceph_caps_revoking_other(struct ceph_inode_info *ci,
				      struct ceph_cap *ocap, int mask);
extern int ceph_caps_revoking(struct ceph_inode_info *ci, int mask);
extern int __ceph_caps_used(struct ceph_inode_info *ci);

static inline bool __ceph_is_file_opened(struct ceph_inode_info *ci)
{}
extern int __ceph_caps_file_wanted(struct ceph_inode_info *ci);
extern int __ceph_caps_wanted(struct ceph_inode_info *ci);

/* what the mds thinks we want */
extern int __ceph_caps_mds_wanted(struct ceph_inode_info *ci, bool check);

extern void ceph_caps_init(struct ceph_mds_client *mdsc);
extern void ceph_caps_finalize(struct ceph_mds_client *mdsc);
extern void ceph_adjust_caps_max_min(struct ceph_mds_client *mdsc,
				     struct ceph_mount_options *fsopt);
extern int ceph_reserve_caps(struct ceph_mds_client *mdsc,
			     struct ceph_cap_reservation *ctx, int need);
extern void ceph_unreserve_caps(struct ceph_mds_client *mdsc,
			       struct ceph_cap_reservation *ctx);
extern void ceph_reservation_status(struct ceph_fs_client *client,
				    int *total, int *avail, int *used,
				    int *reserved, int *min);
extern void change_auth_cap_ses(struct ceph_inode_info *ci,
				struct ceph_mds_session *session);



/*
 * we keep buffered readdir results attached to file->private_data
 */
#define CEPH_F_SYNC
#define CEPH_F_ATEND

struct ceph_file_info {};

struct ceph_dir_file_info {};

struct ceph_rw_context {};

#define CEPH_DEFINE_RW_CONTEXT(_name, _caps)

static inline void ceph_add_rw_context(struct ceph_file_info *cf,
				       struct ceph_rw_context *ctx)
{}

static inline void ceph_del_rw_context(struct ceph_file_info *cf,
				       struct ceph_rw_context *ctx)
{}

static inline struct ceph_rw_context*
ceph_find_rw_context(struct ceph_file_info *cf)
{}

struct ceph_readdir_cache_control {};

/*
 * A "snap realm" describes a subset of the file hierarchy sharing
 * the same set of snapshots that apply to it.  The realms themselves
 * are organized into a hierarchy, such that children inherit (some of)
 * the snapshots of their parents.
 *
 * All inodes within the realm that have capabilities are linked into a
 * per-realm list.
 */
struct ceph_snap_realm {};

static inline int default_congestion_kb(void)
{}


/* super.c */
extern int ceph_force_reconnect(struct super_block *sb);
/* snap.c */
struct ceph_snap_realm *ceph_lookup_snap_realm(struct ceph_mds_client *mdsc,
					       u64 ino);
extern void ceph_get_snap_realm(struct ceph_mds_client *mdsc,
				struct ceph_snap_realm *realm);
extern void ceph_put_snap_realm(struct ceph_mds_client *mdsc,
				struct ceph_snap_realm *realm);
extern int ceph_update_snap_trace(struct ceph_mds_client *m,
				  void *p, void *e, bool deletion,
				  struct ceph_snap_realm **realm_ret);
void ceph_change_snap_realm(struct inode *inode, struct ceph_snap_realm *realm);
extern void ceph_handle_snap(struct ceph_mds_client *mdsc,
			     struct ceph_mds_session *session,
			     struct ceph_msg *msg);
extern int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
				  struct ceph_cap_snap *capsnap);
extern void ceph_cleanup_global_and_empty_realms(struct ceph_mds_client *mdsc);

extern struct ceph_snapid_map *ceph_get_snapid_map(struct ceph_mds_client *mdsc,
						   u64 snap);
extern void ceph_put_snapid_map(struct ceph_mds_client* mdsc,
				struct ceph_snapid_map *sm);
extern void ceph_trim_snapid_map(struct ceph_mds_client *mdsc);
extern void ceph_cleanup_snapid_map(struct ceph_mds_client *mdsc);
void ceph_umount_begin(struct super_block *sb);


/*
 * a cap_snap is "pending" if it is still awaiting an in-progress
 * sync write (that may/may not still update size, mtime, etc.).
 */
static inline bool __ceph_have_pending_cap_snap(struct ceph_inode_info *ci)
{}

/* inode.c */
struct ceph_mds_reply_info_in;
struct ceph_mds_reply_dirfrag;
struct ceph_acl_sec_ctx;

extern const struct inode_operations ceph_file_iops;

extern struct inode *ceph_alloc_inode(struct super_block *sb);
extern void ceph_evict_inode(struct inode *inode);
extern void ceph_free_inode(struct inode *inode);

struct inode *ceph_new_inode(struct inode *dir, struct dentry *dentry,
			     umode_t *mode, struct ceph_acl_sec_ctx *as_ctx);
void ceph_as_ctx_to_req(struct ceph_mds_request *req,
			struct ceph_acl_sec_ctx *as_ctx);

extern struct inode *ceph_get_inode(struct super_block *sb,
				    struct ceph_vino vino,
				    struct inode *newino);
extern struct inode *ceph_get_snapdir(struct inode *parent);
extern int ceph_fill_file_size(struct inode *inode, int issued,
			       u32 truncate_seq, u64 truncate_size, u64 size);
extern void ceph_fill_file_time(struct inode *inode, int issued,
				u64 time_warp_seq, struct timespec64 *ctime,
				struct timespec64 *mtime,
				struct timespec64 *atime);
extern int ceph_fill_inode(struct inode *inode, struct page *locked_page,
		    struct ceph_mds_reply_info_in *iinfo,
		    struct ceph_mds_reply_dirfrag *dirinfo,
		    struct ceph_mds_session *session, int cap_fmode,
		    struct ceph_cap_reservation *caps_reservation);
extern int ceph_fill_trace(struct super_block *sb,
			   struct ceph_mds_request *req);
extern int ceph_readdir_prepopulate(struct ceph_mds_request *req,
				    struct ceph_mds_session *session);

extern int ceph_inode_holds_cap(struct inode *inode, int mask);

extern bool ceph_inode_set_size(struct inode *inode, loff_t size);
extern void __ceph_do_pending_vmtruncate(struct inode *inode);

void ceph_queue_inode_work(struct inode *inode, int work_bit);

static inline void ceph_queue_vmtruncate(struct inode *inode)
{}

static inline void ceph_queue_invalidate(struct inode *inode)
{}

static inline void ceph_queue_writeback(struct inode *inode)
{}

static inline void ceph_queue_check_caps(struct inode *inode)
{}

static inline void ceph_queue_flush_snaps(struct inode *inode)
{}

extern int ceph_try_to_choose_auth_mds(struct inode *inode, int mask);
extern int __ceph_do_getattr(struct inode *inode, struct page *locked_page,
			     int mask, bool force);
static inline int ceph_do_getattr(struct inode *inode, int mask, bool force)
{}
extern int ceph_permission(struct mnt_idmap *idmap,
			   struct inode *inode, int mask);

struct ceph_iattr {};

extern int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode,
			  struct iattr *attr, struct ceph_iattr *cia);
extern int ceph_setattr(struct mnt_idmap *idmap,
			struct dentry *dentry, struct iattr *attr);
extern int ceph_getattr(struct mnt_idmap *idmap,
			const struct path *path, struct kstat *stat,
			u32 request_mask, unsigned int flags);
void ceph_inode_shutdown(struct inode *inode);

static inline bool ceph_inode_is_shutdown(struct inode *inode)
{}

/* xattr.c */
int __ceph_setxattr(struct inode *, const char *, const void *, size_t, int);
int ceph_do_getvxattr(struct inode *inode, const char *name, void *value, size_t size);
ssize_t __ceph_getxattr(struct inode *, const char *, void *, size_t);
extern ssize_t ceph_listxattr(struct dentry *, char *, size_t);
extern struct ceph_buffer *__ceph_build_xattrs_blob(struct ceph_inode_info *ci);
extern void __ceph_destroy_xattrs(struct ceph_inode_info *ci);
extern const struct xattr_handler * const ceph_xattr_handlers[];

struct ceph_acl_sec_ctx {};

#ifdef CONFIG_SECURITY
extern bool ceph_security_xattr_deadlock(struct inode *in);
extern bool ceph_security_xattr_wanted(struct inode *in);
#else
static inline bool ceph_security_xattr_deadlock(struct inode *in)
{
	return false;
}
static inline bool ceph_security_xattr_wanted(struct inode *in)
{
	return false;
}
#endif

#ifdef CONFIG_CEPH_FS_SECURITY_LABEL
extern int ceph_security_init_secctx(struct dentry *dentry, umode_t mode,
				     struct ceph_acl_sec_ctx *ctx);
static inline void ceph_security_invalidate_secctx(struct inode *inode)
{}
#else
static inline int ceph_security_init_secctx(struct dentry *dentry, umode_t mode,
					    struct ceph_acl_sec_ctx *ctx)
{
	return 0;
}
static inline void ceph_security_invalidate_secctx(struct inode *inode)
{
}
#endif

void ceph_release_acl_sec_ctx(struct ceph_acl_sec_ctx *as_ctx);

/* acl.c */
#ifdef CONFIG_CEPH_FS_POSIX_ACL

struct posix_acl *ceph_get_acl(struct inode *, int, bool);
int ceph_set_acl(struct mnt_idmap *idmap,
		 struct dentry *dentry, struct posix_acl *acl, int type);
int ceph_pre_init_acls(struct inode *dir, umode_t *mode,
		       struct ceph_acl_sec_ctx *as_ctx);
void ceph_init_inode_acls(struct inode *inode,
			  struct ceph_acl_sec_ctx *as_ctx);

static inline void ceph_forget_all_cached_acls(struct inode *inode)
{}

#else

#define ceph_get_acl
#define ceph_set_acl

static inline int ceph_pre_init_acls(struct inode *dir, umode_t *mode,
				     struct ceph_acl_sec_ctx *as_ctx)
{
	return 0;
}
static inline void ceph_init_inode_acls(struct inode *inode,
					struct ceph_acl_sec_ctx *as_ctx)
{
}
static inline int ceph_acl_chmod(struct dentry *dentry, struct inode *inode)
{
	return 0;
}

static inline void ceph_forget_all_cached_acls(struct inode *inode)
{
}

#endif

/* caps.c */
extern const char *ceph_cap_string(int c);
extern void ceph_handle_caps(struct ceph_mds_session *session,
			     struct ceph_msg *msg);
extern struct ceph_cap *ceph_get_cap(struct ceph_mds_client *mdsc,
				     struct ceph_cap_reservation *ctx);
extern void ceph_add_cap(struct inode *inode,
			 struct ceph_mds_session *session, u64 cap_id,
			 unsigned issued, unsigned wanted,
			 unsigned cap, unsigned seq, u64 realmino, int flags,
			 struct ceph_cap **new_cap);
extern void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release);
extern void ceph_remove_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
			    bool queue_release);
extern void __ceph_remove_caps(struct ceph_inode_info *ci);
extern void ceph_put_cap(struct ceph_mds_client *mdsc,
			 struct ceph_cap *cap);
extern int ceph_is_any_caps(struct inode *inode);

extern int ceph_write_inode(struct inode *inode, struct writeback_control *wbc);
extern int ceph_fsync(struct file *file, loff_t start, loff_t end,
		      int datasync);
extern void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc,
					  struct ceph_mds_session *session);
extern void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc,
				    struct ceph_mds_session *session);
void ceph_kick_flushing_inode_caps(struct ceph_mds_session *session,
				   struct ceph_inode_info *ci);
extern struct ceph_cap *__get_cap_for_mds(struct ceph_inode_info *ci,
					  int mds);
extern struct ceph_cap *ceph_get_cap_for_mds(struct ceph_inode_info *ci,
					     int mds);
extern void ceph_take_cap_refs(struct ceph_inode_info *ci, int caps,
				bool snap_rwsem_locked);
extern void ceph_get_cap_refs(struct ceph_inode_info *ci, int caps);
extern void ceph_put_cap_refs(struct ceph_inode_info *ci, int had);
extern void ceph_put_cap_refs_async(struct ceph_inode_info *ci, int had);
extern void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
				       struct ceph_snap_context *snapc);
extern void __ceph_remove_capsnap(struct inode *inode,
				  struct ceph_cap_snap *capsnap,
				  bool *wake_ci, bool *wake_mdsc);
extern void ceph_remove_capsnap(struct inode *inode,
				struct ceph_cap_snap *capsnap,
				bool *wake_ci, bool *wake_mdsc);
extern void ceph_flush_snaps(struct ceph_inode_info *ci,
			     struct ceph_mds_session **psession);
extern bool __ceph_should_report_size(struct ceph_inode_info *ci);
extern void ceph_check_caps(struct ceph_inode_info *ci, int flags);
extern unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc);
extern void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc);
extern int  ceph_drop_caps_for_unlink(struct inode *inode);
extern int ceph_encode_inode_release(void **p, struct inode *inode,
				     int mds, int drop, int unless, int force);
extern int ceph_encode_dentry_release(void **p, struct dentry *dn,
				      struct inode *dir,
				      int mds, int drop, int unless);

extern int __ceph_get_caps(struct inode *inode, struct ceph_file_info *fi,
			   int need, int want, loff_t endoff, int *got);
extern int ceph_get_caps(struct file *filp, int need, int want,
			 loff_t endoff, int *got);
extern int ceph_try_get_caps(struct inode *inode,
			     int need, int want, bool nonblock, int *got);

/* for counting open files by mode */
extern void ceph_get_fmode(struct ceph_inode_info *ci, int mode, int count);
extern void ceph_put_fmode(struct ceph_inode_info *ci, int mode, int count);
extern void __ceph_touch_fmode(struct ceph_inode_info *ci,
			       struct ceph_mds_client *mdsc, int fmode);

/* addr.c */
extern const struct address_space_operations ceph_aops;
extern const struct netfs_request_ops ceph_netfs_ops;
extern int ceph_mmap(struct file *file, struct vm_area_struct *vma);
extern int ceph_uninline_data(struct file *file);
extern int ceph_pool_perm_check(struct inode *inode, int need);
extern void ceph_pool_perm_destroy(struct ceph_mds_client* mdsc);
int ceph_purge_inode_cap(struct inode *inode, struct ceph_cap *cap, bool *invalidate);

static inline bool ceph_has_inline_data(struct ceph_inode_info *ci)
{}

/* file.c */
extern const struct file_operations ceph_file_fops;

extern int ceph_renew_caps(struct inode *inode, int fmode);
extern int ceph_open(struct inode *inode, struct file *file);
extern int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
			    struct file *file, unsigned flags, umode_t mode);
extern ssize_t __ceph_sync_read(struct inode *inode, loff_t *ki_pos,
				struct iov_iter *to, int *retry_op,
				u64 *last_objver);
extern int ceph_release(struct inode *inode, struct file *filp);
extern void ceph_fill_inline_data(struct inode *inode, struct page *locked_page,
				  char *data, size_t len);

/* dir.c */
extern const struct file_operations ceph_dir_fops;
extern const struct file_operations ceph_snapdir_fops;
extern const struct inode_operations ceph_dir_iops;
extern const struct inode_operations ceph_snapdir_iops;
extern const struct dentry_operations ceph_dentry_ops;

extern loff_t ceph_make_fpos(unsigned high, unsigned off, bool hash_order);
extern int ceph_handle_notrace_create(struct inode *dir, struct dentry *dentry);
extern struct dentry *ceph_handle_snapdir(struct ceph_mds_request *req,
			       struct dentry *dentry);
extern struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
					 struct dentry *dentry, int err);

extern void __ceph_dentry_lease_touch(struct ceph_dentry_info *di);
extern void __ceph_dentry_dir_lease_touch(struct ceph_dentry_info *di);
extern void ceph_invalidate_dentry_lease(struct dentry *dentry);
extern int ceph_trim_dentries(struct ceph_mds_client *mdsc);
extern unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn);
extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl);

/* ioctl.c */
extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg);

/* export.c */
extern const struct export_operations ceph_export_ops;
struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino);

/* locks.c */
extern __init void ceph_flock_init(void);
extern int ceph_lock(struct file *file, int cmd, struct file_lock *fl);
extern int ceph_flock(struct file *file, int cmd, struct file_lock *fl);
extern void ceph_count_locks(struct inode *inode, int *p_num, int *f_num);
extern int ceph_encode_locks_to_buffer(struct inode *inode,
				       struct ceph_filelock *flocks,
				       int num_fcntl_locks,
				       int num_flock_locks);
extern int ceph_locks_to_pagelist(struct ceph_filelock *flocks,
				  struct ceph_pagelist *pagelist,
				  int num_fcntl_locks, int num_flock_locks);

/* debugfs.c */
extern void ceph_fs_debugfs_init(struct ceph_fs_client *client);
extern void ceph_fs_debugfs_cleanup(struct ceph_fs_client *client);

/* quota.c */

enum quota_get_realm {};

static inline bool __ceph_has_quota(struct ceph_inode_info *ci,
				    enum quota_get_realm which)
{}

extern void ceph_adjust_quota_realms_count(struct inode *inode, bool inc);

static inline void __ceph_update_quota(struct ceph_inode_info *ci,
				       u64 max_bytes, u64 max_files)
{}

static inline int __ceph_sparse_read_ext_count(struct inode *inode, u64 len)
{}

extern void ceph_handle_quota(struct ceph_mds_client *mdsc,
			      struct ceph_mds_session *session,
			      struct ceph_msg *msg);
extern bool ceph_quota_is_max_files_exceeded(struct inode *inode);
extern bool ceph_quota_is_same_realm(struct inode *old, struct inode *new);
extern bool ceph_quota_is_max_bytes_exceeded(struct inode *inode,
					     loff_t newlen);
extern bool ceph_quota_is_max_bytes_approaching(struct inode *inode,
						loff_t newlen);
extern bool ceph_quota_update_statfs(struct ceph_fs_client *fsc,
				     struct kstatfs *buf);
extern void ceph_cleanup_quotarealms_inodes(struct ceph_mds_client *mdsc);

bool ceph_inc_mds_stopping_blocker(struct ceph_mds_client *mdsc,
			       struct ceph_mds_session *session);
void ceph_dec_mds_stopping_blocker(struct ceph_mds_client *mdsc);
bool ceph_inc_osd_stopping_blocker(struct ceph_mds_client *mdsc);
void ceph_dec_osd_stopping_blocker(struct ceph_mds_client *mdsc);
#endif /* _FS_CEPH_SUPER_H */