Skip to contentSkip to conversation

f2fs: invalidate xattr node page when evict inode

PATCH In review Chao Yu 2 participants 3 messages Jul 31, 2014 – Aug 4, 2014

Subsystems (2)
lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 2/2 f2fs: invalidate xattr node page when evict inode

When inode is evicted, all the page cache belong to this inode should be released including the xattr node page. But previously we didn't do this, this patch fixed this issue.

---
 fs/f2fs/inode.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/f2fs/inode.c +6 -0
index 0e69aa9..8a5403b 100644
@@ -267,10 +267,16 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
 void f2fs_evict_inode(struct inode *inode)
 {
 	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+	struct f2fs_inode_info *fi = F2FS_I(inode);
 
 	trace_f2fs_evict_inode(inode);
+
 	truncate_inode_pages_final(&inode->i_data);
 
+	if (fi->i_xattr_nid)
+		invalidate_mapping_pages(NODE_MAPPING(sbi),
+					fi->i_xattr_nid, fi->i_xattr_nid);
+
 	if (inode->i_ino == F2FS_NODE_INO(sbi) ||
 			inode->i_ino == F2FS_META_INO(sbi))
 		goto out_clear;
Signature · 1 line
2.0.1.474.g72c7794
maintainer
#1 lore raw

Hi Chao,

Quoted 16 lines · Chao Yu

When inode is evicted, all the page cache belong to this inode should be released including the xattr node page. But previously we didn't do this, this patch fixed this issue.

---
 fs/f2fs/inode.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/f2fs/inode.c +0 -0
index 0e69aa9..8a5403b 100644
@@ -267,10 +267,16 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
 void f2fs_evict_inode(struct inode *inode)
 {

fs/f2fs/inode.c int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc) · line 278

Quoted 10 lines
fs/f2fs/inode.c +5 -0
 	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+	struct f2fs_inode_info *fi = F2FS_I(inode);
 
 	trace_f2fs_evict_inode(inode);
+
 	truncate_inode_pages_final(&inode->i_data);
 
+	if (fi->i_xattr_nid)
+		invalidate_mapping_pages(NODE_MAPPING(sbi),
+					fi->i_xattr_nid, fi->i_xattr_nid);

It would be good to place this below with invalidate_mapping_paages(ino). Since, in the case of deletion, we need to get the xattr node page again on the remove_inode_page call path.

Thanks,

Quoted 6 lines
fs/f2fs/inode.c +1 -0
+
 	if (inode->i_ino == F2FS_NODE_INO(sbi) ||
 			inode->i_ino == F2FS_META_INO(sbi))
 		goto out_clear;
Signature · 1 line
2.0.1.474.g72c7794
author
#2 lore raw

Hi Jaegeuk,

Quoted 34 lines

-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Saturday, August 02, 2014 10:42 PM
To: Chao Yu
Cc: Changman Lee; [email protected]; [email protected]; [email protected]
Subject: Re: [f2fs-dev][PATCH 2/2] f2fs: invalidate xattr node page when evict inode

Hi Chao,

Quoted 23 lines · Chao Yu

When inode is evicted, all the page cache belong to this inode should be released including the xattr node page. But previously we didn't do this, this patch fixed this issue.

---
 fs/f2fs/inode.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/f2fs/inode.c +2 -0
index 0e69aa9..8a5403b 100644
@@ -267,10 +267,16 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
 void f2fs_evict_inode(struct inode *inode)
 {
 	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+	struct f2fs_inode_info *fi = F2FS_I(inode);
 
 	trace_f2fs_evict_inode(inode);
+
 	truncate_inode_pages_final(&inode->i_data);
 
Quoted 7 lines

fs/f2fs/inode.c int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc) · line 278

Quoted 3 lines
fs/f2fs/inode.c +3 -0
+	if (fi->i_xattr_nid)
+		invalidate_mapping_pages(NODE_MAPPING(sbi),
+					fi->i_xattr_nid, fi->i_xattr_nid);

It would be good to place this below with invalidate_mapping_paages(ino). Since, in the case of deletion, we need to get the xattr node page again on the remove_inode_page call path.

Yes, IMO, it will be OK now when using above implementation because we will invalidate this xattr page in truncate_node(), but I'd like use your method because it's better to guarantee invalidating xattr page by evict_inode itself.

I will send a v2 patch, and thanks for your suggestion.

Regards,
Yu

Quoted 9 lines

Thanks,

Quoted 6 lines
fs/f2fs/inode.c +1 -1
+
 	if (inode->i_ino == F2FS_NODE_INO(sbi) ||
 			inode->i_ino == F2FS_META_INO(sbi))
 		goto out_clear;
--

2.0.1.474.g72c7794

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk