Skip to contentSkip to conversation

Remove deprecated inode cache feature

PATCH In review Nikolay Borisov 2 participants 8 messages Nov 26, 2020 – Nov 27, 2020 Btrfs file system

lore
Share & tools
lore
#0 lore raw

cover Remove deprecated inode cache feature

This patchset removes inode cache feature which has been deprecated since kernel v5.9 release. First 2 patches move code around and replace calls of functions which are to be removed. Patch 3 finally removes inode cache for good.

I tested this under xfstest and didn't observe any new regressions.

Nikolay Borisov (3):
btrfs: Move btrfs_find_highest_objectid/btrfs_find_free_objectid to
disk-io.c
btrfs: Replace calls to btrfs_find_free_ino with
btrfs_find_free_objectid
btrfs: Remove inode cache feature

 fs/btrfs/Makefile           |   2 +-
 fs/btrfs/ctree.h            |  15 +-
 fs/btrfs/disk-io.c          |  78 +++--
 fs/btrfs/disk-io.h          |   2 +
 fs/btrfs/free-space-cache.c | 177 -----------
 fs/btrfs/free-space-cache.h |   6 -
 fs/btrfs/inode-map.c        | 582 ------------------------------------
 fs/btrfs/inode-map.h        |  16 -
 fs/btrfs/inode.c            |  23 +-
 fs/btrfs/ioctl.c            |   1 -
 fs/btrfs/relocation.c       |   1 -
 fs/btrfs/super.c            |   8 -
 fs/btrfs/transaction.c      |  19 --
 fs/btrfs/tree-log.c         |   1 -
 14 files changed, 66 insertions(+), 865 deletions(-)
 delete mode 100644 fs/btrfs/inode-map.c
 delete mode 100644 fs/btrfs/inode-map.h

--
2.25.1

#1 lore raw

PATCH 1/3 btrfs: Move btrfs_find_highest_objectid/btrfs_find_free_objectid to disk-io.c

Those functions are going to be used even after inode cache is removed so moved them to a more appropriate place.

---
 fs/btrfs/disk-io.c   | 55 ++++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/disk-io.h   |  2 ++
 fs/btrfs/inode-map.c | 55 --------------------------------------------
 fs/btrfs/inode-map.h |  2 --
 4 files changed, 57 insertions(+), 57 deletions(-)
fs/btrfs/disk-io.c +55 -0
index 4940c93c3c93..f97ed0dc179d 100644
@@ -4698,3 +4698,58 @@ static int btrfs_cleanup_transaction(struct btrfs_fs_info *fs_info)
 
 	return 0;
 }
+
+int btrfs_find_highest_objectid(struct btrfs_root *root, u64 *objectid)
+{
+	struct btrfs_path *path;
+	int ret;
+	struct extent_buffer *l;
+	struct btrfs_key search_key;
+	struct btrfs_key found_key;
+	int slot;
+
+	path = btrfs_alloc_path();
+	if (!path)
+		return -ENOMEM;
+
+	search_key.objectid = BTRFS_LAST_FREE_OBJECTID;
+	search_key.type = -1;
+	search_key.offset = (u64)-1;
+	ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0);
+	if (ret < 0)
+		goto error;
+	BUG_ON(ret == 0); /* Corruption */
+	if (path->slots[0] > 0) {
+		slot = path->slots[0] - 1;
+		l = path->nodes[0];
+		btrfs_item_key_to_cpu(l, &found_key, slot);
+		*objectid = max_t(u64, found_key.objectid,
+				  BTRFS_FIRST_FREE_OBJECTID - 1);
+	} else {
+		*objectid = BTRFS_FIRST_FREE_OBJECTID - 1;
+	}
+	ret = 0;
+error:
+	btrfs_free_path(path);
+	return ret;
+}
+
+int btrfs_find_free_objectid(struct btrfs_root *root, u64 *objectid)
+{
+	int ret;
+	mutex_lock(&root->objectid_mutex);
+
+	if (unlikely(root->highest_objectid >= BTRFS_LAST_FREE_OBJECTID)) {
+		btrfs_warn(root->fs_info,
+			   "the objectid of root %llu reaches its highest value",
+			   root->root_key.objectid);
+		ret = -ENOSPC;
+		goto out;
+	}
+
+	*objectid = ++root->highest_objectid;
+	ret = 0;
+out:
+	mutex_unlock(&root->objectid_mutex);
+	return ret;
+}
fs/btrfs/disk-io.h +2 -0
index 40e81d6e481e..984410144a97 100644
@@ -131,6 +131,8 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
 int btree_lock_page_hook(struct page *page, void *data,
 				void (*flush_fn)(void *));
 int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags);
