return ret;
}
+int __ceph_caps_used(struct ceph_inode_info *ci)
+{
+ int used = 0;
+ if (ci->i_pin_ref)
+ used |= CEPH_CAP_PIN;
+ if (ci->i_rd_ref)
+ used |= CEPH_CAP_FILE_RD;
+ if (ci->i_rdcache_ref || ci->i_rdcache_gen)
+ used |= CEPH_CAP_FILE_CACHE;
+ if (ci->i_wr_ref)
+ used |= CEPH_CAP_FILE_WR;
+ if (ci->i_wrbuffer_ref)
+ used |= CEPH_CAP_FILE_BUFFER;
+ return used;
+}
+
+/*
+ * wanted, by virtue of open file modes
+ */
+int __ceph_caps_file_wanted(struct ceph_inode_info *ci)
+{
+ int want = 0;
+ int mode;
+ for (mode = 0; mode < 4; mode++)
+ if (ci->i_nr_by_mode[mode])
+ want |= ceph_caps_for_mode(mode);
+ return want;
+}
+
/*
* Return caps we have registered with the MDS(s) as 'wanted'.
*/
const struct file_operations ceph_dir_fops;
struct dentry_operations ceph_dentry_ops;
+/*
+ * Initialize ceph dentry state.
+ */
+int ceph_init_dentry(struct dentry *dentry)
+{
+ struct ceph_dentry_info *di;
+
+ if (dentry->d_fsdata)
+ return 0;
+
+ if (ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP)
+ dentry->d_op = &ceph_dentry_ops;
+ else if (ceph_snap(dentry->d_parent->d_inode) == CEPH_SNAPDIR)
+ dentry->d_op = &ceph_snapdir_dentry_ops;
+ else
+ dentry->d_op = &ceph_snap_dentry_ops;
+
+ di = kmem_cache_alloc(ceph_dentry_cachep, GFP_NOFS);
+ if (!di)
+ return -ENOMEM; /* oh well */
+
+ spin_lock(&dentry->d_lock);
+ if (dentry->d_fsdata) /* lost a race */
+ goto out_unlock;
+ di->dentry = dentry;
+ di->lease_session = NULL;
+ dentry->d_fsdata = di;
+ dentry->d_time = jiffies;
+ ceph_dentry_lru_add(dentry);
+out_unlock:
+ spin_unlock(&dentry->d_lock);
+ return 0;
+}
+
+
+
/*
* for readdir, we encode the directory frag and offset within that
* frag into f_pos.
return err;
}
-/*
- * Initialize ceph dentry state.
- */
-int ceph_init_dentry_private(struct dentry *dentry)
-{
- struct ceph_dentry_info *di;
-
- if (dentry->d_fsdata)
- return 0;
- di = kmem_cache_alloc(ceph_dentry_cachep, GFP_NOFS);
- if (!di)
- return -ENOMEM; /* oh well */
-
- spin_lock(&dentry->d_lock);
- if (dentry->d_fsdata) /* lost a race */
- goto out_unlock;
- di->dentry = dentry;
- di->lease_session = NULL;
- dentry->d_fsdata = di;
- dentry->d_time = jiffies;
- ceph_dentry_lru_add(dentry);
-out_unlock:
- spin_unlock(&dentry->d_lock);
- return 0;
-}
-
/*
* caller should hold session s_mutex.
*/
static void con_work(struct work_struct *);
static void ceph_fault(struct ceph_connection *con);
+const char *ceph_name_type_str(int t)
+{
+ switch (t) {
+ case CEPH_ENTITY_TYPE_MON: return "mon";
+ case CEPH_ENTITY_TYPE_MDS: return "mds";
+ case CEPH_ENTITY_TYPE_OSD: return "osd";
+ case CEPH_ENTITY_TYPE_CLIENT: return "client";
+ case CEPH_ENTITY_TYPE_ADMIN: return "admin";
+ default: return "???";
+ }
+}
/*
* work queue for all reading and writing to/from the socket.
int want);
};
-static inline const char *ceph_name_type_str(int t)
-{
- switch (t) {
- case CEPH_ENTITY_TYPE_MON: return "mon";
- case CEPH_ENTITY_TYPE_MDS: return "mds";
- case CEPH_ENTITY_TYPE_OSD: return "osd";
- case CEPH_ENTITY_TYPE_CLIENT: return "client";
- case CEPH_ENTITY_TYPE_ADMIN: return "admin";
- default: return "???";
- }
-}
+extern const char *ceph_name_type_str(int t);
/* use format string %s%d */
#define ENTITY_NAME(n) ceph_name_type_str((n).type), le64_to_cpu((n).num)
extern int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, 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 int __ceph_caps_used(struct ceph_inode_info *ci)
-{
- int used = 0;
- if (ci->i_pin_ref)
- used |= CEPH_CAP_PIN;
- if (ci->i_rd_ref)
- used |= CEPH_CAP_FILE_RD;
- if (ci->i_rdcache_ref || ci->i_rdcache_gen)
- used |= CEPH_CAP_FILE_CACHE;
- if (ci->i_wr_ref)
- used |= CEPH_CAP_FILE_WR;
- if (ci->i_wrbuffer_ref)
- used |= CEPH_CAP_FILE_BUFFER;
- return used;
-}
-
-/*
- * wanted, by virtue of open file modes
- */
-static inline int __ceph_caps_file_wanted(struct ceph_inode_info *ci)
-{
- int want = 0;
- int mode;
- for (mode = 0; mode < 4; mode++)
- if (ci->i_nr_by_mode[mode])
- want |= ceph_caps_for_mode(mode);
- return want;
-}
+extern int __ceph_caps_file_wanted(struct ceph_inode_info *ci);
/*
* wanted, by virtue of open file modes AND cap refs (buffered/cached data)
* our d_ops vary depending on whether the inode is live,
* snapshotted (read-only), or a virtual ".snap" directory.
*/
-int ceph_init_dentry_private(struct dentry *dentry);
-
-static inline int ceph_init_dentry(struct dentry *dentry)
-{
- int ret;
+int ceph_init_dentry(struct dentry *dentry);
- if (ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP)
- dentry->d_op = &ceph_dentry_ops;
- else if (ceph_snap(dentry->d_parent->d_inode) == CEPH_SNAPDIR)
- dentry->d_op = &ceph_snapdir_dentry_ops;
- else
- dentry->d_op = &ceph_snap_dentry_ops;
-
- ret = ceph_init_dentry_private(dentry);
-
- return ret;
-}
/* ioctl.c */
extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg);