Skip to contentSkip to conversation

f2fs: update inode info to inode page for new file

PATCH In review Yunlei He 3 participants 7 messages Jan 3, 2018 – Jan 4, 2018 F2FS file system

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH 1/1 f2fs: update inode info to inode page for new file

			|
			| 1. creat a new file A ,(with dirty inode
			|    && dirty inode page && xattr info)
			| 2. backgroud wb write back file A inode

last checkpoint | page (without update from inode cache)
| 3. fsync file A, write back inode page of
| file A with inode cache info
| 4. sudden power off before new checkpoint

In this case, recovery process will try to recover a zero inode page. Inline xattr flag of file A will be miss and xattr info will be taken as blkaddr index.

---
 fs/f2fs/dir.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/dir.c +2 -0
index 724304d..d04dcac 100644
@@ -427,6 +427,8 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
 			remove_orphan_inode(F2FS_I_SB(dir), inode->i_ino);
 		f2fs_i_links_write(inode, true);
 	}
+
+	update_inode(inode, page);
 	return page;
 
 put_error:
Signature · 6 lines
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
maintainer
#1 lore raw
Quoted 5 lines · Yunlei He
			|
			| 1. creat a new file A ,(with dirty inode
			|    && dirty inode page && xattr info)
			| 2. backgroud wb write back file A inode

last checkpoint | page (without update from inode cache)

f2fs_sync_inode_meta() would flush dirty inode cache, no?

Quoted 28 lines
			| 3. fsync file A, write back inode page of
			|    file A with inode cache info
			| 4. sudden power off before new checkpoint

In this case, recovery process will try to recover a zero inode page. Inline xattr flag of file A will be miss and xattr info will be taken as blkaddr index.

---
 fs/f2fs/dir.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/dir.c +2 -0
index 724304d..d04dcac 100644
@@ -427,6 +427,8 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
 			remove_orphan_inode(F2FS_I_SB(dir), inode->i_ino);
 		f2fs_i_links_write(inode, true);
 	}
+
+	update_inode(inode, page);
 	return page;
 
 put_error:
Signature · 1 line
1.9.1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

author
#2 lore raw
Quoted 9 lines

-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Thursday, January 04, 2018 5:44 AM
To: heyunlei
Cc: Yuchao (T); [email protected]; Wangbintian; Jianing (Euler)
Subject: Re: [f2fs-dev][PATCH] f2fs: update inode info to inode page for new file

Quoted 8 lines
Quoted 5 lines · Yunlei He
			|
			| 1. creat a new file A ,(with dirty inode
			|    && dirty inode page && xattr info)
			| 2. backgroud wb write back file A inode

last checkpoint | page (without update from inode cache)

f2fs_sync_inode_meta() would flush dirty inode cache, no?

f2fs_sync_inode_meta() would flush dirty inode cache in write new checkpoint. But here bdi flusher would write back zero inode page without update from inode cache.

Thanks.

Quoted 27 lines
Quoted 27 lines

			| 3. fsync file A, write back inode page of
			|    file A with inode cache info
			| 4. sudden power off before new checkpoint

In this case, recovery process will try to recover a zero inode page. Inline xattr flag of file A will be miss and xattr info will be taken as blkaddr index.

---
 fs/f2fs/dir.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/dir.c +2 -0
index 724304d..d04dcac 100644
@@ -427,6 +427,8 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
 			remove_orphan_inode(F2FS_I_SB(dir), inode->i_ino);
 		f2fs_i_links_write(inode, true);
 	}
+
+	update_inode(inode, page);
 	return page;
 
Quoted 3 lines
Quoted 3 lines
fs/f2fs/dir.c +0 -1
 put_error:
--

1.9.1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

#3 lore raw
In reply to Yunlei He
Quoted 23 lines · Yunlei He
			|
			| 1. creat a new file A ,(with dirty inode
			|    && dirty inode page && xattr info)
			| 2. backgroud wb write back file A inode

last checkpoint | page (without update from inode cache)
| 3. fsync file A, write back inode page of
| file A with inode cache info
| 4. sudden power off before new checkpoint

In this case, recovery process will try to recover a zero inode page. Inline xattr flag of file A will be miss and xattr info will be taken as blkaddr index.

---
 fs/f2fs/dir.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/dir.c +0 -0
index 724304d..d04dcac 100644

fs/f2fs/dir.c struct page *init_inode_metadata(struct inode *inode, struct inode *dir, · line 431

Quoted 5 lines
fs/f2fs/dir.c +2 -0
@@ -427,6 +427,8 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
 			remove_orphan_inode(F2FS_I_SB(dir), inode->i_ino);
 		f2fs_i_links_write(inode, true);
 	}
+
+	update_inode(inode, page);

That would cause memory copy overhead, how about always keeping consistent in-memory inode meta info with the data in recovering inode block as below:

recover_inline_xattr()

	if (ri->i_inline & F2FS_INLINE_XATTR) {
		set_inode_flag(inode, FI_INLINE_XATTR);
	} else {
		clear_inode_flag(inode, FI_INLINE_XATTR);
		goto update_inode;
	}

Thanks,

fs/f2fs/dir.c struct page *init_inode_metadata(struct inode *inode, struct inode *dir, · line 434

Quoted 4 lines
fs/f2fs/dir.c +0 -0
 	return page;
 
 put_error:

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

author
#4 lore raw
Quoted 44 lines

-----Original Message-----
From: Yuchao (T)
Sent: Thursday, January 04, 2018 11:02 AM
To: heyunlei; [email protected]; [email protected]
Cc: Wangbintian; Jianing (Euler)
Subject: Re: [f2fs-dev][PATCH] f2fs: update inode info to inode page for new file

Quoted 23 lines · Yunlei He
			|
			| 1. creat a new file A ,(with dirty inode
			|    && dirty inode page && xattr info)
			| 2. backgroud wb write back file A inode

last checkpoint | page (without update from inode cache)
| 3. fsync file A, write back inode page of
| file A with inode cache info
| 4. sudden power off before new checkpoint

In this case, recovery process will try to recover a zero inode page. Inline xattr flag of file A will be miss and xattr info will be taken as blkaddr index.

---
 fs/f2fs/dir.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/dir.c +0 -0
index 724304d..d04dcac 100644

fs/f2fs/dir.c struct page *init_inode_metadata(struct inode *inode, struct inode *dir, · line 431

Quoted 5 lines
fs/f2fs/dir.c +2 -0
@@ -427,6 +427,8 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
 			remove_orphan_inode(F2FS_I_SB(dir), inode->i_ino);
 		f2fs_i_links_write(inode, true);
 	}
+
+	update_inode(inode, page);

That would cause memory copy overhead, how about always keeping consistent in-memory inode meta info with the data in recovering inode block as below:

recover_inline_xattr()

Quoted 8 lines
	if (ri->i_inline & F2FS_INLINE_XATTR) {
		set_inode_flag(inode, FI_INLINE_XATTR);
	} else {
		clear_inode_flag(inode, FI_INLINE_XATTR);
		goto update_inode;
	}

Thanks,

Okay, My f2fs module is not support flexible inline xattr size, this change is enough for this problem.

Thanks.

Quoted 5 lines

fs/f2fs/dir.c struct page *init_inode_metadata(struct inode *inode, struct inode *dir, · line 434

Quoted 5 lines
fs/f2fs/dir.c +0 -0
 	return page;
 
 put_error:

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

maintainer
#5 lore raw
Quoted 42 lines · heyunlei
Quoted 42 lines

-----Original Message-----
From: Yuchao (T)
Sent: Thursday, January 04, 2018 11:02 AM
To: heyunlei; [email protected]; [email protected]
Cc: Wangbintian; Jianing (Euler)
Subject: Re: [f2fs-dev][PATCH] f2fs: update inode info to inode page for new file

Quoted 23 lines · Yunlei He
			|
			| 1. creat a new file A ,(with dirty inode
			|    && dirty inode page && xattr info)
			| 2. backgroud wb write back file A inode

last checkpoint | page (without update from inode cache)
| 3. fsync file A, write back inode page of
| file A with inode cache info
| 4. sudden power off before new checkpoint

In this case, recovery process will try to recover a zero inode page. Inline xattr flag of file A will be miss and xattr info will be taken as blkaddr index.

---
 fs/f2fs/dir.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/dir.c +0 -0
index 724304d..d04dcac 100644

fs/f2fs/dir.c struct page *init_inode_metadata(struct inode *inode, struct inode *dir, · line 431

Quoted 5 lines
fs/f2fs/dir.c +2 -0
@@ -427,6 +427,8 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
 			remove_orphan_inode(F2FS_I_SB(dir), inode->i_ino);
 		f2fs_i_links_write(inode, true);
 	}
+
+	update_inode(inode, page);

That would cause memory copy overhead, how about always keeping consistent in-memory inode meta info with the data in recovering inode block as below:

Quoted 8 lines
Quoted 8 lines

recover_inline_xattr()

	if (ri->i_inline & F2FS_INLINE_XATTR) {
		set_inode_flag(inode, FI_INLINE_XATTR);
	} else {
		clear_inode_flag(inode, FI_INLINE_XATTR);
		goto update_inode;
	}

Ah I see. That doesn't represent parallel things. :P

Quoted 5 lines
Quoted 2 lines

Thanks,

Okay, My f2fs module is not support flexible inline xattr size, this change is enough for this problem.

Let me merge this patch with this.

Thanks,

Quoted 8 lines

Thanks.

Quoted 5 lines
Quoted 5 lines
fs/f2fs/dir.c +0 -0
 	return page;
 
 put_error:

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

Reviewed-by
#6 lore raw
Quoted 45 lines · Jaegeuk Kim
Quoted 44 lines · heyunlei
Quoted 44 lines

-----Original Message-----
From: Yuchao (T)
Sent: Thursday, January 04, 2018 11:02 AM
To: heyunlei; [email protected]; [email protected]
Cc: Wangbintian; Jianing (Euler)
Subject: Re: [f2fs-dev][PATCH] f2fs: update inode info to inode page for new file

Quoted 23 lines · Yunlei He
			|
			| 1. creat a new file A ,(with dirty inode
			|    && dirty inode page && xattr info)
			| 2. backgroud wb write back file A inode

last checkpoint | page (without update from inode cache)
| 3. fsync file A, write back inode page of
| file A with inode cache info
| 4. sudden power off before new checkpoint

In this case, recovery process will try to recover a zero inode page. Inline xattr flag of file A will be miss and xattr info will be taken as blkaddr index.

---
 fs/f2fs/dir.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/dir.c +0 -0
index 724304d..d04dcac 100644

fs/f2fs/dir.c struct page *init_inode_metadata(struct inode *inode, struct inode *dir, · line 431

Quoted 5 lines
fs/f2fs/dir.c +2 -0
@@ -427,6 +427,8 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
 			remove_orphan_inode(F2FS_I_SB(dir), inode->i_ino);
 		f2fs_i_links_write(inode, true);
 	}
+
+	update_inode(inode, page);

That would cause memory copy overhead, how about always keeping consistent in-memory inode meta info with the data in recovering inode block as below:

recover_inline_xattr()

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
	if (ri->i_inline & F2FS_INLINE_XATTR) {
		set_inode_flag(inode, FI_INLINE_XATTR);
	} else {
		clear_inode_flag(inode, FI_INLINE_XATTR);
		goto update_inode;
	}

Ah I see. That doesn't represent parallel things. :P

Please add, ;)

Thanks,

Quoted 15 lines
Quoted 6 lines
Quoted 3 lines

Thanks,

Okay, My f2fs module is not support flexible inline xattr size, this change is enough for this problem.

Let me merge this patch with this.

Thanks,

Quoted 4 lines

Thanks.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

fs/f2fs/dir.c struct page *init_inode_metadata(struct inode *inode, struct inode *dir, · line 434

Quoted 4 lines
fs/f2fs/dir.c +0 -0
 	return page;
 
 put_error:

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot