Skip to contentSkip to conversation

f2fs: restrict write IO alignment condition

PATCH Superseded Chao Yu 2 participants 3 messages Mar 10, 2017 – Mar 13, 2017 F2FS file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 f2fs: restrict write IO alignment condition

We should only align start offset of bio with defined IO_SIZE for below conditions:
a. write IOs
b. Out-place-update
c. non-meta page

---
 fs/f2fs/data.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/data.c +3 -1
index 1375fef11146..3e6b0cc5e36a 100644
@@ -395,7 +395,9 @@ int f2fs_submit_page_mbio(struct f2fs_io_info *fio)
 		__submit_merged_bio(io);
 alloc_new:
 	if (io->bio == NULL) {
-		if ((fio->type == DATA || fio->type == NODE) &&
+		if (!is_read && (fio->type == DATA || fio->type == NODE) &&
+				bio_page->mapping != META_MAPPING(sbi) &&
+				fio->new_blkaddr != fio->old_blkaddr &&
 				fio->new_blkaddr & F2FS_IO_SIZE_MASK(sbi)) {
 			err = -EAGAIN;
 			if (!is_read)
Signature · 9 lines
2.8.2.295.g3f1c1d0


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
maintainer
#1 lore raw
Quoted 16 lines · Chao Yu

We should only align start offset of bio with defined IO_SIZE for below conditions:
a. write IOs
b. Out-place-update
c. non-meta page

---
 fs/f2fs/data.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/data.c +0 -0
index 1375fef11146..3e6b0cc5e36a 100644

fs/f2fs/data.c int f2fs_submit_page_mbio(struct f2fs_io_info *fio) · line 399

Quoted 6 lines
fs/f2fs/data.c +2 -1
@@ -395,7 +395,9 @@ int f2fs_submit_page_mbio(struct f2fs_io_info *fio)
 		__submit_merged_bio(io);
 alloc_new:
 	if (io->bio == NULL) {
-		if ((fio->type == DATA || fio->type == NODE) &&
+		if (!is_read && (fio->type == DATA || fio->type == NODE) &&
+				bio_page->mapping != META_MAPPING(sbi) &&

BUG_ON(), since it's covered by fio->type == DATA || fio->type == NODE.

fs/f2fs/data.c int f2fs_submit_page_mbio(struct f2fs_io_info *fio) · line 400

Quoted 1 line
fs/f2fs/data.c +1 -0
+				fio->new_blkaddr != fio->old_blkaddr &&

BUG_ON(), since LFS mount option doesn't allow any in-place updates.

fs/f2fs/data.c int f2fs_submit_page_mbio(struct f2fs_io_info *fio) · line 401

Quoted 1 line
fs/f2fs/data.c +0 -0
 				fio->new_blkaddr & F2FS_IO_SIZE_MASK(sbi)) {

So, is_read is worth to check?

Thanks,

Quoted 4 lines
fs/f2fs/data.c +0 -0
 			err = -EAGAIN;
 			if (!is_read)
Signature · 1 line
2.8.2.295.g3f1c1d0

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition.
http://sdm.link/oxford

author
#2 lore raw
Quoted 12 lines · Jaegeuk Kim
Quoted 11 lines · Chao Yu

We should only align start offset of bio with defined IO_SIZE for below conditions:
a. write IOs
b. Out-place-update
c. non-meta page

---
 fs/f2fs/data.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 13 lines

fs/f2fs/data.c int f2fs_submit_page_mbio(struct f2fs_io_info *fio) · line 399

Quoted 11 lines
fs/f2fs/data.c +2 -1
index 1375fef11146..3e6b0cc5e36a 100644
@@ -395,7 +395,9 @@ int f2fs_submit_page_mbio(struct f2fs_io_info *fio)
 		__submit_merged_bio(io);
 alloc_new:
 	if (io->bio == NULL) {
-		if ((fio->type == DATA || fio->type == NODE) &&
+		if (!is_read && (fio->type == DATA || fio->type == NODE) &&
+				bio_page->mapping != META_MAPPING(sbi) &&

BUG_ON(), since it's covered by fio->type == DATA || fio->type == NODE.

Oh, the condition I added here is wrong, since move_encrypted_block will add a meta page into DATA type bio cache, also we can not add a BUG_ON here.

Quoted 4 lines

fs/f2fs/data.c int f2fs_submit_page_mbio(struct f2fs_io_info *fio) · line 400

Quoted 2 lines
fs/f2fs/data.c +1 -0
+				fio->new_blkaddr != fio->old_blkaddr &&

BUG_ON(), since LFS mount option doesn't allow any in-place updates.

You're right. :)

Quoted 4 lines

fs/f2fs/data.c int f2fs_submit_page_mbio(struct f2fs_io_info *fio) · line 401

Quoted 2 lines
fs/f2fs/data.c +0 -0
 				fio->new_blkaddr & F2FS_IO_SIZE_MASK(sbi)) {

So, is_read is worth to check?

Yes.

I will fix them and resend v2.

Thanks,

Quoted 10 lines

Thanks,

Quoted 4 lines
fs/f2fs/data.c +0 -0
 			err = -EAGAIN;
 			if (!is_read)
Signature · 1 line
2.8.2.295.g3f1c1d0

.

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition.
http://sdm.link/oxford