2009-10-07 02:31:07 +08:00
|
|
|
#ifndef _FS_CEPH_SUPER_H
|
|
|
|
#define _FS_CEPH_SUPER_H
|
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
#include <linux/ceph/ceph_debug.h>
|
2009-10-07 02:31:07 +08:00
|
|
|
|
|
|
|
#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>
|
2010-01-18 08:53:08 +08:00
|
|
|
#include <linux/writeback.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2009-10-07 02:31:07 +08:00
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
#include <linux/ceph/libceph.h>
|
2009-10-07 02:31:07 +08:00
|
|
|
|
|
|
|
/* f_type in struct statfs */
|
|
|
|
#define CEPH_SUPER_MAGIC 0x00c36400
|
|
|
|
|
|
|
|
/* large granularity for statfs utilization stats to facilitate
|
|
|
|
* large volume sizes on 32-bit machines. */
|
|
|
|
#define CEPH_BLOCK_SHIFT 20 /* 1 MB */
|
|
|
|
#define CEPH_BLOCK (1 << CEPH_BLOCK_SHIFT)
|
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
#define CEPH_MOUNT_OPT_DIRSTAT (1<<4) /* `cat dirname` for stats */
|
|
|
|
#define CEPH_MOUNT_OPT_RBYTES (1<<5) /* dir st_bytes = rbytes */
|
|
|
|
#define CEPH_MOUNT_OPT_NOASYNCREADDIR (1<<7) /* no dcache readdir */
|
2011-01-22 08:44:03 +08:00
|
|
|
#define CEPH_MOUNT_OPT_INO32 (1<<8) /* 32 bit inos */
|
2010-07-08 00:06:08 +08:00
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
#define CEPH_MOUNT_OPT_DEFAULT (CEPH_MOUNT_OPT_RBYTES)
|
2009-10-07 02:31:07 +08:00
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
#define ceph_set_mount_opt(fsc, opt) \
|
|
|
|
(fsc)->mount_options->flags |= CEPH_MOUNT_OPT_##opt;
|
|
|
|
#define ceph_test_mount_opt(fsc, opt) \
|
|
|
|
(!!((fsc)->mount_options->flags & CEPH_MOUNT_OPT_##opt))
|
2009-10-07 02:31:07 +08:00
|
|
|
|
2011-08-04 23:03:44 +08:00
|
|
|
#define CEPH_RSIZE_DEFAULT 0 /* max read size */
|
|
|
|
#define CEPH_RASIZE_DEFAULT (8192*1024) /* readahead */
|
2010-04-07 06:14:15 +08:00
|
|
|
#define CEPH_MAX_READDIR_DEFAULT 1024
|
|
|
|
#define CEPH_MAX_READDIR_BYTES_DEFAULT (512*1024)
|
|
|
|
#define CEPH_SNAPDIRNAME_DEFAULT ".snap"
|
2009-10-07 02:31:07 +08:00
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
struct ceph_mount_options {
|
2010-04-30 07:38:32 +08:00
|
|
|
int flags;
|
2010-04-07 06:14:15 +08:00
|
|
|
int sb_flags;
|
|
|
|
|
2011-08-04 23:03:44 +08:00
|
|
|
int wsize; /* max write size */
|
|
|
|
int rsize; /* max read size */
|
|
|
|
int rasize; /* max readahead */
|
2010-04-30 07:38:32 +08:00
|
|
|
int congestion_kb; /* max writeback in flight */
|
|
|
|
int caps_wanted_delay_min, caps_wanted_delay_max;
|
|
|
|
int cap_release_safety;
|
2010-05-15 04:06:30 +08:00
|
|
|
int max_readdir; /* max readdir result (entires) */
|
|
|
|
int max_readdir_bytes; /* max readdir result (bytes) */
|
2009-10-07 02:31:07 +08:00
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
/*
|
|
|
|
* everything above this point can be memcmp'd; everything below
|
|
|
|
* is handled in compare_mount_options()
|
|
|
|
*/
|
2009-10-07 02:31:07 +08:00
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
char *snapdir_name; /* default ".snap" */
|
|
|
|
};
|
2009-10-07 02:31:07 +08:00
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
struct ceph_fs_client {
|
2009-10-07 02:31:07 +08:00
|
|
|
struct super_block *sb;
|
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
struct ceph_mount_options *mount_options;
|
|
|
|
struct ceph_client *client;
|
2009-10-07 02:31:07 +08:00
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
unsigned long mount_state;
|
2010-02-18 02:02:43 +08:00
|
|
|
int min_caps; /* min caps i added */
|
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
struct ceph_mds_client *mdsc;
|
2009-10-07 02:31:07 +08:00
|
|
|
|
|
|
|
/* writeback */
|
|
|
|
mempool_t *wb_pagevec_pool;
|
|
|
|
struct workqueue_struct *wb_wq;
|
|
|
|
struct workqueue_struct *pg_inv_wq;
|
|
|
|
struct workqueue_struct *trunc_wq;
|
2009-12-19 05:51:57 +08:00
|
|
|
atomic_long_t writeback_count;
|
2009-10-07 02:31:07 +08:00
|
|
|
|
|
|
|
struct backing_dev_info backing_dev_info;
|
2009-11-19 08:50:41 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_FS
|
2010-04-07 06:14:15 +08:00
|
|
|
struct dentry *debugfs_dentry_lru, *debugfs_caps;
|
2009-12-19 05:51:57 +08:00
|
|
|
struct dentry *debugfs_congestion_kb;
|
2009-12-16 06:44:32 +08:00
|
|
|
struct dentry *debugfs_bdi;
|
2010-04-07 06:14:15 +08:00
|
|
|
struct dentry *debugfs_mdsc, *debugfs_mdsmap;
|
2009-11-19 08:50:41 +08:00
|
|
|
#endif
|
2009-10-07 02:31:07 +08:00
|
|
|
};
|
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
|
2009-10-07 02:31:07 +08:00
|
|
|
/*
|
|
|
|
* 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 {
|
|
|
|
struct ceph_inode_info *ci;
|
|
|
|
struct rb_node ci_node; /* per-ci cap tree */
|
|
|
|
struct ceph_mds_session *session;
|
|
|
|
struct list_head session_caps; /* per-session caplist */
|
|
|
|
int mds;
|
|
|
|
u64 cap_id; /* unique cap id (mds provided) */
|
|
|
|
int issued; /* latest, from the mds */
|
|
|
|
int implemented; /* implemented superset of issued (for revocation) */
|
|
|
|
int mds_wanted;
|
2009-11-10 04:05:48 +08:00
|
|
|
u32 seq, issue_seq, mseq;
|
|
|
|
u32 cap_gen; /* active/stale cycle */
|
2009-10-07 02:31:07 +08:00
|
|
|
unsigned long last_used;
|
|
|
|
struct list_head caps_item;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define CHECK_CAPS_NODELAY 1 /* do not delay any further */
|
|
|
|
#define CHECK_CAPS_AUTHONLY 2 /* only check auth cap */
|
|
|
|
#define CHECK_CAPS_FLUSH 4 /* flush any dirty caps */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 {
|
|
|
|
atomic_t nref;
|
|
|
|
struct ceph_inode_info *ci;
|
|
|
|
struct list_head ci_item, flushing_item;
|
|
|
|
|
|
|
|
u64 follows, flush_tid;
|
|
|
|
int issued, dirty;
|
|
|
|
struct ceph_snap_context *context;
|
|
|
|
|
|
|
|
mode_t mode;
|
|
|
|
uid_t uid;
|
|
|
|
gid_t gid;
|
|
|
|
|
2010-08-23 06:03:56 +08:00
|
|
|
struct ceph_buffer *xattr_blob;
|
2009-10-07 02:31:07 +08:00
|
|
|
u64 xattr_version;
|
|
|
|
|
|
|
|
u64 size;
|
|
|
|
struct timespec mtime, atime, ctime;
|
|
|
|
u64 time_warp_seq;
|
|
|
|
int writing; /* a sync write is still in progress */
|
|
|
|
int dirty_pages; /* dirty pages awaiting writeback */
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void ceph_put_cap_snap(struct ceph_cap_snap *capsnap)
|
|
|
|
{
|
2010-08-23 06:03:56 +08:00
|
|
|
if (atomic_dec_and_test(&capsnap->nref)) {
|
|
|
|
if (capsnap->xattr_blob)
|
|
|
|
ceph_buffer_put(capsnap->xattr_blob);
|
2009-10-07 02:31:07 +08:00
|
|
|
kfree(capsnap);
|
2010-08-23 06:03:56 +08:00
|
|
|
}
|
2009-10-07 02:31:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 4
|
|
|
|
|
|
|
|
struct ceph_inode_frag {
|
|
|
|
struct rb_node node;
|
|
|
|
|
|
|
|
/* fragtree state */
|
|
|
|
u32 frag;
|
|
|
|
int split_by; /* i.e. 2^(split_by) children */
|
|
|
|
|
|
|
|
/* delegation and replication info */
|
|
|
|
int mds; /* -1 if same authority as parent */
|
|
|
|
int ndist; /* >0 if replicated */
|
|
|
|
int dist[CEPH_MAX_DIRFRAG_REP];
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 {
|
|
|
|
struct rb_node node;
|
|
|
|
|
|
|
|
const char *name;
|
|
|
|
int name_len;
|
|
|
|
const char *val;
|
|
|
|
int val_len;
|
|
|
|
int dirty;
|
|
|
|
|
|
|
|
int should_free_name;
|
|
|
|
int should_free_val;
|
|
|
|
};
|
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
/*
|
|
|
|
* Ceph dentry state
|
|
|
|
*/
|
|
|
|
struct ceph_dentry_info {
|
2011-03-16 06:53:40 +08:00
|
|
|
unsigned long flags;
|
2010-04-07 06:14:15 +08:00
|
|
|
struct ceph_mds_session *lease_session;
|
|
|
|
u32 lease_gen, lease_shared_gen;
|
|
|
|
u32 lease_seq;
|
|
|
|
unsigned long lease_renew_after, lease_renew_from;
|
|
|
|
struct list_head lru;
|
|
|
|
struct dentry *dentry;
|
|
|
|
u64 time;
|
|
|
|
u64 offset;
|
|
|
|
};
|
|
|
|
|
2011-03-16 06:53:40 +08:00
|
|
|
/*
|
|
|
|
* dentry flags
|
|
|
|
*
|
|
|
|
* The locking for D_COMPLETE is a bit odd:
|
|
|
|
* - we can clear it at almost any time (see ceph_d_prune)
|
|
|
|
* - it is only meaningful if:
|
|
|
|
* - we hold dir inode i_lock
|
|
|
|
* - we hold dir FILE_SHARED caps
|
|
|
|
* - the dentry D_COMPLETE is set
|
|
|
|
*/
|
|
|
|
#define CEPH_D_COMPLETE 1 /* if set, d_u.d_subdirs is complete directory */
|
|
|
|
|
2009-10-07 02:31:07 +08:00
|
|
|
struct ceph_inode_xattrs_info {
|
|
|
|
/*
|
|
|
|
* (still encoded) xattr blob. we avoid the overhead of parsing
|
|
|
|
* this until someone actually calls getxattr, etc.
|
|
|
|
*
|
|
|
|
* blob->vec.iov_len == 4 implies there are no xattrs; blob ==
|
|
|
|
* NULL means we don't know.
|
|
|
|
*/
|
|
|
|
struct ceph_buffer *blob, *prealloc_blob;
|
|
|
|
|
|
|
|
struct rb_root index;
|
|
|
|
bool dirty;
|
|
|
|
int count;
|
|
|
|
int names_size;
|
|
|
|
int vals_size;
|
|
|
|
u64 version, index_version;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ceph inode.
|
|
|
|
*/
|
|
|
|
struct ceph_inode_info {
|
|
|
|
struct ceph_vino i_vino; /* ceph ino + snap */
|
|
|
|
|
|
|
|
u64 i_version;
|
|
|
|
u32 i_time_warp_seq;
|
|
|
|
|
|
|
|
unsigned i_ceph_flags;
|
|
|
|
unsigned long i_release_count;
|
|
|
|
|
2010-11-17 03:14:34 +08:00
|
|
|
struct ceph_dir_layout i_dir_layout;
|
2009-10-07 02:31:07 +08:00
|
|
|
struct ceph_file_layout i_layout;
|
|
|
|
char *i_symlink;
|
|
|
|
|
|
|
|
/* for dirs */
|
|
|
|
struct timespec i_rctime;
|
|
|
|
u64 i_rbytes, i_rfiles, i_rsubdirs;
|
|
|
|
u64 i_files, i_subdirs;
|
2011-11-04 00:23:36 +08:00
|
|
|
u64 i_max_offset; /* largest readdir offset, set with D_COMPLETE */
|
2009-10-07 02:31:07 +08:00
|
|
|
|
|
|
|
struct rb_root i_fragtree;
|
|
|
|
struct mutex i_fragtree_mutex;
|
|
|
|
|
|
|
|
struct ceph_inode_xattrs_info i_xattrs;
|
|
|
|
|
|
|
|
/* capabilities. protected _both_ by i_lock and cap->session's
|
|
|
|
* s_mutex. */
|
|
|
|
struct rb_root i_caps; /* cap list */
|
|
|
|
struct ceph_cap *i_auth_cap; /* authoritative cap, if any */
|
|
|
|
unsigned i_dirty_caps, i_flushing_caps; /* mask of dirtied fields */
|
|
|
|
struct list_head i_dirty_item, i_flushing_item;
|
|
|
|
u64 i_cap_flush_seq;
|
|
|
|
/* we need to track cap writeback on a per-cap-bit basis, to allow
|
|
|
|
* overlapping, pipelined cap flushes to the mds. we can probably
|
|
|
|
* reduce the tid to 8 bits if we're concerned about inode size. */
|
|
|
|
u16 i_cap_flush_last_tid, i_cap_flush_tid[CEPH_CAP_BITS];
|
|
|
|
wait_queue_head_t i_cap_wq; /* threads waiting on a capability */
|
|
|
|
unsigned long i_hold_caps_min; /* jiffies */
|
|
|
|
unsigned long i_hold_caps_max; /* jiffies */
|
|
|
|
struct list_head i_cap_delay_list; /* for delayed cap release to mds */
|
|
|
|
int i_cap_exporting_mds; /* to handle cap migration between */
|
|
|
|
unsigned i_cap_exporting_mseq; /* mds's. */
|
|
|
|
unsigned i_cap_exporting_issued;
|
|
|
|
struct ceph_cap_reservation i_cap_migration_resv;
|
|
|
|
struct list_head i_cap_snaps; /* snapped state pending flush to mds */
|
2010-08-24 23:44:16 +08:00
|
|
|
struct ceph_snap_context *i_head_snapc; /* set if wr_buffer_head > 0 or
|
|
|
|
dirty|flushing caps */
|
2009-10-07 02:31:07 +08:00
|
|
|
unsigned i_snap_caps; /* cap bits for snapped files */
|
|
|
|
|
|
|
|
int i_nr_by_mode[CEPH_FILE_MODE_NUM]; /* open file counts */
|
|
|
|
|
|
|
|
u32 i_truncate_seq; /* last truncate to smaller size */
|
|
|
|
u64 i_truncate_size; /* and the size we last truncated down to */
|
|
|
|
int i_truncate_pending; /* still need to call vmtruncate */
|
|
|
|
|
|
|
|
u64 i_max_size; /* max file size authorized by mds */
|
|
|
|
u64 i_reported_size; /* (max_)size reported to or requested of mds */
|
|
|
|
u64 i_wanted_max_size; /* offset we'd like to write too */
|
|
|
|
u64 i_requested_max_size; /* max_size we've requested */
|
|
|
|
|
|
|
|
/* held references to caps */
|
|
|
|
int i_pin_ref;
|
2011-05-11 18:29:54 +08:00
|
|
|
int i_rd_ref, i_rdcache_ref, i_wr_ref, i_wb_ref;
|
2009-10-07 02:31:07 +08:00
|
|
|
int i_wrbuffer_ref, i_wrbuffer_ref_head;
|
|
|
|
u32 i_shared_gen; /* increment each time we get FILE_SHARED */
|
2010-11-05 02:05:05 +08:00
|
|
|
u32 i_rdcache_gen; /* incremented each time we get FILE_CACHE. */
|
2009-10-07 02:31:07 +08:00
|
|
|
u32 i_rdcache_revoking; /* RDCACHE gen to async invalidate, if any */
|
|
|
|
|
|
|
|
struct list_head i_unsafe_writes; /* uncommitted sync writes */
|
|
|
|
struct list_head i_unsafe_dirops; /* uncommitted mds dir ops */
|
|
|
|
spinlock_t i_unsafe_lock;
|
|
|
|
|
|
|
|
struct ceph_snap_realm *i_snap_realm; /* snap realm (if caps) */
|
|
|
|
int i_snap_realm_counter; /* snap realm (if caps) */
|
|
|
|
struct list_head i_snap_realm_item;
|
|
|
|
struct list_head i_snap_flush_item;
|
|
|
|
|
|
|
|
struct work_struct i_wb_work; /* writeback work */
|
|
|
|
struct work_struct i_pg_inv_work; /* page invalidation work */
|
|
|
|
|
|
|
|
struct work_struct i_vmtruncate_work;
|
|
|
|
|
|
|
|
struct inode vfs_inode; /* at end */
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct ceph_inode_info *ceph_inode(struct inode *inode)
|
|
|
|
{
|
2009-10-29 02:54:49 +08:00
|
|
|
return container_of(inode, struct ceph_inode_info, vfs_inode);
|
2009-10-07 02:31:07 +08:00
|
|
|
}
|
|
|
|
|
2011-01-22 08:44:03 +08:00
|
|
|
static inline struct ceph_fs_client *ceph_inode_to_client(struct inode *inode)
|
|
|
|
{
|
|
|
|
return (struct ceph_fs_client *)inode->i_sb->s_fs_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct ceph_fs_client *ceph_sb_to_client(struct super_block *sb)
|
|
|
|
{
|
|
|
|
return (struct ceph_fs_client *)sb->s_fs_info;
|
|
|
|
}
|
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
static inline struct ceph_vino ceph_vino(struct inode *inode)
|
|
|
|
{
|
|
|
|
return ceph_inode(inode)->i_vino;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ino_t is <64 bits on many architectures, blech.
|
|
|
|
*
|
2011-01-22 08:44:03 +08:00
|
|
|
* i_ino (kernel inode) st_ino (userspace)
|
|
|
|
* i386 32 32
|
|
|
|
* x86_64+ino32 64 32
|
|
|
|
* x86_64 64 64
|
|
|
|
*/
|
2011-10-21 04:04:07 +08:00
|
|
|
static inline u32 ceph_ino_to_ino32(__u64 vino)
|
2011-01-22 08:44:03 +08:00
|
|
|
{
|
2011-10-21 04:04:07 +08:00
|
|
|
u32 ino = vino & 0xffffffff;
|
|
|
|
ino ^= vino >> 32;
|
2011-01-22 08:44:03 +08:00
|
|
|
if (!ino)
|
|
|
|
ino = 1;
|
|
|
|
return ino;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* kernel i_ino value
|
2010-04-07 06:14:15 +08:00
|
|
|
*/
|
|
|
|
static inline ino_t ceph_vino_to_ino(struct ceph_vino vino)
|
|
|
|
{
|
|
|
|
#if BITS_PER_LONG == 32
|
2011-10-21 04:04:07 +08:00
|
|
|
return ceph_ino_to_ino32(vino.ino);
|
|
|
|
#else
|
|
|
|
return (ino_t)vino.ino;
|
2010-04-07 06:14:15 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-01-22 08:44:03 +08:00
|
|
|
/*
|
|
|
|
* user-visible ino (stat, filldir)
|
|
|
|
*/
|
|
|
|
#if BITS_PER_LONG == 32
|
|
|
|
static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino)
|
|
|
|
{
|
|
|
|
return ino;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino)
|
|
|
|
{
|
|
|
|
if (ceph_test_mount_opt(ceph_sb_to_client(sb), INO32))
|
|
|
|
ino = ceph_ino_to_ino32(ino);
|
|
|
|
return ino;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
/* for printf-style formatting */
|
|
|
|
#define ceph_vinop(i) ceph_inode(i)->i_vino.ino, ceph_inode(i)->i_vino.snap
|
|
|
|
|
|
|
|
static inline u64 ceph_ino(struct inode *inode)
|
|
|
|
{
|
|
|
|
return ceph_inode(inode)->i_vino.ino;
|
|
|
|
}
|
|
|
|
static inline u64 ceph_snap(struct inode *inode)
|
|
|
|
{
|
|
|
|
return ceph_inode(inode)->i_vino.snap;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int ceph_ino_compare(struct inode *inode, void *data)
|
|
|
|
{
|
|
|
|
struct ceph_vino *pvino = (struct ceph_vino *)data;
|
|
|
|
struct ceph_inode_info *ci = ceph_inode(inode);
|
|
|
|
return ci->i_vino.ino == pvino->ino &&
|
|
|
|
ci->i_vino.snap == pvino->snap;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct inode *ceph_find_inode(struct super_block *sb,
|
|
|
|
struct ceph_vino vino)
|
|
|
|
{
|
|
|
|
ino_t t = ceph_vino_to_ino(vino);
|
|
|
|
return ilookup5(sb, t, ceph_ino_compare, &vino);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ceph inode.
|
|
|
|
*/
|
|
|
|
#define CEPH_I_NODELAY 4 /* do not delay cap release */
|
|
|
|
#define CEPH_I_FLUSH 8 /* do not delay flush of dirty metadata */
|
|
|
|
#define CEPH_I_NOFLUSH 16 /* do not flush dirty caps */
|
|
|
|
|
2009-10-07 02:31:07 +08:00
|
|
|
static inline void ceph_i_clear(struct inode *inode, unsigned mask)
|
|
|
|
{
|
|
|
|
struct ceph_inode_info *ci = ceph_inode(inode);
|
|
|
|
|
|
|
|
spin_lock(&inode->i_lock);
|
|
|
|
ci->i_ceph_flags &= ~mask;
|
|
|
|
spin_unlock(&inode->i_lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ceph_i_set(struct inode *inode, unsigned mask)
|
|
|
|
{
|
|
|
|
struct ceph_inode_info *ci = ceph_inode(inode);
|
|
|
|
|
|
|
|
spin_lock(&inode->i_lock);
|
|
|
|
ci->i_ceph_flags |= mask;
|
|
|
|
spin_unlock(&inode->i_lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool ceph_i_test(struct inode *inode, unsigned mask)
|
|
|
|
{
|
|
|
|
struct ceph_inode_info *ci = ceph_inode(inode);
|
|
|
|
bool r;
|
|
|
|
|
2010-10-19 05:04:31 +08:00
|
|
|
spin_lock(&inode->i_lock);
|
2009-10-07 02:31:07 +08:00
|
|
|
r = (ci->i_ceph_flags & mask) == mask;
|
2010-10-19 05:04:31 +08:00
|
|
|
spin_unlock(&inode->i_lock);
|
2009-10-07 02:31:07 +08:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 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(struct dentry *dentry)
|
|
|
|
{
|
|
|
|
return (struct ceph_dentry_info *)dentry->d_fsdata;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline loff_t ceph_make_fpos(unsigned frag, unsigned off)
|
|
|
|
{
|
|
|
|
return ((loff_t)frag << 32) | (loff_t)off;
|
|
|
|
}
|
|
|
|
|
2011-11-04 00:23:36 +08:00
|
|
|
/*
|
|
|
|
* set/clear directory D_COMPLETE flag
|
|
|
|
*/
|
|
|
|
void ceph_dir_set_complete(struct inode *inode);
|
|
|
|
void ceph_dir_clear_complete(struct inode *inode);
|
|
|
|
bool ceph_dir_test_complete(struct inode *inode);
|
|
|
|
|
2009-10-07 02:31:07 +08:00
|
|
|
/*
|
|
|
|
* caps helpers
|
|
|
|
*/
|
|
|
|
static inline bool __ceph_is_any_real_caps(struct ceph_inode_info *ci)
|
|
|
|
{
|
|
|
|
return !RB_EMPTY_ROOT(&ci->i_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
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_other(struct ceph_inode_info *ci,
|
|
|
|
struct ceph_cap *cap);
|
|
|
|
|
|
|
|
static inline int ceph_caps_issued(struct ceph_inode_info *ci)
|
|
|
|
{
|
|
|
|
int issued;
|
|
|
|
spin_lock(&ci->vfs_inode.i_lock);
|
|
|
|
issued = __ceph_caps_issued(ci, NULL);
|
|
|
|
spin_unlock(&ci->vfs_inode.i_lock);
|
|
|
|
return issued;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask,
|
|
|
|
int touch)
|
|
|
|
{
|
|
|
|
int r;
|
|
|
|
spin_lock(&ci->vfs_inode.i_lock);
|
|
|
|
r = __ceph_caps_issued_mask(ci, mask, touch);
|
|
|
|
spin_unlock(&ci->vfs_inode.i_lock);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __ceph_caps_dirty(struct ceph_inode_info *ci)
|
|
|
|
{
|
|
|
|
return ci->i_dirty_caps | ci->i_flushing_caps;
|
|
|
|
}
|
2011-05-05 02:33:47 +08:00
|
|
|
extern int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask);
|
2009-10-07 02:31:07 +08:00
|
|
|
|
|
|
|
extern int ceph_caps_revoking(struct ceph_inode_info *ci, int mask);
|
|
|
|
extern int __ceph_caps_used(struct ceph_inode_info *ci);
|
|
|
|
|
|
|
|
extern int __ceph_caps_file_wanted(struct ceph_inode_info *ci);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* wanted, by virtue of open file modes AND cap refs (buffered/cached data)
|
|
|
|
*/
|
|
|
|
static inline int __ceph_caps_wanted(struct ceph_inode_info *ci)
|
|
|
|
{
|
|
|
|
int w = __ceph_caps_file_wanted(ci) | __ceph_caps_used(ci);
|
|
|
|
if (w & CEPH_CAP_FILE_BUFFER)
|
|
|
|
w |= CEPH_CAP_FILE_EXCL; /* we want EXCL if dirty data */
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* what the mds thinks we want */
|
|
|
|
extern int __ceph_caps_mds_wanted(struct ceph_inode_info *ci);
|
|
|
|
|
2010-06-18 07:16:12 +08:00
|
|
|
extern void ceph_caps_init(struct ceph_mds_client *mdsc);
|
|
|
|
extern void ceph_caps_finalize(struct ceph_mds_client *mdsc);
|
|
|
|
extern void ceph_adjust_min_caps(struct ceph_mds_client *mdsc, int delta);
|
|
|
|
extern int ceph_reserve_caps(struct ceph_mds_client *mdsc,
|
|
|
|
struct ceph_cap_reservation *ctx, int need);
|
|
|
|
extern int ceph_unreserve_caps(struct ceph_mds_client *mdsc,
|
|
|
|
struct ceph_cap_reservation *ctx);
|
2010-04-07 06:14:15 +08:00
|
|
|
extern void ceph_reservation_status(struct ceph_fs_client *client,
|
2009-10-07 02:31:07 +08:00
|
|
|
int *total, int *avail, int *used,
|
2010-02-18 02:02:43 +08:00
|
|
|
int *reserved, int *min);
|
2009-10-07 02:31:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* we keep buffered readdir results attached to file->private_data
|
|
|
|
*/
|
2011-07-27 02:26:07 +08:00
|
|
|
#define CEPH_F_SYNC 1
|
2011-07-27 02:26:18 +08:00
|
|
|
#define CEPH_F_ATEND 2
|
2011-07-27 02:26:07 +08:00
|
|
|
|
2009-10-07 02:31:07 +08:00
|
|
|
struct ceph_file_info {
|
2011-07-27 02:25:27 +08:00
|
|
|
short fmode; /* initialized on open */
|
|
|
|
short flags; /* CEPH_F_* */
|
2009-10-07 02:31:07 +08:00
|
|
|
|
|
|
|
/* readdir: position within the dir */
|
|
|
|
u32 frag;
|
|
|
|
struct ceph_mds_request *last_readdir;
|
|
|
|
|
|
|
|
/* readdir: position within a frag */
|
|
|
|
unsigned offset; /* offset of last chunk, adjusted for . and .. */
|
|
|
|
u64 next_offset; /* offset of next chunk (last_name's + 1) */
|
|
|
|
char *last_name; /* last entry in previous chunk */
|
|
|
|
struct dentry *dentry; /* next dentry (for dcache readdir) */
|
|
|
|
unsigned long dir_release_count;
|
|
|
|
|
|
|
|
/* used for -o dirstat read() on directory thing */
|
|
|
|
char *dir_info;
|
|
|
|
int dir_info_len;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 {
|
|
|
|
u64 ino;
|
|
|
|
atomic_t nref;
|
2010-02-16 06:37:55 +08:00
|
|
|
struct rb_node node;
|
|
|
|
|
2009-10-07 02:31:07 +08:00
|
|
|
u64 created, seq;
|
|
|
|
u64 parent_ino;
|
|
|
|
u64 parent_since; /* snapid when our current parent became so */
|
|
|
|
|
|
|
|
u64 *prior_parent_snaps; /* snaps inherited from any parents we */
|
|
|
|
int num_prior_parent_snaps; /* had prior to parent_since */
|
|
|
|
u64 *snaps; /* snaps specific to this realm */
|
|
|
|
int num_snaps;
|
|
|
|
|
|
|
|
struct ceph_snap_realm *parent;
|
|
|
|
struct list_head children; /* list of child realms */
|
|
|
|
struct list_head child_item;
|
|
|
|
|
|
|
|
struct list_head empty_item; /* if i have ref==0 */
|
|
|
|
|
2010-09-17 07:26:51 +08:00
|
|
|
struct list_head dirty_item; /* if realm needs new context */
|
|
|
|
|
2009-10-07 02:31:07 +08:00
|
|
|
/* the current set of snaps for this realm */
|
|
|
|
struct ceph_snap_context *cached_context;
|
|
|
|
|
|
|
|
struct list_head inodes_with_caps;
|
|
|
|
spinlock_t inodes_with_caps_lock;
|
|
|
|
};
|
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
static inline int default_congestion_kb(void)
|
2009-10-07 02:31:07 +08:00
|
|
|
{
|
2010-04-07 06:14:15 +08:00
|
|
|
int congestion_kb;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copied from NFS
|
|
|
|
*
|
|
|
|
* congestion size, scale with available memory.
|
|
|
|
*
|
|
|
|
* 64MB: 8192k
|
|
|
|
* 128MB: 11585k
|
|
|
|
* 256MB: 16384k
|
|
|
|
* 512MB: 23170k
|
|
|
|
* 1GB: 32768k
|
|
|
|
* 2GB: 46340k
|
|
|
|
* 4GB: 65536k
|
|
|
|
* 8GB: 92681k
|
|
|
|
* 16GB: 131072k
|
|
|
|
*
|
|
|
|
* This allows larger machines to have larger/more transfers.
|
|
|
|
* Limit the default to 256M
|
|
|
|
*/
|
|
|
|
congestion_kb = (16*int_sqrt(totalram_pages)) << (PAGE_SHIFT-10);
|
|
|
|
if (congestion_kb > 256*1024)
|
|
|
|
congestion_kb = 256*1024;
|
|
|
|
|
|
|
|
return congestion_kb;
|
2009-10-07 02:31:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
extern void ceph_handle_snap(struct ceph_mds_client *mdsc,
|
2010-02-23 07:12:16 +08:00
|
|
|
struct ceph_mds_session *session,
|
2009-10-07 02:31:07 +08:00
|
|
|
struct ceph_msg *msg);
|
2010-04-14 02:41:22 +08:00
|
|
|
extern void ceph_queue_cap_snap(struct ceph_inode_info *ci);
|
2009-10-07 02:31:07 +08:00
|
|
|
extern int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
|
|
|
|
struct ceph_cap_snap *capsnap);
|
|
|
|
extern void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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)
|
|
|
|
{
|
|
|
|
return !list_empty(&ci->i_cap_snaps) &&
|
|
|
|
list_entry(ci->i_cap_snaps.prev, struct ceph_cap_snap,
|
|
|
|
ci_item)->writing;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* inode.c */
|
|
|
|
extern const struct inode_operations ceph_file_iops;
|
|
|
|
|
|
|
|
extern struct inode *ceph_alloc_inode(struct super_block *sb);
|
|
|
|
extern void ceph_destroy_inode(struct inode *inode);
|
|
|
|
|
|
|
|
extern struct inode *ceph_get_inode(struct super_block *sb,
|
|
|
|
struct ceph_vino vino);
|
|
|
|
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 timespec *ctime,
|
|
|
|
struct timespec *mtime, struct timespec *atime);
|
|
|
|
extern int ceph_fill_trace(struct super_block *sb,
|
|
|
|
struct ceph_mds_request *req,
|
|
|
|
struct ceph_mds_session *session);
|
|
|
|
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 int ceph_inode_set_size(struct inode *inode, loff_t size);
|
|
|
|
extern void __ceph_do_pending_vmtruncate(struct inode *inode);
|
2010-02-10 07:24:44 +08:00
|
|
|
extern void ceph_queue_vmtruncate(struct inode *inode);
|
|
|
|
|
|
|
|
extern void ceph_queue_invalidate(struct inode *inode);
|
|
|
|
extern void ceph_queue_writeback(struct inode *inode);
|
2009-10-07 02:31:07 +08:00
|
|
|
|
|
|
|
extern int ceph_do_getattr(struct inode *inode, int mask);
|
2011-06-21 07:28:19 +08:00
|
|
|
extern int ceph_permission(struct inode *inode, int mask);
|
2009-10-07 02:31:07 +08:00
|
|
|
extern int ceph_setattr(struct dentry *dentry, struct iattr *attr);
|
|
|
|
extern int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry,
|
|
|
|
struct kstat *stat);
|
|
|
|
|
|
|
|
/* xattr.c */
|
|
|
|
extern int ceph_setxattr(struct dentry *, const char *, const void *,
|
|
|
|
size_t, int);
|
|
|
|
extern ssize_t ceph_getxattr(struct dentry *, const char *, void *, size_t);
|
|
|
|
extern ssize_t ceph_listxattr(struct dentry *, char *, size_t);
|
|
|
|
extern int ceph_removexattr(struct dentry *, const char *);
|
|
|
|
extern void __ceph_build_xattrs_blob(struct ceph_inode_info *ci);
|
|
|
|
extern void __ceph_destroy_xattrs(struct ceph_inode_info *ci);
|
|
|
|
|
|
|
|
/* 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 int ceph_add_cap(struct inode *inode,
|
|
|
|
struct ceph_mds_session *session, u64 cap_id,
|
|
|
|
int fmode, unsigned issued, unsigned wanted,
|
|
|
|
unsigned cap, unsigned seq, u64 realmino, int flags,
|
|
|
|
struct ceph_cap_reservation *caps_reservation);
|
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-17 03:39:45 +08:00
|
|
|
extern void __ceph_remove_cap(struct ceph_cap *cap);
|
2009-10-07 02:31:07 +08:00
|
|
|
static inline void ceph_remove_cap(struct ceph_cap *cap)
|
|
|
|
{
|
|
|
|
struct inode *inode = &cap->ci->vfs_inode;
|
|
|
|
spin_lock(&inode->i_lock);
|
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-17 03:39:45 +08:00
|
|
|
__ceph_remove_cap(cap);
|
2009-10-07 02:31:07 +08:00
|
|
|
spin_unlock(&inode->i_lock);
|
|
|
|
}
|
2010-06-18 07:16:12 +08:00
|
|
|
extern void ceph_put_cap(struct ceph_mds_client *mdsc,
|
|
|
|
struct ceph_cap *cap);
|
2009-10-07 02:31:07 +08:00
|
|
|
|
|
|
|
extern void ceph_queue_caps_release(struct inode *inode);
|
2010-01-18 08:53:08 +08:00
|
|
|
extern int ceph_write_inode(struct inode *inode, struct writeback_control *wbc);
|
2011-07-17 08:44:56 +08:00
|
|
|
extern int ceph_fsync(struct file *file, loff_t start, loff_t end,
|
|
|
|
int datasync);
|
2009-10-07 02:31:07 +08:00
|
|
|
extern void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc,
|
|
|
|
struct ceph_mds_session *session);
|
2010-07-01 03:44:34 +08:00
|
|
|
extern struct ceph_cap *ceph_get_cap_for_mds(struct ceph_inode_info *ci,
|
|
|
|
int mds);
|
2009-10-07 02:31:07 +08:00
|
|
|
extern int ceph_get_cap_mds(struct inode *inode);
|
|
|
|
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_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
|
|
|
|
struct ceph_snap_context *snapc);
|
|
|
|
extern void __ceph_flush_snaps(struct ceph_inode_info *ci,
|
2010-09-17 23:03:08 +08:00
|
|
|
struct ceph_mds_session **psession,
|
|
|
|
int again);
|
2009-10-07 02:31:07 +08:00
|
|
|
extern void ceph_check_caps(struct ceph_inode_info *ci, int flags,
|
|
|
|
struct ceph_mds_session *session);
|
2009-10-15 05:27:38 +08:00
|
|
|
extern void ceph_check_delayed_caps(struct ceph_mds_client *mdsc);
|
|
|
|
extern void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc);
|
2009-10-07 02:31:07 +08:00
|
|
|
|
|
|
|
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,
|
|
|
|
int mds, int drop, int unless);
|
|
|
|
|
|
|
|
extern int ceph_get_caps(struct ceph_inode_info *ci, int need, int want,
|
|
|
|
int *got, loff_t endoff);
|
|
|
|
|
|
|
|
/* for counting open files by mode */
|
|
|
|
static inline void __ceph_get_fmode(struct ceph_inode_info *ci, int mode)
|
|
|
|
{
|
|
|
|
ci->i_nr_by_mode[mode]++;
|
|
|
|
}
|
|
|
|
extern void ceph_put_fmode(struct ceph_inode_info *ci, int mode);
|
|
|
|
|
|
|
|
/* addr.c */
|
|
|
|
extern const struct address_space_operations ceph_aops;
|
|
|
|
extern int ceph_mmap(struct file *file, struct vm_area_struct *vma);
|
|
|
|
|
|
|
|
/* file.c */
|
|
|
|
extern const struct file_operations ceph_file_fops;
|
|
|
|
extern const struct address_space_operations ceph_aops;
|
2010-04-07 06:14:15 +08:00
|
|
|
extern int ceph_copy_to_page_vector(struct page **pages,
|
|
|
|
const char *data,
|
|
|
|
loff_t off, size_t len);
|
|
|
|
extern int ceph_copy_from_page_vector(struct page **pages,
|
|
|
|
char *data,
|
|
|
|
loff_t off, size_t len);
|
|
|
|
extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
|
2009-10-07 02:31:07 +08:00
|
|
|
extern int ceph_open(struct inode *inode, struct file *file);
|
|
|
|
extern struct dentry *ceph_lookup_open(struct inode *dir, struct dentry *dentry,
|
|
|
|
struct nameidata *nd, int mode,
|
|
|
|
int locked_dir);
|
|
|
|
extern int ceph_release(struct inode *inode, struct file *filp);
|
|
|
|
|
|
|
|
/* dir.c */
|
|
|
|
extern const struct file_operations ceph_dir_fops;
|
|
|
|
extern const struct inode_operations ceph_dir_iops;
|
2010-08-04 01:25:30 +08:00
|
|
|
extern const struct dentry_operations ceph_dentry_ops, ceph_snap_dentry_ops,
|
2009-10-07 02:31:07 +08:00
|
|
|
ceph_snapdir_dentry_ops;
|
|
|
|
|
|
|
|
extern int ceph_handle_notrace_create(struct inode *dir, struct dentry *dentry);
|
2011-07-27 02:28:11 +08:00
|
|
|
extern int ceph_handle_snapdir(struct ceph_mds_request *req,
|
|
|
|
struct dentry *dentry, int err);
|
2009-10-07 02:31:07 +08:00
|
|
|
extern struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
|
|
|
|
struct dentry *dentry, int err);
|
|
|
|
|
|
|
|
extern void ceph_dentry_lru_add(struct dentry *dn);
|
|
|
|
extern void ceph_dentry_lru_touch(struct dentry *dn);
|
|
|
|
extern void ceph_dentry_lru_del(struct dentry *dn);
|
2010-05-15 00:35:38 +08:00
|
|
|
extern void ceph_invalidate_dentry_lease(struct dentry *dentry);
|
2011-07-27 02:30:55 +08:00
|
|
|
extern unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn);
|
2011-07-27 02:30:29 +08:00
|
|
|
extern struct inode *ceph_get_dentry_parent_inode(struct dentry *dentry);
|
2009-10-07 02:31:07 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* our d_ops vary depending on whether the inode is live,
|
|
|
|
* snapshotted (read-only), or a virtual ".snap" directory.
|
|
|
|
*/
|
|
|
|
int ceph_init_dentry(struct dentry *dentry);
|
|
|
|
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
2010-08-03 06:34:23 +08:00
|
|
|
/* locks.c */
|
|
|
|
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(struct inode *i, struct ceph_pagelist *p,
|
|
|
|
int p_locks, int f_locks);
|
|
|
|
extern int lock_to_ceph_filelock(struct file_lock *fl, struct ceph_filelock *c);
|
|
|
|
|
2010-04-07 06:14:15 +08:00
|
|
|
/* debugfs.c */
|
|
|
|
extern int ceph_fs_debugfs_init(struct ceph_fs_client *client);
|
|
|
|
extern void ceph_fs_debugfs_cleanup(struct ceph_fs_client *client);
|
|
|
|
|
2009-10-07 02:31:07 +08:00
|
|
|
#endif /* _FS_CEPH_SUPER_H */
|