+int btrfs_find_free_objectid(struct btrfs_root *root, u64 *objectid);
+int btrfs_find_highest_objectid(struct btrfs_root *root, u64 *objectid);
 int __init btrfs_end_io_wq_init(void);
 void __cold btrfs_end_io_wq_exit(void);
 
fs/btrfs/inode-map.c +0 -55

58 lines not on this page · raw message

fs/btrfs/inode-map.h +0 -2
index 7a962811dffe..5f6d8b3c65c2 100644
@@ -10,7 +10,5 @@ int btrfs_find_free_ino(struct btrfs_root *root, u64 *objectid);
 int btrfs_save_ino_cache(struct btrfs_root *root,
 			 struct btrfs_trans_handle *trans);
 
-int btrfs_find_free_objectid(struct btrfs_root *root, u64 *objectid);
-int btrfs_find_highest_objectid(struct btrfs_root *root, u64 *objectid);
 
 #endif
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/3 btrfs: Replace calls to btrfs_find_free_ino with btrfs_find_free_objectid

In reply to Nikolay Borisov

The former is going away as part of the inode map removal so switch callers to btrfs_find_free_objectid. No functional changes since with INODE_MAP disabled (default) find_free_objectid was called anyway.

---
 fs/btrfs/inode.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
fs/btrfs/inode.c +6 -6
index 748fb21e8180..70d964170497 100644
@@ -6349,7 +6349,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
 	if (IS_ERR(trans))
 		return PTR_ERR(trans);
 
-	err = btrfs_find_free_ino(root, &objectid);
+	err = btrfs_find_free_objectid(root, &objectid);
 	if (err)
 		goto out_unlock;
 
@@ -6413,7 +6413,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
 	if (IS_ERR(trans))
 		return PTR_ERR(trans);
 
-	err = btrfs_find_free_ino(root, &objectid);
+	err = btrfs_find_free_objectid(root, &objectid);
 	if (err)
 		goto out_unlock;
 
@@ -6557,7 +6557,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 	if (IS_ERR(trans))
 		return PTR_ERR(trans);
 
-	err = btrfs_find_free_ino(root, &objectid);
+	err = btrfs_find_free_objectid(root, &objectid);
 	if (err)
 		goto out_fail;
 
