Skip to contentSkip to conversation

f2fs: avoid clear valid page

PATCH New Chao Yu 1 participant 1 message Aug 12, 2015 F2FS file system

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 f2fs: avoid clear valid page

In f2fs_delete_entry, if last dirent is remove from the dentry page, we will try to punch that page since it has no valid date in it.

But truncate_hole which is used for punching could fail because of no memory or IO error, if that happened, we'd better skip clearing this valid dentry page.

---
 fs/f2fs/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/dir.c +2 -2
index a34ebd8..8f15fc1 100644
@@ -718,8 +718,8 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
 	if (inode)
 		f2fs_drop_nlink(dir, inode, NULL);
 
-	if (bit_pos == NR_DENTRY_IN_BLOCK) {
-		truncate_hole(dir, page->index, page->index + 1);
+	if (bit_pos == NR_DENTRY_IN_BLOCK &&
+			!truncate_hole(dir, page->index, page->index + 1)) {
 		clear_page_dirty_for_io(page);
 		ClearPagePrivate(page);
 		ClearPageUptodate(page);
Signature · 1 line
2.4.2