Skip to contentSkip to conversation

f2fs: check only data or node for summary

PATCH In review Jaegeuk Kim 2 participants 4 messages Jun 10, 2016 – Jul 6, 2016

Subsystems (2)
lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/2 f2fs: check only data or node for summary

We can check data or node types only for gc, since we allocate different type of data/node blocks in a different logs occasionally.

---
 fs/f2fs/gc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +2 -1
index e1d274c..c2c4ac3 100644
@@ -806,7 +806,8 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
 		f2fs_put_page(sum_page, 0);
 
 		sum = page_address(sum_page);
-		f2fs_bug_on(sbi, type != GET_SUM_TYPE((&sum->footer)));
+		f2fs_bug_on(sbi, IS_DATASEG(type) !=
+				IS_DATASEG(GET_SUM_TYPE((&sum->footer))));
 
 		/*
 		 * this is to avoid deadlock:
Signature · 1 line
2.8.3
author maintainer
#1 lore raw

PATCH 2/2 f2fs: report error for f2fs_parent_dir

If there is no dentry, we can report its error correctly.

---
 fs/f2fs/namei.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
fs/f2fs/namei.c +9 -6
index 78efe00..618829e 100644
@@ -662,10 +662,11 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		goto out;
 
 	if (S_ISDIR(old_inode->i_mode)) {
-		err = -EIO;
 		old_dir_entry = f2fs_parent_dir(old_inode, &old_dir_page);
-		if (!old_dir_entry)
+		if (!old_dir_entry) {
+			err = PTR_ERR(old_dir_page);
 			goto out_old;
+		}
 	}
 
 	if (flags & RENAME_WHITEOUT) {
@@ -838,19 +839,21 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
 	/* prepare for updating ".." directory entry info later */
 	if (old_dir != new_dir) {
 		if (S_ISDIR(old_inode->i_mode)) {
-			err = -EIO;
 			old_dir_entry = f2fs_parent_dir(old_inode,
 							&old_dir_page);
-			if (!old_dir_entry)
+			if (!old_dir_entry) {
+				err = PTR_ERR(old_dir_page);
 				goto out_new;
+			}
 		}
 
 		if (S_ISDIR(new_inode->i_mode)) {
-			err = -EIO;
 			new_dir_entry = f2fs_parent_dir(new_inode,
 							&new_dir_page);
-			if (!new_dir_entry)
+			if (!new_dir_entry) {
+				err = PTR_ERR(new_dir_page);
 				goto out_old_dir;
+			}
 		}
 	}
 
Signature · 1 line
2.8.3
#2 lore raw
In reply to Jaegeuk Kim
Quoted 13 lines · Jaegeuk Kim

We can check data or node types only for gc, since we allocate different type of data/node blocks in a different logs occasionally.

---
  fs/f2fs/gc.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +0 -0
index e1d274c..c2c4ac3 100644

fs/f2fs/gc.c static int do_garbage_collect(struct f2fs_sb_info *sbi, · line 810

Quoted 6 lines
fs/f2fs/gc.c +2 -1
@@ -806,7 +806,8 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
  		f2fs_put_page(sum_page, 0);
 
  		sum = page_address(sum_page);
-		f2fs_bug_on(sbi, type != GET_SUM_TYPE((&sum->footer)));
+		f2fs_bug_on(sbi, IS_DATASEG(type) !=
+				IS_DATASEG(GET_SUM_TYPE((&sum->footer))));

Hi, Kim
type has been transformed into SUM_TYPE_DATA or SUM_TYPE_NODE, so here
no need to do this.

Thanks

Quoted 4 lines
fs/f2fs/gc.c +0 -0
  		/*
  		 * this is to avoid deadlock:
 
author maintainer
#3 lore raw
Quoted 16 lines · He YunLei
Quoted 15 lines · Jaegeuk Kim

We can check data or node types only for gc, since we allocate different type of data/node blocks in a different logs occasionally.

---
  fs/f2fs/gc.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +0 -0
index e1d274c..c2c4ac3 100644
@@ -806,7 +806,8 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
  		f2fs_put_page(sum_page, 0);
 
Quoted 8 lines

fs/f2fs/gc.c static int do_garbage_collect(struct f2fs_sb_info *sbi, · line 810

Quoted 4 lines
fs/f2fs/gc.c +2 -1
  		sum = page_address(sum_page);
-		f2fs_bug_on(sbi, type != GET_SUM_TYPE((&sum->footer)));
+		f2fs_bug_on(sbi, IS_DATASEG(type) !=
+				IS_DATASEG(GET_SUM_TYPE((&sum->footer))));

Hi, Kim
type has been transformed into SUM_TYPE_DATA or SUM_TYPE_NODE, so here
no need to do this.

Oops, right. :)

Thanks,