@@ -9057,7 +9057,7 @@ static int btrfs_whiteout_for_rename(struct btrfs_trans_handle *trans,
 	u64 objectid;
 	u64 index;
 
-	ret = btrfs_find_free_ino(root, &objectid);
+	ret = btrfs_find_free_objectid(root, &objectid);
 	if (ret)
 		return ret;
 
@@ -9520,7 +9520,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
 	if (IS_ERR(trans))
 		return PTR_ERR(trans);
 
-	err = btrfs_find_free_ino(root, &objectid);
+	err = btrfs_find_free_objectid(root, &objectid);
 	if (err)
 		goto out_unlock;
 
@@ -9854,7 +9854,7 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
 	if (IS_ERR(trans))
 		return PTR_ERR(trans);
 
-	ret = btrfs_find_free_ino(root, &objectid);
+	ret = btrfs_find_free_objectid(root, &objectid);
 	if (ret)
 		goto out;
 
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/3 btrfs: Remove inode cache feature

In reply to Nikolay Borisov

It's been deprecated and never really used so simply remove it.

---
 fs/btrfs/Makefile           |   2 +-
 fs/btrfs/ctree.h            |  15 +-
 fs/btrfs/disk-io.c          |  23 --
 fs/btrfs/free-space-cache.c | 177 ------------
 fs/btrfs/free-space-cache.h |   6 -
 fs/btrfs/inode-map.c        | 527 ------------------------------------
 fs/btrfs/inode-map.h        |  14 -
 fs/btrfs/inode.c            |  11 -
 fs/btrfs/ioctl.c            |   1 -
 fs/btrfs/relocation.c       |   1 -
 fs/btrfs/super.c            |   8 -
 fs/btrfs/transaction.c      |  19 --
 fs/btrfs/tree-log.c         |   1 -
 13 files changed, 3 insertions(+), 802 deletions(-)
 delete mode 100644 fs/btrfs/inode-map.c
 delete mode 100644 fs/btrfs/inode-map.h
fs/btrfs/Makefile +1 -1
index e738f6206ea5..b8290e0f62e2 100644
@@ -3,7 +3,7 @@
 obj-$(CONFIG_BTRFS_FS) := btrfs.o
 
 btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
-	   file-item.o inode-item.o inode-map.o disk-io.o \
+	   file-item.o inode-item.o disk-io.o \
 	   transaction.o inode.o file.o tree-defrag.o \
 	   extent_map.o sysfs.o struct-funcs.o xattr.o ordered-data.o \
 	   extent_io.o volumes.o async-thread.o ioctl.o locking.o orphan.o \
fs/btrfs/ctree.h +2 -13
index 9a186b2433ac..5e2eeadedbe5 100644
@@ -1066,15 +1066,6 @@ struct btrfs_root {
 	spinlock_t accounting_lock;
 	struct btrfs_block_rsv *block_rsv;
 
-	/* free ino cache stuff */
-	struct btrfs_free_space_ctl *free_ino_ctl;
-	enum btrfs_caching_type ino_cache_state;
-	spinlock_t ino_cache_lock;
-	wait_queue_head_t ino_cache_wait;
-	struct btrfs_free_space_ctl *free_ino_pinned;
-	u64 ino_cache_progress;
-	struct inode *ino_cache_inode;
-
 	struct mutex log_mutex;
 	wait_queue_head_t log_writer_wait;
 	wait_queue_head_t log_commit_wait[2];
@@ -1348,7 +1339,7 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_fs_info *info)
 #define BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED (1 << 14)
 #define BTRFS_MOUNT_ENOSPC_DEBUG	 (1 << 15)
 #define BTRFS_MOUNT_AUTO_DEFRAG		(1 << 16)
-#define BTRFS_MOUNT_INODE_MAP_CACHE	(1 << 17)
+/* bit 17 is free */
 #define BTRFS_MOUNT_USEBACKUPROOT	(1 << 18)
 #define BTRFS_MOUNT_SKIP_BALANCE	(1 << 19)
 #define BTRFS_MOUNT_CHECK_INTEGRITY	(1 << 20)
@@ -1395,9 +1386,7 @@ do {									\
  * transaction commit)
  */
 
-#define BTRFS_PENDING_SET_INODE_MAP_CACHE	(0)
-#define BTRFS_PENDING_CLEAR_INODE_MAP_CACHE	(1)
-#define BTRFS_PENDING_COMMIT			(2)
+#define BTRFS_PENDING_COMMIT			(0)
 
 #define btrfs_test_pending(info, opt)	\
 	test_bit(BTRFS_PENDING_##opt, &(info)->pending_changes)
fs/btrfs/disk-io.c +0 -23
index f97ed0dc179d..6d8cd9fef1ea 100644
@@ -29,7 +29,6 @@
 #include "tree-log.h"
 #include "free-space-cache.h"
 #include "free-space-tree.h"
-#include "inode-map.h"
 #include "check-integrity.h"
 #include "rcu-string.h"
 #include "dev-replace.h"
@@ -1335,14 +1334,6 @@ static int btrfs_init_fs_root(struct btrfs_root *root, dev_t anon_dev)
 	int ret;
 	unsigned int nofs_flag;
 
-	root->free_ino_ctl = kzalloc(sizeof(*root->free_ino_ctl), GFP_NOFS);
-	root->free_ino_pinned = kzalloc(sizeof(*root->free_ino_pinned),
-					GFP_NOFS);
-	if (!root->free_ino_pinned || !root->free_ino_ctl) {
-		ret = -ENOMEM;
-		goto fail;
-	}
-
 	/*
 	 * We might be called under a transaction (e.g. indirect backref
 	 * resolution) which could deadlock if it triggers memory reclaim
@@ -1359,10 +1350,6 @@ static int btrfs_init_fs_root(struct btrfs_root *root, dev_t anon_dev)
 		btrfs_check_and_init_root_item(&root->root_item);
 	}
 
-	btrfs_init_free_ino_ctl(root);
-	spin_lock_init(&root->ino_cache_lock);
-	init_waitqueue_head(&root->ino_cache_wait);
-
 	/*
 	 * Don't assign anonymous block device to roots that are not exposed to
 	 * userspace, the id pool is limited to 1M
@@ -2032,8 +2019,6 @@ void btrfs_put_root(struct btrfs_root *root)
 			free_anon_bdev(root->anon_dev);
 		btrfs_drew_lock_destroy(&root->snapshot_lock);
 		free_root_extent_buffers(root);
-		kfree(root->free_ino_ctl);
-		kfree(root->free_ino_pinned);
 #ifdef CONFIG_BTRFS_DEBUG
 		spin_lock(&root->fs_info->fs_roots_radix_lock);
 		list_del_init(&root->leak_list);
@@ -3950,14 +3935,6 @@ void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info,
 		}
 	}
 
-	if (root->free_ino_pinned)
-		__btrfs_remove_free_space_cache(root->free_ino_pinned);
-	if (root->free_ino_ctl)
-		__btrfs_remove_free_space_cache(root->free_ino_ctl);
-	if (root->ino_cache_inode) {
-		iput(root->ino_cache_inode);
-		root->ino_cache_inode = NULL;
-	}
 	if (drop_ref)
 		btrfs_put_root(root);
 }
fs/btrfs/free-space-cache.c +0 -177

201 lines not on this page · raw message

fs/btrfs/free-space-cache.h +0 -6
index bf8d127d2407..50d6ce1b25eb 100644
@@ -99,11 +99,6 @@ int btrfs_write_out_cache(struct btrfs_trans_handle *trans,
 			  struct btrfs_path *path);
 struct inode *lookup_free_ino_inode(struct btrfs_root *root,
 				    struct btrfs_path *path);
-int create_free_ino_inode(struct btrfs_root *root,
-			  struct btrfs_trans_handle *trans,
-			  struct btrfs_path *path);
-int load_free_ino_cache(struct btrfs_fs_info *fs_info,
-			struct btrfs_root *root);
 int btrfs_write_out_ino_cache(struct btrfs_root *root,
 			      struct btrfs_trans_handle *trans,
 			      struct btrfs_path *path,
@@ -127,7 +122,6 @@ bool btrfs_is_free_space_trimmed(struct btrfs_block_group *block_group);
 u64 btrfs_find_space_for_alloc(struct btrfs_block_group *block_group,
 			       u64 offset, u64 bytes, u64 empty_size,
 			       u64 *max_extent_size);
-u64 btrfs_find_ino_for_alloc(struct btrfs_root *fs_root);
 void btrfs_dump_free_space(struct btrfs_block_group *block_group,
 			   u64 bytes);
 int btrfs_find_space_cluster(struct btrfs_block_group *block_group,
fs/btrfs/inode-map.c deleted +0 -527

527 lines not on this page · raw message

fs/btrfs/inode-map.h deleted +0 -14
deleted file mode 100644
index 5f6d8b3c65c2..000000000000
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-
-#ifndef BTRFS_INODE_MAP_H
-#define BTRFS_INODE_MAP_H
-
-void btrfs_init_free_ino_ctl(struct btrfs_root *root);
-void btrfs_unpin_free_ino(struct btrfs_root *root);
-void btrfs_return_ino(struct btrfs_root *root, u64 objectid);
-int btrfs_find_free_ino(struct btrfs_root *root, u64 *objectid);
-int btrfs_save_ino_cache(struct btrfs_root *root,
-			 struct btrfs_trans_handle *trans);
-
-
-#endif
fs/btrfs/inode.c +0 -11
index 70d964170497..4426795b0b2f 100644
@@ -45,7 +45,6 @@
 #include "compression.h"
 #include "locking.h"
 #include "free-space-cache.h"
-#include "inode-map.h"
 #include "props.h"
 #include "qgroup.h"
 #include "delalloc-space.h"
@@ -4199,12 +4198,6 @@ int btrfs_delete_subvolume(struct inode *dir, struct dentry *dentry)
 		d_invalidate(dentry);
 		btrfs_prune_dentries(dest);
 		ASSERT(dest->send_in_progress == 0);
-
-		/* the last ref */
-		if (dest->ino_cache_inode) {
-			iput(dest->ino_cache_inode);
-			dest->ino_cache_inode = NULL;
-		}
 	}
 
 	return ret;
@@ -5280,10 +5273,6 @@ void btrfs_evict_inode(struct inode *inode)
 		btrfs_end_transaction(trans);
 	}
 
-	if (!(root == fs_info->tree_root ||
-	      root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID))
-		btrfs_return_ino(root, btrfs_ino(BTRFS_I(inode)));
-
 free_rsv:
 	btrfs_free_block_rsv(fs_info, rsv);
 no_delete:
fs/btrfs/ioctl.c +0 -1
index 6aea52828742..e3859662cfcf 100644
@@ -34,7 +34,6 @@
 #include "print-tree.h"
 #include "volumes.h"
 #include "locking.h"
-#include "inode-map.h"
 #include "backref.h"
 #include "rcu-string.h"
 #include "send.h"
fs/btrfs/relocation.c +0 -1
index 6e7e5fe2e277..19b7db8b2117 100644
@@ -18,7 +18,6 @@
 #include "btrfs_inode.h"
 #include "async-thread.h"
 #include "free-space-cache.h"
-#include "inode-map.h"
 #include "qgroup.h"
 #include "print-tree.h"
 #include "delalloc-space.h"
fs/btrfs/super.c +0 -8
index 348f8899f4f4..99e4f6ddec1a 100644
@@ -874,12 +874,6 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
 		case Opt_inode_cache:
 			btrfs_warn(info,
 	"the 'inode_cache' option is deprecated and will have no effect from 5.11");
-			btrfs_set_pending_and_info(info, INODE_MAP_CACHE,
-					   "enabling inode map caching");
-			break;
-		case Opt_noinode_cache:
-			btrfs_clear_pending_and_info(info, INODE_MAP_CACHE,
-					     "disabling inode map caching");
 			break;
 		case Opt_clear_cache:
 			btrfs_set_and_info(info, CLEAR_CACHE,
@@ -1496,8 +1490,6 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
 		seq_puts(seq, ",enospc_debug");
 	if (btrfs_test_opt(info, AUTO_DEFRAG))
 		seq_puts(seq, ",autodefrag");
-	if (btrfs_test_opt(info, INODE_MAP_CACHE))
-		seq_puts(seq, ",inode_cache");
 	if (btrfs_test_opt(info, SKIP_BALANCE))
 		seq_puts(seq, ",skip_balance");
 #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
fs/btrfs/transaction.c +0 -19
index e425451c5811..7c32ef22dc5a 100644
@@ -16,7 +16,6 @@
 #include "transaction.h"
 #include "locking.h"
 #include "tree-log.h"
-#include "inode-map.h"
 #include "volumes.h"
 #include "dev-replace.h"
 #include "qgroup.h"
@@ -163,8 +162,6 @@ static noinline void switch_commit_roots(struct btrfs_trans_handle *trans)
 		list_del_init(&root->dirty_list);
 		free_extent_buffer(root->commit_root);
 		root->commit_root = btrfs_root_node(root);
-		if (is_fstree(root->root_key.objectid))
-			btrfs_unpin_free_ino(root);
 		extent_io_tree_release(&root->dirty_log_pages);
 		btrfs_qgroup_clean_swapped_blocks(root);
 	}
