@@ -676,7 +676,8 @@ struct ll_sb_info {
unsigned int ll_xattr_cache_enabled:1,
ll_xattr_cache_set:1, /* already set to 0/1 */
ll_client_common_fill_super_succeeded:1,
- ll_checksum_set:1;
+ ll_checksum_set:1,
+ ll_inode_cache_enabled:1;
struct lustre_client_ocd ll_lco;
@@ -445,6 +445,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
sb->s_blocksize_bits = log2(osfs->os_bsize);
sb->s_magic = LL_SUPER_MAGIC;
sb->s_maxbytes = MAX_LFS_FILESIZE;
+ sbi->ll_inode_cache_enabled = 1;
sbi->ll_namelen = osfs->os_namelen;
sbi->ll_mnt.mnt = current->fs->root.mnt;
sbi->ll_mnt_ns = current->nsproxy->mnt_ns;
@@ -1480,6 +1480,36 @@ static ssize_t opencache_max_ms_store(struct kobject *kobj,
}
LUSTRE_RW_ATTR(opencache_max_ms);
+static ssize_t inode_cache_show(struct kobject *kobj,
+ struct attribute *attr,
+ char *buf)
+{
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
+
+ return snprintf(buf, PAGE_SIZE, "%u\n", sbi->ll_inode_cache_enabled);
+}
+
+static ssize_t inode_cache_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer,
+ size_t count)
+{
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
+ bool val;
+ int rc;
+
+ rc = kstrtobool(buffer, &val);
+ if (rc)
+ return rc;
+
+ sbi->ll_inode_cache_enabled = val;
+
+ return count;
+}
+LUSTRE_RW_ATTR(inode_cache);
+
static int ll_unstable_stats_seq_show(struct seq_file *m, void *v)
{
struct super_block *sb = m->private;
@@ -1704,6 +1734,7 @@ struct ldebugfs_vars lprocfs_llite_obd_vars[] = {
&lustre_attr_opencache_threshold_count.attr,
&lustre_attr_opencache_threshold_ms.attr,
&lustre_attr_opencache_max_ms.attr,
+ &lustre_attr_inode_cache.attr,
NULL,
};
@@ -74,8 +74,13 @@ static void ll_destroy_inode(struct inode *inode)
static int ll_drop_inode(struct inode *inode)
{
- int drop = generic_drop_inode(inode);
+ struct ll_sb_info *sbi = ll_i2sbi(inode);
+ int drop;
+ if (!sbi->ll_inode_cache_enabled)
+ return 1;
+
+ drop = generic_drop_inode(inode);
if (!drop)
drop = fscrypt_drop_inode(inode);