linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: no compression case for tail-end block in vle_write_indexes()
@ 2021-07-23  3:49 Yue Hu
  2021-07-23  5:02 ` Gao Xiang
  0 siblings, 1 reply; 3+ messages in thread
From: Yue Hu @ 2021-07-23  3:49 UTC (permalink / raw)
  To: linux-erofs, xiang; +Cc: huyue2, yuchao0, zbestahu

From: Yue Hu <huyue2@yulong.com>

Note that count value will be always greater than EROFS_BLKSIZ when
calling erofs_compress_destsize() in vle_compress_one(). So, the d1
always >= 1 for compressed block in vle_write_indexes(). That is to
say tail-end block can't be compressed.

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

diff --git a/lib/compress.c b/lib/compress.c
index af0c720..93fc543 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -73,10 +73,9 @@ static void vle_write_indexes(struct z_erofs_vle_compress_ctx *ctx,
 
 	di.di_clusterofs = cpu_to_le16(ctx->clusterofs);
 
-	/* whether the tail-end (un)compressed block or not */
+	/* whether the tail-end uncompressed block or not */
 	if (!d1) {
-		type = raw ? Z_EROFS_VLE_CLUSTER_TYPE_PLAIN :
-			Z_EROFS_VLE_CLUSTER_TYPE_HEAD;
+		type = Z_EROFS_VLE_CLUSTER_TYPE_PLAIN;
 		advise = cpu_to_le16(type << Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT);
 
 		di.di_advise = advise;
-- 
1.9.1


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

* Re: [PATCH] erofs-utils: no compression case for tail-end block in vle_write_indexes()
  2021-07-23  3:49 [PATCH] erofs-utils: no compression case for tail-end block in vle_write_indexes() Yue Hu
@ 2021-07-23  5:02 ` Gao Xiang
  2021-07-23  6:10   ` Yue Hu
  0 siblings, 1 reply; 3+ messages in thread
From: Gao Xiang @ 2021-07-23  5:02 UTC (permalink / raw)
  To: Yue Hu; +Cc: yuchao0, zbestahu, huyue2, xiang, linux-erofs

Hi Yue,

On Fri, Jul 23, 2021 at 11:49:45AM +0800, Yue Hu wrote:
> From: Yue Hu <huyue2@yulong.com>
> 
> Note that count value will be always greater than EROFS_BLKSIZ when
> calling erofs_compress_destsize() in vle_compress_one(). So, the d1
> always >= 1 for compressed block in vle_write_indexes(). That is to
> say tail-end block can't be compressed.
> 
> Signed-off-by: Yue Hu <huyue2@yulong.com>

I once thought tail end block can be compressed with < EROFS_BLKSIZ as
well (as long as it has some benefit) and also tail-packing inline
like uncompressed cases together after compress extents, so that when we
reading the last compress extent meta block, the tail-packing compressed
data can be loaded together.

Currently, I think we could do that, but could you add some DBG_BUGON
like DBG_BUGON(!raw) right above
"type = Z_EROFS_VLE_CLUSTER_TYPE_PLAIN;" and a TODO comment to mention
tail-packing inline compressed cases is under TODO list? That would be
much better.

Thanks,
Gao Xiang

> ---
>  lib/compress.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/compress.c b/lib/compress.c
> index af0c720..93fc543 100644
> --- a/lib/compress.c
> +++ b/lib/compress.c
> @@ -73,10 +73,9 @@ static void vle_write_indexes(struct z_erofs_vle_compress_ctx *ctx,
>  
>  	di.di_clusterofs = cpu_to_le16(ctx->clusterofs);
>  
> -	/* whether the tail-end (un)compressed block or not */
> +	/* whether the tail-end uncompressed block or not */
>  	if (!d1) {
> -		type = raw ? Z_EROFS_VLE_CLUSTER_TYPE_PLAIN :
> -			Z_EROFS_VLE_CLUSTER_TYPE_HEAD;
> +		type = Z_EROFS_VLE_CLUSTER_TYPE_PLAIN;
>  		advise = cpu_to_le16(type << Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT);
>  
>  		di.di_advise = advise;
> -- 
> 1.9.1

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

* Re: [PATCH] erofs-utils: no compression case for tail-end block in vle_write_indexes()
  2021-07-23  5:02 ` Gao Xiang
@ 2021-07-23  6:10   ` Yue Hu
  0 siblings, 0 replies; 3+ messages in thread
From: Yue Hu @ 2021-07-23  6:10 UTC (permalink / raw)
  To: Gao Xiang; +Cc: yuchao0, zbestahu, huyue2, xiang, linux-erofs

On Fri, 23 Jul 2021 13:02:14 +0800
Gao Xiang <hsiangkao@linux.alibaba.com> wrote:

> Hi Yue,
> 
> On Fri, Jul 23, 2021 at 11:49:45AM +0800, Yue Hu wrote:
> > From: Yue Hu <huyue2@yulong.com>
> > 
> > Note that count value will be always greater than EROFS_BLKSIZ when
> > calling erofs_compress_destsize() in vle_compress_one(). So, the d1
> > always >= 1 for compressed block in vle_write_indexes(). That is to
> > say tail-end block can't be compressed.
> > 
> > Signed-off-by: Yue Hu <huyue2@yulong.com>  
> 
> I once thought tail end block can be compressed with < EROFS_BLKSIZ as
> well (as long as it has some benefit) and also tail-packing inline
> like uncompressed cases together after compress extents, so that when we
> reading the last compress extent meta block, the tail-packing compressed
> data can be loaded together.

Understood.

> 
> Currently, I think we could do that, but could you add some DBG_BUGON
> like DBG_BUGON(!raw) right above
> "type = Z_EROFS_VLE_CLUSTER_TYPE_PLAIN;" and a TODO comment to mention
> tail-packing inline compressed cases is under TODO list? That would be

Will do it in v2.

Thanks.

> much better.
> 
> Thanks,
> Gao Xiang
> 
> > ---
> >  lib/compress.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/lib/compress.c b/lib/compress.c
> > index af0c720..93fc543 100644
> > --- a/lib/compress.c
> > +++ b/lib/compress.c
> > @@ -73,10 +73,9 @@ static void vle_write_indexes(struct z_erofs_vle_compress_ctx *ctx,
> >  
> >  	di.di_clusterofs = cpu_to_le16(ctx->clusterofs);
> >  
> > -	/* whether the tail-end (un)compressed block or not */
> > +	/* whether the tail-end uncompressed block or not */
> >  	if (!d1) {
> > -		type = raw ? Z_EROFS_VLE_CLUSTER_TYPE_PLAIN :
> > -			Z_EROFS_VLE_CLUSTER_TYPE_HEAD;
> > +		type = Z_EROFS_VLE_CLUSTER_TYPE_PLAIN;
> >  		advise = cpu_to_le16(type << Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT);
> >  
> >  		di.di_advise = advise;
> > -- 
> > 1.9.1  


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

end of thread, other threads:[~2021-07-23  6:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23  3:49 [PATCH] erofs-utils: no compression case for tail-end block in vle_write_indexes() Yue Hu
2021-07-23  5:02 ` Gao Xiang
2021-07-23  6:10   ` Yue Hu

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).