@@ -1342,8 +1339,6 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans)
 			btrfs_free_log(trans, root);
 			btrfs_update_reloc_root(trans, root);
 
-			btrfs_save_ino_cache(root, trans);
-
 			/* see comments in should_cow_block() */
 			clear_bit(BTRFS_ROOT_FORCE_COW, &root->state);
 			smp_mb__after_atomic();
@@ -2435,10 +2430,6 @@ int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root)
 	btrfs_debug(fs_info, "cleaner removing %llu", root->root_key.objectid);
 
 	btrfs_kill_all_delayed_nodes(root);
-	if (root->ino_cache_inode) {
-		iput(root->ino_cache_inode);
-		root->ino_cache_inode = NULL;
-	}
 
 	if (btrfs_header_backref_rev(root->node) <
 			BTRFS_MIXED_BACKREF_REV)
@@ -2459,16 +2450,6 @@ void btrfs_apply_pending_changes(struct btrfs_fs_info *fs_info)
 	if (!prev)
 		return;
 
-	bit = 1 << BTRFS_PENDING_SET_INODE_MAP_CACHE;
-	if (prev & bit)
-		btrfs_set_opt(fs_info->mount_opt, INODE_MAP_CACHE);
-	prev &= ~bit;
-
-	bit = 1 << BTRFS_PENDING_CLEAR_INODE_MAP_CACHE;
-	if (prev & bit)
-		btrfs_clear_opt(fs_info->mount_opt, INODE_MAP_CACHE);
-	prev &= ~bit;
-
 	bit = 1 << BTRFS_PENDING_COMMIT;
 	if (prev & bit)
 		btrfs_debug(fs_info, "pending commit done");
