Skip to contentSkip to conversation

f2fs: compress: remove unneeded read when rewrite whole cluster

PATCH In review Fengnan Chang 3 participants 7 messages Jun 22, 2021 – Jul 19, 2021 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 f2fs: compress: remove unneeded read when rewrite whole cluster

when we overwrite the whole page in cluster, we don't need read original data before write, because after write_end(), writepages() can help to load left data in that cluster.

---
 fs/f2fs/data.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/data.c +3 -0
index 3a01a1b50104..2aeb1196cd5f 100644
@@ -3328,6 +3328,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
 
 		*fsdata = NULL;
 
+		if (len == PAGE_SIZE)
+			goto repeat;
+
 		ret = f2fs_prepare_compress_overwrite(inode, pagep,
 							index, fsdata);
 		if (ret < 0) {

--
2.29.0

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#1 lore raw

Hi Jaegeuk:

FYI, I have run xfstest fast test on linux-5.13.0-rc1 + patch, no
new failure case.

Thanks.

Quoted 26 lines · Fengnan Chang

when we overwrite the whole page in cluster, we don't need read original data before write, because after write_end(), writepages() can help to load left data in that cluster.

---
  fs/f2fs/data.c | 3 +++
  1 file changed, 3 insertions(+)
fs/f2fs/data.c +3 -1
index 3a01a1b50104..2aeb1196cd5f 100644
@@ -3328,6 +3328,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
 
  		*fsdata = NULL;
 
+		if (len == PAGE_SIZE)
+			goto repeat;
+
  		ret = f2fs_prepare_compress_overwrite(inode, pagep,
  							index, fsdata);
  		if (ret < 0) {
--
Quoted 3 lines

2.29.0

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#2 lore raw
In reply to Fengnan Chang

Hi Jaegeuk:
Any comments about this version?

Quoted 26 lines · Fengnan Chang

when we overwrite the whole page in cluster, we don't need read original data before write, because after write_end(), writepages() can help to load left data in that cluster.

---
  fs/f2fs/data.c | 3 +++
  1 file changed, 3 insertions(+)
fs/f2fs/data.c +3 -1
index 3a01a1b50104..2aeb1196cd5f 100644
@@ -3328,6 +3328,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
 
  		*fsdata = NULL;
 
+		if (len == PAGE_SIZE)
+			goto repeat;
+
  		ret = f2fs_prepare_compress_overwrite(inode, pagep,
  							index, fsdata);
  		if (ret < 0) {
--
Quoted 3 lines

2.29.0

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#3 lore raw
Quoted 7 lines · Fengnan Chang

Hi Jaegeuk:
Any comments about this version?

Quoted 3 lines · Fengnan Chang

when we overwrite the whole page in cluster, we don't need read original data before write, because after write_end(), writepages() can help to load left data in that cluster.

Jaegeuk,

Let's queue this in dev-test for testing?

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#4 lore raw
Quoted 4 lines · Chao Yu
Quoted 3 lines · Fengnan Chang

Hi Jaegeuk:
Any comments about this version?

Quoted 8 lines
Quoted 4 lines · Fengnan Chang
Quoted 3 lines

when we overwrite the whole page in cluster, we don't need read original data before write, because after write_end(), writepages() can help to load left data in that cluster.

Jaegeuk,

Let's queue this in dev-test for testing?

A bit worry about unknown corner cases tho, Chao, could you please test as well?

Quoted 2 lines

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#5 lore raw
Quoted 10 lines · Jaegeuk Kim
Quoted 9 lines · Chao Yu
Quoted 7 lines · Fengnan Chang

Hi Jaegeuk:
Any comments about this version?

Quoted 3 lines · Fengnan Chang

when we overwrite the whole page in cluster, we don't need read original data before write, because after write_end(), writepages() can help to load left data in that cluster.

Quoted 6 lines
Quoted 3 lines

Jaegeuk,

Let's queue this in dev-test for testing?

A bit worry about unknown corner cases tho, Chao, could you please test as well?

Yup, I just plan to do this, may focus on data consistence.

Thanks,

Quoted 3 lines
Quoted 3 lines

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#6 lore raw
Quoted 11 lines · Chao Yu
Quoted 10 lines · Jaegeuk Kim
Quoted 9 lines · Chao Yu
Quoted 7 lines · Fengnan Chang

Hi Jaegeuk:
Any comments about this version?

Quoted 3 lines · Fengnan Chang

when we overwrite the whole page in cluster, we don't need read original data before write, because after write_end(), writepages() can help to load left data in that cluster.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Jaegeuk,

Let's queue this in dev-test for testing?

A bit worry about unknown corner cases tho, Chao, could you please test as well?

Yup, I just plan to do this, may focus on data consistence.

I have time to check the data consistence for this change, I've ran a customized script (overwrite partial blocks of compressed cluster with original data, sync, drop cache and compare the data), there is no data corruption till now.

Thanks,

Quoted 5 lines

Thanks,

Quoted 2 lines
Quoted 2 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel