summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-06-11 08:01:47 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-07-05 16:17:12 +0200
commit43902e57633f5dd9bc71f1a30d69d7bc0f49dc6b (patch)
treeb0bc5aa5c8e30ee05ccc7aedb50a080351b276c8
parent6685d24e295ce97b2708c45a7d31531a057a9fc0 (diff)
downloadbarebox-43902e57633f5dd9bc71f1a30d69d7bc0f49dc6b.tar.gz
barebox-43902e57633f5dd9bc71f1a30d69d7bc0f49dc6b.tar.xz
fs: free inodes we no longer need
So far we freed the no longer needed inodes only at unmount time. Let's trust our reference counting a bit more and free them once the reference counter hits zero. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--fs/fs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/fs.c b/fs/fs.c
index cecb3d70e0..e04cadfe5d 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1090,10 +1090,12 @@ void iput(struct inode *inode)
if (!inode)
return;
- if (!inode->i_count)
- return;
-
inode->i_count--;
+
+ if (!inode->i_count) {
+ list_del(&inode->i_sb_list);
+ destroy_inode(inode);
+ }
}
struct inode *iget(struct inode *inode)