* [f2fs-dev] [PATCH v2] f2fs: compress: avoid unnecessary check in f2fs_prepare_compress_overwrite
@ 2021-04-28 2:49 Fengnan Chang
2021-05-04 15:56 ` Jaegeuk Kim
0 siblings, 1 reply; 2+ messages in thread
From: Fengnan Chang @ 2021-04-28 2:49 UTC (permalink / raw)
To: jaegeuk, chao, linux-f2fs-devel; +Cc: Fengnan Chang
when write compressed file with O_TRUNC, there will be a lot of
unnecessary check valid blocks in f2fs_prepare_compress_overwrite,
especially when written in page size, remove it.
Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
---
fs/f2fs/data.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index cf935474ffba..4cfc0472bc2d 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3270,6 +3270,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
struct page *page = NULL;
pgoff_t index = ((unsigned long long) pos) >> PAGE_SHIFT;
+#ifdef CONFIG_F2FS_FS_COMPRESSION
+ pgoff_t end = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
+#endif
bool need_balance = false, drop_atomic = false;
block_t blkaddr = NULL_ADDR;
int err = 0;
@@ -3306,6 +3309,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
*fsdata = NULL;
+ if (index >= end)
+ goto repeat;
+
ret = f2fs_prepare_compress_overwrite(inode, pagep,
index, fsdata);
if (ret < 0) {
--
2.29.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH v2] f2fs: compress: avoid unnecessary check in f2fs_prepare_compress_overwrite
2021-04-28 2:49 [f2fs-dev] [PATCH v2] f2fs: compress: avoid unnecessary check in f2fs_prepare_compress_overwrite Fengnan Chang
@ 2021-05-04 15:56 ` Jaegeuk Kim
0 siblings, 0 replies; 2+ messages in thread
From: Jaegeuk Kim @ 2021-05-04 15:56 UTC (permalink / raw)
To: Fengnan Chang; +Cc: linux-f2fs-devel
On 04/28, Fengnan Chang wrote:
> when write compressed file with O_TRUNC, there will be a lot of
> unnecessary check valid blocks in f2fs_prepare_compress_overwrite,
> especially when written in page size, remove it.
>
> Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
> ---
> fs/f2fs/data.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index cf935474ffba..4cfc0472bc2d 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -3270,6 +3270,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
> struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> struct page *page = NULL;
> pgoff_t index = ((unsigned long long) pos) >> PAGE_SHIFT;
> +#ifdef CONFIG_F2FS_FS_COMPRESSION
> + pgoff_t end = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
Need to move this below?
> +#endif
> bool need_balance = false, drop_atomic = false;
> block_t blkaddr = NULL_ADDR;
> int err = 0;
> @@ -3306,6 +3309,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
>
> *fsdata = NULL;
>
> + if (index >= end)
> + goto repeat;
> +
> ret = f2fs_prepare_compress_overwrite(inode, pagep,
> index, fsdata);
> if (ret < 0) {
> --
> 2.29.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-04 15:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 2:49 [f2fs-dev] [PATCH v2] f2fs: compress: avoid unnecessary check in f2fs_prepare_compress_overwrite Fengnan Chang
2021-05-04 15:56 ` Jaegeuk Kim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.