From 81bfddd2f7a0ebbdbc86daae2fae17ed0777e924 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 14 Oct 2008 16:18:24 -0700 Subject: [PATCH] kclient: remove static caps from inode 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. --- src/TODO | 3 --- src/kernel/caps.c | 10 +--------- src/kernel/super.c | 2 -- src/kernel/super.h | 5 +---- 4 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/TODO b/src/TODO index 45ff54fab180a..99d53edd7bb26 100644 --- a/src/TODO +++ b/src/TODO @@ -1,6 +1,3 @@ -kclient -- rip out STATIC_CAPS - v0.5 - debug restart, cosd reformat, etc. - finish btrfs ioctl interface diff --git a/src/kernel/caps.c b/src/kernel/caps.c index 1f61255fe1627..8069a387531ce 100644 --- a/src/kernel/caps.c +++ b/src/kernel/caps.c @@ -114,11 +114,6 @@ retry: 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; @@ -223,11 +218,8 @@ int __ceph_remove_cap(struct ceph_cap *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); diff --git a/src/kernel/super.c b/src/kernel/super.c index 0eff5213e15ef..5dd4e581cf2da 100644 --- a/src/kernel/super.c +++ b/src/kernel/super.c @@ -183,8 +183,6 @@ static struct inode *ceph_alloc_inode(struct super_block *sb) 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); diff --git a/src/kernel/super.h b/src/kernel/super.h index 75efa1299eb6e..46bd419c86658 100644 --- a/src/kernel/super.h +++ b/src/kernel/super.h @@ -175,14 +175,12 @@ static inline struct ceph_client *ceph_client(struct super_block *sb) * 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; @@ -262,7 +260,6 @@ struct ceph_inode_info { /* 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 */ -- 2.39.5