linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/shmem.c: make shmem_mapping() inline
@ 2020-11-13 13:54 Hui Su
  2020-11-13 15:14 ` Pankaj Gupta
  2020-11-13 16:54 ` kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Hui Su @ 2020-11-13 13:54 UTC (permalink / raw)
  To: hughd, akpm, linux-mm, linux-kernel; +Cc: sh_def

inline the shmem_mapping(), and use shmem_mapping()
instead of 'inode->i_mapping->a_ops == &shmem_aops'
in shmem_evict_inode().

Signed-off-by: Hui Su <sh_def@163.com>
---
 include/linux/shmem_fs.h | 2 +-
 mm/shmem.c               | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index a5a5d1d4d7b1..154a16fe7fd5 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -67,7 +67,7 @@ extern unsigned long shmem_get_unmapped_area(struct file *, unsigned long addr,
 		unsigned long len, unsigned long pgoff, unsigned long flags);
 extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
 #ifdef CONFIG_SHMEM
-extern bool shmem_mapping(struct address_space *mapping);
+extern inline bool shmem_mapping(struct address_space *mapping);
 #else
 static inline bool shmem_mapping(struct address_space *mapping)
 {
diff --git a/mm/shmem.c b/mm/shmem.c
index 537c137698f8..7395d8e8226a 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1152,7 +1152,7 @@ static void shmem_evict_inode(struct inode *inode)
 	struct shmem_inode_info *info = SHMEM_I(inode);
 	struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
 
-	if (inode->i_mapping->a_ops == &shmem_aops) {
+	if (shmem_mapping(inode->i_mapping)) {
 		shmem_unacct_size(info->flags, inode->i_size);
 		inode->i_size = 0;
 		shmem_truncate_range(inode, 0, (loff_t)-1);
@@ -2352,7 +2352,7 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
 	return inode;
 }
 
-bool shmem_mapping(struct address_space *mapping)
+inline bool shmem_mapping(struct address_space *mapping)
 {
 	return mapping->a_ops == &shmem_aops;
 }
-- 
2.29.0




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-14  5:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-13 13:54 [PATCH] mm/shmem.c: make shmem_mapping() inline Hui Su
2020-11-13 15:14 ` Pankaj Gupta
2020-11-13 16:54 ` kernel test robot
2020-11-14  5:47   ` Hui Su

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).