fs/btrfs/tree-log.c +0 -1
index 80cf496226c2..485267ee5bc6 100644
@@ -17,7 +17,6 @@
 #include "backref.h"
 #include "compression.h"
 #include "qgroup.h"
-#include "inode-map.h"
 #include "block-group.h"
 #include "space-info.h"
 
Signature · 1 line
2.25.1
#4 lore raw

Re: [PATCH 3/3] btrfs: Remove inode cache feature

Quoted 12 lines · Nikolay Borisov

It's been deprecated and never really used so simply remove it.

---
 fs/btrfs/Makefile           |   2 +-
 fs/btrfs/ctree.h            |  15 +-
 fs/btrfs/disk-io.c          |  23 --
 fs/btrfs/free-space-cache.c | 177 ------------
 fs/btrfs/free-space-cache.h |   6 -
 fs/btrfs/inode-map.c        | 527 ------------------------------------
 fs/btrfs/inode-map.h        |  14 -
 fs/btrfs/inode.c            |  11 -
Quoted 8 lines
 fs/btrfs/ioctl.c            |   1 -
 fs/btrfs/relocation.c       |   1 -
 fs/btrfs/super.c            |   8 -
 fs/btrfs/transaction.c      |  19 --
 fs/btrfs/tree-log.c         |   1 -
 13 files changed, 3 insertions(+), 802 deletions(-)
 delete mode 100644 fs/btrfs/inode-map.c
 delete mode 100644 fs/btrfs/inode-map.h

This still left some bits, eg. prototypes of load_free_ino_cache and btrfs_write_out_ino_cache (grep for ino_cache).

fs/btrfs/super.c int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · line 880

Quoted 10 lines
fs/btrfs/super.c +0 -4
@@ -874,12 +874,6 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
 		case Opt_inode_cache:
 			btrfs_warn(info,
 	"the 'inode_cache' option is deprecated and will have no effect from 5.11");
-			btrfs_set_pending_and_info(info, INODE_MAP_CACHE,
-					   "enabling inode map caching");
-			break;
-		case Opt_noinode_cache:

This needs to stay as well, but can be merged with the above.

Also definition of Opt_inode_cache should be moved to the deprecated section in super.c.

There are some uses of BTRFS_FREE_INO_OBJECTID, some of them can be removed but I'd rather do that as separate patches as it's affecting code flow. The main removal part is done with the above fixups.

#5 lore raw
In reply to Nikolay Borisov
Quoted 3 lines · Nikolay Borisov

This patchset removes inode cache feature which has been deprecated since kernel v5.9 release. First 2 patches move code around and replace calls of functions which are to be removed. Patch 3 finally removes inode cache for good.

There's still the remaining issue what to do with the space occupied by the cache inode if the feature was enabled. I haven't researched that, eg. how big the inode is if it's worth removing it at all or if we should do some lightweight scan to remove them at some appropriate time.

#6 lore raw
Quoted 4 lines · David Sterba

There's still the remaining issue what to do with the space occupied by the cache inode if the feature was enabled. I haven't researched that, eg. how big the inode is if it's worth removing it at all or if we should do some lightweight scan to remove them at some appropriate time.

I'd rather implement this in btrfs-progs.

#7 lore raw
Quoted 9 lines · Nikolay Borisov
Quoted 4 lines · David Sterba

There's still the remaining issue what to do with the space occupied by the cache inode if the feature was enabled. I haven't researched that, eg. how big the inode is if it's worth removing it at all or if we should do some lightweight scan to remove them at some appropriate time.

I'd rather implement this in btrfs-progs.

I did a quick check, 1M empty files created then every 7th deleted (so there are no large ranges to free), resulting in ~140K files and that occupied about 680KiB. So for 1M files it's about 5M of space, where metadata part is small (<1KiB), the bitmaps are stored in hidden data inodes. All in all it does not sound like a terrible waste of space.