Skip to contentSkip to conversation

f2fs: no need inc dirty pages under inode lock

PATCH In review Yunlei He 2 participants 3 messages May 13, 2016 – May 16, 2016 F2FS file system

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH 1/1 f2fs: no need inc dirty pages under inode lock

No need inc dirty pages under inode lock

---
 fs/f2fs/checkpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/checkpoint.c +1 -1
index 6402e93..3da6499 100644
@@ -787,9 +787,9 @@ void update_dirty_page(struct inode *inode, struct page *page)
 
 	spin_lock(&sbi->inode_lock[type]);
 	__add_dirty_inode(inode, type);
-	inode_inc_dirty_pages(inode);
 	spin_unlock(&sbi->inode_lock[type]);
 
+	inode_inc_dirty_pages(inode);
 	SetPagePrivate(page);
 	f2fs_trace_pid(page);
 }
Signature · 9 lines
1.9.1


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
maintainer
#1 lore raw

Hi Yunlei,

It's just one atomic operation.
Are there performance or race condition issues?

Thanks,

Quoted 24 lines · Yunlei He

No need inc dirty pages under inode lock

---
 fs/f2fs/checkpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/checkpoint.c +1 -1
index 6402e93..3da6499 100644
@@ -787,9 +787,9 @@ void update_dirty_page(struct inode *inode, struct page *page)
 
 	spin_lock(&sbi->inode_lock[type]);
 	__add_dirty_inode(inode, type);
-	inode_inc_dirty_pages(inode);
 	spin_unlock(&sbi->inode_lock[type]);
 
+	inode_inc_dirty_pages(inode);
 	SetPagePrivate(page);
 	f2fs_trace_pid(page);
 }
Signature · 1 line
1.9.1

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j

author
#2 lore raw

Hi, Kim

Quoted 5 lines · Jaegeuk Kim

Hi Yunlei,

It's just one atomic operation.
Are there performance or race condition issues?

No race condition issues reported here, but it has no relationship with inode lock, and dec operation with no this lock. Besides atomic operation, it call set_sbi_flag, maybe it will affect performance

Thanks,

Quoted 21 lines

Thanks,

Quoted 18 lines · Yunlei He

No need inc dirty pages under inode lock

---
  fs/f2fs/checkpoint.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/checkpoint.c +0 -1
index 6402e93..3da6499 100644
@@ -787,9 +787,9 @@ void update_dirty_page(struct inode *inode, struct page *page)
 
  	spin_lock(&sbi->inode_lock[type]);
  	__add_dirty_inode(inode, type);
-	inode_inc_dirty_pages(inode);
  	spin_unlock(&sbi->inode_lock[type]);
 
Quoted 9 lines
Quoted 6 lines
fs/f2fs/checkpoint.c +1 -1
+	inode_inc_dirty_pages(inode);
  	SetPagePrivate(page);
  	f2fs_trace_pid(page);
  }
--

1.9.1

.

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j