Skip to contentSkip to conversation

fs-introduce-alloc_inode_sb-to-allocate-filesystems-specific-inode.patch removed from -mm tree

merged Andrew Morton 1 participant 1 message Mar 25, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The patch titled
Subject: fs: introduce alloc_inode_sb() to allocate filesystems specific inode
has been removed from the -mm tree. Its filename was
fs-introduce-alloc_inode_sb-to-allocate-filesystems-specific-inode.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Muchun Song <[email protected]>
Subject: fs: introduce alloc_inode_sb() to allocate filesystems specific inode

The allocated inode cache is supposed to be added to its memcg list_lru which should be allocated as well in advance. That can be done by kmem_cache_alloc_lru() which allocates object and list_lru. The file systems is main user of it. So introduce alloc_inode_sb() to allocate file system specific inodes and set up the inode reclaim context properly. The file system is supposed to use alloc_inode_sb() to allocate inodes. In the later patches, we will convert all users to the new API.

Cc Alex Shi <[email protected]>
Cc Anna Schumaker <[email protected]>
Cc Chao Yu <[email protected]>
Cc Dave Chinner <[email protected]>
Cc Fam Zheng <[email protected]>
Cc Jaegeuk Kim <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Kari Argillander <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Qi Zheng <[email protected]>
Cc Shakeel Butt <[email protected]>
Cc Theodore Ts'o <[email protected]>
Cc Trond Myklebust <[email protected]>
Cc Vladimir Davydov <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Wei Yang <[email protected]>
Cc Xiongchun Duan <[email protected]>
Cc Yang Shi <[email protected]>

---

 Documentation/filesystems/porting.rst |    6 ++++++
 fs/inode.c                            |    2 +-
 include/linux/fs.h                    |   11 +++++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)
Documentation/filesystems/porting.rst renamed from Documentation/filesystems/porting.rst~fs-introduce-alloc_inode_sb-to-allocate-filesystems-specific-inode +6 -0
@@ -45,6 +45,12 @@ typically between calling iget_locked()
 
 At some point that will become mandatory.
 
+**mandatory**
+
+The foo_inode_info should always be allocated through alloc_inode_sb() rather
+than kmem_cache_alloc() or kmalloc() related to set up the inode reclaim context
+correctly.
+
 ---
 
 **mandatory**
fs/inode.c renamed from fs/inode.c~fs-introduce-alloc_inode_sb-to-allocate-filesystems-specific-inode +1 -1
@@ -259,7 +259,7 @@ static struct inode *alloc_inode(struct
 	if (ops->alloc_inode)
 		inode = ops->alloc_inode(sb);
 	else
-		inode = kmem_cache_alloc(inode_cachep, GFP_KERNEL);
+		inode = alloc_inode_sb(sb, inode_cachep, GFP_KERNEL);
 
 	if (!inode)
 		return NULL;
include/linux/fs.h renamed from include/linux/fs.h~fs-introduce-alloc_inode_sb-to-allocate-filesystems-specific-inode +11 -0
@@ -42,6 +42,7 @@
 #include <linux/mount.h>
 #include <linux/cred.h>
 #include <linux/mnt_idmapping.h>
+#include <linux/slab.h>
 
 #include <asm/byteorder.h>
 #include <uapi/linux/fs.h>
@@ -3114,6 +3115,16 @@ extern void free_inode_nonrcu(struct ino
 extern int should_remove_suid(struct dentry *);
 extern int file_remove_privs(struct file *);
 
+/*
+ * This must be used for allocating filesystems specific inodes to set
+ * up the inode reclaim context correctly.
+ */
+static inline void *
+alloc_inode_sb(struct super_block *sb, struct kmem_cache *cache, gfp_t gfp)
+{
+	return kmem_cache_alloc_lru(cache, &sb->s_inode_lru, gfp);
+}
+
 extern void __insert_inode_hash(struct inode *, unsigned long hashval);
 static inline void insert_inode_hash(struct inode *inode)
 {

_

Patches currently in -mm which might be from [email protected] are