Since most inodes will never have a capability, there is no point in embedding them
in the ceph_inode_info and paying the memory overhead in the general case.
-kclient
-- rip out STATIC_CAPS
-
v0.5
- debug restart, cosd reformat, etc.
- finish btrfs ioctl interface
spin_lock(&inode->i_lock);
cap = __get_cap_for_mds(inode, mds);
if (!cap) {
- for (i = 0; i < STATIC_CAPS; i++)
- if (ci->i_static_caps[i].mds == -1) {
- cap = &ci->i_static_caps[i];
- break;
- }
if (!cap) {
if (new_cap) {
cap = new_cap;
/* remove from inode list */
rb_erase(&cap->ci_node, &ci->i_caps);
cap->session = 0;
- cap->mds = -1; /* mark unused */
- if (cap < ci->i_static_caps ||
- cap >= ci->i_static_caps + STATIC_CAPS)
- kfree(cap);
+ kfree(cap);
if (RB_EMPTY_ROOT(&ci->i_caps)) {
list_del_init(&ci->i_snap_realm_item);
ci->i_xattr_data = 0;
ci->i_caps = RB_ROOT;
- for (i = 0; i < STATIC_CAPS; i++)
- ci->i_static_caps[i].mds = -1;
for (i = 0; i < CEPH_FILE_MODE_NUM; i++)
ci->i_nr_by_mode[i] = 0;
init_waitqueue_head(&ci->i_cap_wq);
* Each cap is referenced by the inode's i_caps tree and by a per-mds
* session capability list.
*/
-#define STATIC_CAPS 1 /* how many to embed in each inode? */
-
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; /* must be -1 if not in use */
+ int mds;
int issued; /* latest, from the mds */
int implemented; /* what we've implemented (for tracking revocation) */
u32 seq, mseq, gen;
/* capabilities */
struct rb_root i_caps; /* cap list */
- struct ceph_cap i_static_caps[STATIC_CAPS];
wait_queue_head_t i_cap_wq; /* threads waiting on a capability */
unsigned long i_hold_caps_until; /* jiffies */
struct list_head i_cap_delay_list; /* for delayed cap release to mds */