f2fs: move the list_head initialization into the lock protection region
Subsystems (2)
PATCH 5/5 f2fs: move the list_head initialization into the lock protection region
--- fs/f2fs/checkpoint.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
fs/f2fs/checkpoint.c +10 -5
@@ -511,8 +511,8 @@ void add_dirty_dir_inode(struct inode *inode)void remove_dirty_dir_inode (struct inode *inode) {struct f2fs_sb_info *sbi =F2FS_SB (inode->i_sb); -struct list_head *head = &sbi->dir_inode_list; -struct list_head *this; + +struct list_head *this, *head;if (!S_ISDIR (inode->i_mode))return ;
@@ -523,6 +523,7 @@ void remove_dirty_dir_inode(struct inode *inode)return ; } + head = &sbi->dir_inode_list;list_for_each (this, head) {struct dir_inode_entry *entry; entry = list_entry(this, struct dir_inode_entry, list);
@@ -544,11 +545,13 @@ void remove_dirty_dir_inode(struct inode *inode)struct inode *check_dirty_dir_inode (struct f2fs_sb_info *sbi,nid_t ino) { -struct list_head *head = &sbi->dir_inode_list; -struct list_head *this; + +struct list_head *this, *head;struct inode *inode =NULL ;spin_lock (&sbi->dir_inode_lock); + + head = &sbi->dir_inode_list;list_for_each (this, head) {struct dir_inode_entry *entry; entry = list_entry(this, struct dir_inode_entry, list);
@@ -563,11 +566,13 @@ struct inode *check_dirty_dir_inode(struct f2fs_sb_info *sbi, nid_t ino)void sync_dirty_dir_inodes (struct f2fs_sb_info *sbi) { -struct list_head *head = &sbi->dir_inode_list; +struct list_head *head;struct dir_inode_entry *entry;struct inode *inode; retry:spin_lock (&sbi->dir_inode_lock); + + head = &sbi->dir_inode_list;if (list_empty (head)) {spin_unlock (&sbi->dir_inode_lock);return ;
Signature · 9 lines
1.7.7 ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
Hi Gu,
IMO, there is no reason to cover the list header by the lock. In any flows, sbi should have the header all the time. What is your opinion?
Thanks,
2013-11-19 (화), 18:03 +0800, Gu Zheng:
Quoted 59 lines
Signed-off-by Gu Zheng <[email protected]>--- fs/f2fs/checkpoint.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)fs/f2fs/checkpoint.c +10
-5@@ -511,8 +511,8 @@ void add_dirty_dir_inode(struct inode *inode)void remove_dirty_dir_inode (struct inode *inode) {struct f2fs_sb_info *sbi =F2FS_SB (inode->i_sb); -struct list_head *head = &sbi->dir_inode_list; -struct list_head *this; + +struct list_head *this, *head;if (!S_ISDIR (inode->i_mode))return ;@@ -523,6 +523,7 @@ void remove_dirty_dir_inode(struct inode *inode)return ; } + head = &sbi->dir_inode_list;list_for_each (this, head) {struct dir_inode_entry *entry; entry = list_entry(this, struct dir_inode_entry, list);@@ -544,11 +545,13 @@ void remove_dirty_dir_inode(struct inode *inode)struct inode *check_dirty_dir_inode (struct f2fs_sb_info *sbi,nid_t ino) { -struct list_head *head = &sbi->dir_inode_list; -struct list_head *this; + +struct list_head *this, *head;struct inode *inode =NULL ;spin_lock (&sbi->dir_inode_lock); + + head = &sbi->dir_inode_list;list_for_each (this, head) {struct dir_inode_entry *entry; entry = list_entry(this, struct dir_inode_entry, list);@@ -563,11 +566,13 @@ struct inode *check_dirty_dir_inode(struct f2fs_sb_info *sbi, nid_t ino)void sync_dirty_dir_inodes (struct f2fs_sb_info *sbi) { -struct list_head *head = &sbi->dir_inode_list; +struct list_head *head;struct dir_inode_entry *entry;struct inode *inode; retry:spin_lock (&sbi->dir_inode_lock); + + head = &sbi->dir_inode_list;if (list_empty (head)) {spin_unlock (&sbi->dir_inode_lock);return ;
Signature · 14 lines
Jaegeuk Kim Samsung ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Hi Kim,
Quoted 4 lines · Jaegeuk Kim
Hi Gu,
IMO, there is no reason to cover the list header by the lock. In any flows, sbi should have the header all the time.
Yes, you're right.
Quoted 1 line
What is your opinion?
Moving the list_head initialization into the lock protection region, so that we can ignore the list change during the gap(initialization<-->use). And on the other side, it can keep the code style uniform for better maintenance.
Regards,
Gu
Quoted 50 lines
Thanks,
2013-11-19 (화), 18:03 +0800, Gu Zheng:
Quoted 46 lines
Signed-off-by Gu Zheng <[email protected]>--- fs/f2fs/checkpoint.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)fs/f2fs/checkpoint.c +7
-4@@ -511,8 +511,8 @@ void add_dirty_dir_inode(struct inode *inode)void remove_dirty_dir_inode (struct inode *inode) {struct f2fs_sb_info *sbi =F2FS_SB (inode->i_sb); -struct list_head *head = &sbi->dir_inode_list; -struct list_head *this; + +struct list_head *this, *head;if (!S_ISDIR (inode->i_mode))return ;@@ -523,6 +523,7 @@ void remove_dirty_dir_inode(struct inode *inode)return ; } + head = &sbi->dir_inode_list;list_for_each (this, head) {struct dir_inode_entry *entry; entry = list_entry(this, struct dir_inode_entry, list);@@ -544,11 +545,13 @@ void remove_dirty_dir_inode(struct inode *inode)struct inode *check_dirty_dir_inode (struct f2fs_sb_info *sbi,nid_t ino) { -struct list_head *head = &sbi->dir_inode_list; -struct list_head *this; + +struct list_head *this, *head;struct inode *inode =NULL ;spin_lock (&sbi->dir_inode_lock); + + head = &sbi->dir_inode_list;list_for_each (this, head) {struct dir_inode_entry *entry; entry = list_entry(this, struct dir_inode_entry, list);@@ -563,11 +566,13 @@ struct inode *check_dirty_dir_inode(struct f2fs_sb_info *sbi, nid_t ino)
Quoted 14 lines
fs/f2fs/checkpoint.c struct inode *check_dirty_dir_inode(struct f2fs_sb_info *sbi, nid_t ino) · line 578
Quoted 13 lines
fs/f2fs/checkpoint.c +3
-1void sync_dirty_dir_inodes (struct f2fs_sb_info *sbi) { -struct list_head *head = &sbi->dir_inode_list; +struct list_head *head;struct dir_inode_entry *entry;struct inode *inode; retry:spin_lock (&sbi->dir_inode_lock); + + head = &sbi->dir_inode_list;if (list_empty (head)) {spin_unlock (&sbi->dir_inode_lock);return ;
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Ok, got it.
Thanks, :)
2013-11-20 (수), 17:48 +0800, Gu Zheng:
Quoted 90 lines
Hi Kim,
Quoted 4 lines · Jaegeuk Kim
Hi Gu,
IMO, there is no reason to cover the list header by the lock. In any flows, sbi should have the header all the time.
Yes, you're right.
Quoted 1 line
What is your opinion?
Moving the
list_headinitialization into the lock protection region, so that we can ignore the list change during thegap(initialization<-->use). And on the other side, it can keep the code style uniform for better maintenance.Regards,
GuQuoted 50 lines
Thanks,
2013-11-19 (화), 18:03 +0800, Gu Zheng:
Quoted 46 lines
Signed-off-by Gu Zheng <[email protected]>--- fs/f2fs/checkpoint.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)fs/f2fs/checkpoint.c +7
-4@@ -511,8 +511,8 @@ void add_dirty_dir_inode(struct inode *inode)void remove_dirty_dir_inode (struct inode *inode) {struct f2fs_sb_info *sbi =F2FS_SB (inode->i_sb); -struct list_head *head = &sbi->dir_inode_list; -struct list_head *this; + +struct list_head *this, *head;if (!S_ISDIR (inode->i_mode))return ;@@ -523,6 +523,7 @@ void remove_dirty_dir_inode(struct inode *inode)return ; } + head = &sbi->dir_inode_list;list_for_each (this, head) {struct dir_inode_entry *entry; entry = list_entry(this, struct dir_inode_entry, list);@@ -544,11 +545,13 @@ void remove_dirty_dir_inode(struct inode *inode)struct inode *check_dirty_dir_inode (struct f2fs_sb_info *sbi,nid_t ino) { -struct list_head *head = &sbi->dir_inode_list; -struct list_head *this; + +struct list_head *this, *head;struct inode *inode =NULL ;spin_lock (&sbi->dir_inode_lock); + + head = &sbi->dir_inode_list;list_for_each (this, head) {struct dir_inode_entry *entry; entry = list_entry(this, struct dir_inode_entry, list);@@ -563,11 +566,13 @@ struct inode *check_dirty_dir_inode(struct f2fs_sb_info *sbi, nid_t ino)Quoted 14 lines
fs/f2fs/checkpoint.c struct inode *check_dirty_dir_inode(struct f2fs_sb_info *sbi, nid_t ino) · line 578
Quoted 13 lines
fs/f2fs/checkpoint.c +3
-1void sync_dirty_dir_inodes (struct f2fs_sb_info *sbi) { -struct list_head *head = &sbi->dir_inode_list; +struct list_head *head;struct dir_inode_entry *entry;struct inode *inode; retry:spin_lock (&sbi->dir_inode_lock); + + head = &sbi->dir_inode_list;if (list_empty (head)) {spin_unlock (&sbi->dir_inode_lock);return ;--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 14 lines
Jaegeuk Kim Samsung ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel