linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: add clusterofs zero check to write_uncompressed_extent()
@ 2021-08-17  4:06 Yue Hu
  2021-08-17 12:18 ` Gao Xiang
  2021-08-17 13:13 ` Gao Xiang
  0 siblings, 2 replies; 7+ messages in thread
From: Yue Hu @ 2021-08-17  4:06 UTC (permalink / raw)
  To: linux-erofs, xiang; +Cc: huyue2, zbestahu

From: Yue Hu <huyue2@yulong.com>

No need to reset clusterofs to 0 if it's already 0. Acturally, we also
observed that case frequently. Let's avoid it.

Signed-off-by: Yue Hu <huyue2@yulong.com>
---
 lib/compress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/compress.c b/lib/compress.c
index 40723a1..a8ebbc1 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -130,7 +130,7 @@ static int write_uncompressed_extent(struct z_erofs_vle_compress_ctx *ctx,
 	unsigned int count;
 
 	/* reset clusterofs to 0 if permitted */
-	if (!erofs_sb_has_lz4_0padding() &&
+	if (!erofs_sb_has_lz4_0padding() && ctx->clusterofs &&
 	    ctx->head >= ctx->clusterofs) {
 		ctx->head -= ctx->clusterofs;
 		*len += ctx->clusterofs;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-18 14:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17  4:06 [PATCH] erofs-utils: add clusterofs zero check to write_uncompressed_extent() Yue Hu
2021-08-17 12:18 ` Gao Xiang
2021-08-17 13:13 ` Gao Xiang
2021-08-17 14:10   ` Yue Hu
2021-08-17 14:38     ` Gao Xiang
2021-08-18  2:21       ` Yue Hu
2021-08-18 14:06         ` Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).