f2fs: compress: remove unneeded read when rewrite whole cluster
PATCH 1/1 f2fs: compress: remove unneeded read when rewrite whole cluster
For now, when overwrite compressed file, we need read old data to page cache first and update pages.
But when we need overwrite whole cluster, we don't need old data anymore.
So, remove read data process in this case, I have made
some simple changes to test, tests have shown that this can lead to significant performance improvements, the speed of sequential write up to 2x.
This modificy just check wheather the whole page was dirty, because when writeback cache f2fs_prepare_compress_overwrite will be called again. when update whole cluster, cc in prepare_compress_overwrite will be empty, so will not read old data.
when only update one page in cluster, cc in prepae_compress_overwrite will not be empty, so will read old data.
--- fs/f2fs/data.c | 3 +++ 1 file changed, 3 insertions(+)
fs/f2fs/data.c +3 -0
@@ -3307,6 +3307,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 ) {
Signature · 8 lines
2.29.0 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Hi chao & jaegeuk:
Any comments about this?
Thanks.
Quoted 28 lines · Fengnan Chang
For now, when overwrite compressed file, we need read old data to page cache first and update pages.
But when we need overwrite whole cluster, we don't need old data anymore.
So, remove read data process in this case, I have made
some simple changes to test, tests have shown that this can lead to significant performance improvements, the speed of sequential write up to 2x.This modificy just check wheather the whole page was dirty, because when writeback cache
f2fs_prepare_compress_overwritewill be called again. when update whole cluster, cc inprepare_compress_overwritewill be empty, so will not read old data.
when only update one page in cluster, cc inprepae_compress_overwritewill not be empty, so will read old data.Signed-off-by Fengnan Chang <[email protected]>Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/data.c | 3 +++ 1 file changed, 3 insertions(+)fs/f2fs/data.c +0
-0
fs/f2fs/data.c static int f2fs_write_begin(struct file *file, struct address_space *mapping, · line 3315
Quoted 9 lines
fs/f2fs/data.c +3
-0@@ -3307,6 +3307,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 ) {
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 10 lines · Fengnan Chang
Hi chao & jaegeuk:
Any comments about this?Thanks.
Quoted 4 lines · Fengnan Chang
For now, when overwrite compressed file, we need read old data to page cache first and update pages.
But when we need overwrite whole cluster, we don't need old data anymore.
Commit message needs to be updated as:
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.
Thanks,
Quoted 26 lines
Quoted 26 lines
So, remove read data process in this case, I have made some simple changes to test, tests have shown that this can lead to significant performance improvements, the speed of sequential write up to 2x.
This modificy just check wheather the whole page was dirty, because when writeback cache
f2fs_prepare_compress_overwritewill be called again. when update whole cluster, cc inprepare_compress_overwritewill be empty, so will not read old data.
when only update one page in cluster, cc inprepae_compress_overwritewill not be empty, so will read old data.Signed-off-by Fengnan Chang <[email protected]>Signed-off-by Chao Yu <[email protected]>---
fs/f2fs/data.c| 3 +++1 file changed, 3 insertions(+)fs/f2fs/data.c +0
-0@@ -3307,6 +3307,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, *fsdata = NULL;
Quoted 7 lines
fs/f2fs/data.c static int f2fs_write_begin(struct file *file, struct address_space *mapping, · line 3315
Quoted 7 lines
fs/f2fs/data.c +3
-0+ if (len == PAGE_SIZE) + goto repeat; + ret = f2fs_prepare_compress_overwrite(inode, pagep, index, fsdata); if (ret < 0) {
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel