Skip to contentSkip to conversation

f2fs: adjust free mem size to flush dentry blocks

PATCH In review Jaegeuk Kim 2 participants 4 messages Jul 14, 2014 – Jul 15, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 f2fs: adjust free mem size to flush dentry blocks

From: Jaegeuk Kim <[email protected]>

commit 6fb03f3a40805a412c9b285010ffdc2e7563f81b upstream.

If so many dirty dentry blocks are cached, not reached to the flush condition, we should fall into livelock in balance_dirty_pages.
So, let's consider the mem size for the condition.

Conflicts:

	fs/f2fs/node.h
---
 fs/f2fs/data.c |  3 ++-
 fs/f2fs/f2fs.h |  1 +
 fs/f2fs/node.c | 44 ++++++++++++++++++++++++++------------------
 fs/f2fs/node.h |  5 +++--
 4 files changed, 32 insertions(+), 21 deletions(-)
fs/f2fs/data.c +2 -1
index 45abd60..716645e 100644
@@ -867,7 +867,8 @@ static int f2fs_write_data_pages(struct address_space *mapping,
 		return 0;
 
 	if (S_ISDIR(inode->i_mode) && wbc->sync_mode == WB_SYNC_NONE &&
-			get_dirty_dents(inode) < nr_pages_to_skip(sbi, DATA))
+			get_dirty_dents(inode) < nr_pages_to_skip(sbi, DATA) &&
+			available_free_memory(sbi, DIRTY_DENTS))
 		goto skip_write;
 
 	diff = nr_pages_to_write(sbi, DATA, wbc);
fs/f2fs/f2fs.h +1 -0
index 2ecac83..656523c 100644
@@ -1140,6 +1140,7 @@ f2fs_hash_t f2fs_dentry_hash(const char *, size_t);
 struct dnode_of_data;
 struct node_info;
 
+bool available_free_memory(struct f2fs_sb_info *, int);
 int is_checkpointed_node(struct f2fs_sb_info *, nid_t);
 bool fsync_mark_done(struct f2fs_sb_info *, nid_t);
 void get_node_info(struct f2fs_sb_info *, nid_t, struct node_info *);
fs/f2fs/node.c +26 -18

110 lines not on this page · raw message

fs/f2fs/node.h +3 -2
index 5decc1a..b517077 100644
@@ -75,9 +75,10 @@ static inline void node_info_from_raw_nat(struct node_info *ni,
 	ni->version = raw_ne->version;
 }
 
-enum nid_type {
+enum mem_type {
 	FREE_NIDS,	/* indicates the free nid list */
-	NAT_ENTRIES	/* indicates the cached nat entry */
+	NAT_ENTRIES,	/* indicates the cached nat entry */
+	DIRTY_DENTS	/* indicates dirty dentry pages */
 };
 
 /*
Signature · 1 line
2.0.1.472.g6f92e5f
#1 lore raw

PATCH 2/2 f2fs: check bdi->dirty_exceeded when trying to skip data writes

commit dd6b9bf5883c3ca9c17bac80ccd8615fe5a452a3 upstream.

If we don't check the current backing device status, balance_dirty_pages can fall into infinite pausing routine.

This can be occurred when a lot of directories make a small number of dirty dentry pages including files.

---
 fs/f2fs/node.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/node.c +2 -0
index a9c0495..5696bde 100644
@@ -42,6 +42,8 @@ bool available_free_memory(struct f2fs_sb_info *sbi, int type)
 		mem_size = (nm_i->nat_cnt * sizeof(struct nat_entry)) >> 12;
 		res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 2);
 	} else if (type == DIRTY_DENTS) {
+		if (sbi->sb->s_bdi->dirty_exceeded)
+			return false;
 		mem_size = get_pages(sbi, F2FS_DIRTY_DENTS);
 		res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 1);
 	}
Signature · 9 lines
2.0.1.472.g6f92e5f


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck&#174;
Code Sight&#153; - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
#2 lore raw

Re: [PATCH 3.15 2/2] f2fs: check bdi->dirty_exceeded when trying to skip data writes

Quoted 1 line · Jaegeuk Kim

commit dd6b9bf5883c3ca9c17bac80ccd8615fe5a452a3 upstream.

You mean 2743f865543c0c4a5e12fc13edb2bf89a6e9687c, right?

thanks,

greg k-h

Quoted 33 lines

If we don't check the current backing device status, balance_dirty_pages can fall into infinite pausing routine.

This can be occurred when a lot of directories make a small number of dirty dentry pages including files.

---
 fs/f2fs/node.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/node.c +2 -0
index a9c0495..5696bde 100644
@@ -42,6 +42,8 @@ bool available_free_memory(struct f2fs_sb_info *sbi, int type)
 		mem_size = (nm_i->nat_cnt * sizeof(struct nat_entry)) >> 12;
 		res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 2);
 	} else if (type == DIRTY_DENTS) {
+		if (sbi->sb->s_bdi->dirty_exceeded)
+			return false;
 		mem_size = get_pages(sbi, F2FS_DIRTY_DENTS);
 		res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 1);
 	}
Signature · 6 lines
2.0.1.472.g6f92e5f

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

Re: [PATCH 3.15 2/2] f2fs: check bdi->dirty_exceeded when trying to skip data writes

Quoted 4 lines · Greg KH
Quoted 1 line · Jaegeuk Kim

commit dd6b9bf5883c3ca9c17bac80ccd8615fe5a452a3 upstream.

You mean 2743f865543c0c4a5e12fc13edb2bf89a6e9687c, right?

Ah, correct.
Thank you. :)

Quoted 38 lines

thanks,

greg k-h

Quoted 33 lines

If we don't check the current backing device status, balance_dirty_pages can fall into infinite pausing routine.

This can be occurred when a lot of directories make a small number of dirty dentry pages including files.

---
 fs/f2fs/node.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/node.c +2 -0
index a9c0495..5696bde 100644
@@ -42,6 +42,8 @@ bool available_free_memory(struct f2fs_sb_info *sbi, int type)
 		mem_size = (nm_i->nat_cnt * sizeof(struct nat_entry)) >> 12;
 		res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 2);
 	} else if (type == DIRTY_DENTS) {
+		if (sbi->sb->s_bdi->dirty_exceeded)
+			return false;
 		mem_size = get_pages(sbi, F2FS_DIRTY_DENTS);
 		res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 1);
 	}
Signature · 6 lines
2.0.1.472.g6f92e5f

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Jaegeuk Kim