Skip to contentSkip to conversation

f2fs: skip read if page has been uptodate

PATCH In review Yunlei He 2 participants 3 messages Dec 27, 2016 F2FS file system

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH 1/1 f2fs: skip read if page has been uptodate

This patch add a judgement before read, if the page has been uptodate, move the block directly.

---
 fs/f2fs/gc.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/f2fs/gc.c +5 -0
index 88bfc3d..40776b4 100644
@@ -602,6 +602,9 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,
 		goto recover_block;
 	}
 
+	if (PageUptodate(fio.encrypted_page))
+		goto skip_read;
+
 	err = f2fs_submit_page_bio(&fio);
 	if (err)
 		goto put_page_out;
@@ -613,11 +616,13 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,
 		err = -EIO;
 		goto put_page_out;
 	}
+
 	if (unlikely(!PageUptodate(fio.encrypted_page))) {
 		err = -EIO;
 		goto put_page_out;
 	}
 
+skip_read:
 	set_page_dirty(fio.encrypted_page);
 	f2fs_wait_on_page_writeback(fio.encrypted_page, DATA, true);
 	if (clear_page_dirty_for_io(fio.encrypted_page))
Signature · 6 lines
2.10.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
#1 lore raw
Quoted 13 lines · Yunlei He

This patch add a judgement before read, if the page has been uptodate, move the block directly.

---
 fs/f2fs/gc.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/f2fs/gc.c +0 -0
index 88bfc3d..40776b4 100644

fs/f2fs/gc.c static void move_encrypted_block(struct inode *inode, block_t bidx, · line 605

Quoted 4 lines
fs/f2fs/gc.c +1 -0
@@ -602,6 +602,9 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,
 		goto recover_block;
 	}
 
+	if (PageUptodate(fio.encrypted_page))

Seems we can't guarantee that the new allocated block address isn't been used by another GCed encrypted page last time with SSR mode, so the updated encrypted_page may contain other file's data?

Thanks,

Quoted 10 lines
fs/f2fs/gc.c +2 -0
+		goto skip_read;
+
 	err = f2fs_submit_page_bio(&fio);
 	if (err)
 		goto put_page_out;
@@ -613,11 +616,13 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,
 		err = -EIO;
 		goto put_page_out;
 	}

fs/f2fs/gc.c static void move_encrypted_block(struct inode *inode, block_t bidx, · line 628

Quoted 10 lines
fs/f2fs/gc.c +2 -0
+
 	if (unlikely(!PageUptodate(fio.encrypted_page))) {
 		err = -EIO;
 		goto put_page_out;
 	}
 
+skip_read:
 	set_page_dirty(fio.encrypted_page);
 	f2fs_wait_on_page_writeback(fio.encrypted_page, DATA, true);
 	if (clear_page_dirty_for_io(fio.encrypted_page))

------------------------------------------------------------------------------
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 17 lines · Chao Yu
Quoted 16 lines · Yunlei He

This patch add a judgement before read, if the page has been uptodate, move the block directly.

---
 fs/f2fs/gc.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/f2fs/gc.c +0 -0
index 88bfc3d..40776b4 100644
@@ -602,6 +602,9 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,
 		goto recover_block;
 	}
 
Quoted 5 lines

fs/f2fs/gc.c static void move_encrypted_block(struct inode *inode, block_t bidx, · line 605

Quoted 1 line
fs/f2fs/gc.c +1 -0
+	if (PageUptodate(fio.encrypted_page))

Seems we can't guarantee that the new allocated block address isn't been used by another GCed encrypted page last time with SSR mode, so the updated encrypted_page may contain other file's data?

Yes, you are right!

Thanks,

Quoted 18 lines

Thanks,

Quoted 15 lines
fs/f2fs/gc.c +3 -0
+		goto skip_read;
+
 	err = f2fs_submit_page_bio(&fio);
 	if (err)
 		goto put_page_out;
@@ -613,11 +616,13 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,
 		err = -EIO;
 		goto put_page_out;
 	}
+
 	if (unlikely(!PageUptodate(fio.encrypted_page))) {
 		err = -EIO;
 		goto put_page_out;
 	}
 
Quoted 9 lines

fs/f2fs/gc.c static void move_encrypted_block(struct inode *inode, block_t bidx, · line 628

Quoted 5 lines
fs/f2fs/gc.c +1 -0
+skip_read:
 	set_page_dirty(fio.encrypted_page);
 	f2fs_wait_on_page_writeback(fio.encrypted_page, DATA, true);
 	if (clear_page_dirty_for_io(fio.encrypted_page))

.

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