]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
f2fs: compress: remove unneeded read when rewrite whole cluster
authorFengnan Chang <changfengnan@vivo.com>
Tue, 22 Jun 2021 11:50:59 +0000 (19:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:40:04 +0000 (14:40 +0200)
[ Upstream commit 7eab7a6968278c735b1ca6387056a408f7960265 ]

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.

Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/data.c

index d27a92a544470880fe9eba3c62b5d3b8717cc58b..04e980c5831959378dac546a075b7feabe488d85 100644 (file)
@@ -3461,6 +3461,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) {