All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] erofs-utils: don't hard code constants
@ 2022-01-31 18:43 Kelvin Zhang via Linux-erofs
  2022-02-01  2:51 ` Gao Xiang
  0 siblings, 1 reply; 4+ messages in thread
From: Kelvin Zhang via Linux-erofs @ 2022-01-31 18:43 UTC (permalink / raw)
  To: linux-erofs mailing list, Miao Xie, Fang Wei; +Cc: Kelvin Zhang

Use sizeof(z_erofs_vle_decompressed_index) to compute legacy index count

Test: th
Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>
---
 lib/compress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/compress.c b/lib/compress.c
index 98be7a2..c520a1e 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -359,7 +359,7 @@ int z_erofs_convert_to_compacted_format(struct erofs_inode *inode,
 							   inode->xattr_isize) +
 				  sizeof(struct z_erofs_map_header);
 	const unsigned int totalidx = (legacymetasize -
-				       Z_EROFS_LEGACY_MAP_HEADER_SIZE) / 8;
+				       Z_EROFS_LEGACY_MAP_HEADER_SIZE) / sizeof(struct z_erofs_vle_decompressed_index);
 	const unsigned int logical_clusterbits = inode->z_logical_clusterbits;
 	u8 *out, *in;
 	struct z_erofs_compressindex_vec cv[16];
-- 
2.35.0.rc2.247.g8bbb082509-goog


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

* Re: [PATCH v1] erofs-utils: don't hard code constants
  2022-01-31 18:43 [PATCH v1] erofs-utils: don't hard code constants Kelvin Zhang via Linux-erofs
@ 2022-02-01  2:51 ` Gao Xiang
  2022-02-01 22:44   ` Kelvin Zhang via Linux-erofs
  0 siblings, 1 reply; 4+ messages in thread
From: Gao Xiang @ 2022-02-01  2:51 UTC (permalink / raw)
  To: Kelvin Zhang; +Cc: Miao Xie, linux-erofs mailing list

On Mon, Jan 31, 2022 at 10:43:27AM -0800, Kelvin Zhang wrote:
> Use sizeof(z_erofs_vle_decompressed_index) to compute legacy index count
> 
> Test: th
> Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>
> ---
>  lib/compress.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/compress.c b/lib/compress.c
> index 98be7a2..c520a1e 100644
> --- a/lib/compress.c
> +++ b/lib/compress.c
> @@ -359,7 +359,7 @@ int z_erofs_convert_to_compacted_format(struct erofs_inode *inode,
>  							   inode->xattr_isize) +
>  				  sizeof(struct z_erofs_map_header);
>  	const unsigned int totalidx = (legacymetasize -
> -				       Z_EROFS_LEGACY_MAP_HEADER_SIZE) / 8;
> +				       Z_EROFS_LEGACY_MAP_HEADER_SIZE) / sizeof(struct z_erofs_vle_decompressed_index);

It would be better to keep 80-char limit rule.

Thanks, applied.

Happy chinese new year!
Gao Xiang

>  	const unsigned int logical_clusterbits = inode->z_logical_clusterbits;
>  	u8 *out, *in;
>  	struct z_erofs_compressindex_vec cv[16];
> -- 
> 2.35.0.rc2.247.g8bbb082509-goog

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

* Re: [PATCH v1] erofs-utils: don't hard code constants
  2022-02-01  2:51 ` Gao Xiang
@ 2022-02-01 22:44   ` Kelvin Zhang via Linux-erofs
  2022-02-02  2:19     ` Gao Xiang
  0 siblings, 1 reply; 4+ messages in thread
From: Kelvin Zhang via Linux-erofs @ 2022-02-01 22:44 UTC (permalink / raw)
  To: Gao Xiang; +Cc: Miao Xie, linux-erofs mailing list

Thanks Gao! I'm reading compressed indices code recently. Is there any
notes/sketches/design docs you can share with me regarding that?

Happy Chinese New Year!

On Mon, Jan 31, 2022 at 6:51 PM Gao Xiang <hsiangkao@linux.alibaba.com> wrote:
>
> On Mon, Jan 31, 2022 at 10:43:27AM -0800, Kelvin Zhang wrote:
> > Use sizeof(z_erofs_vle_decompressed_index) to compute legacy index count
> >
> > Test: th
> > Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>
> > ---
> >  lib/compress.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/compress.c b/lib/compress.c
> > index 98be7a2..c520a1e 100644
> > --- a/lib/compress.c
> > +++ b/lib/compress.c
> > @@ -359,7 +359,7 @@ int z_erofs_convert_to_compacted_format(struct erofs_inode *inode,
> >                                                          inode->xattr_isize) +
> >                                 sizeof(struct z_erofs_map_header);
> >       const unsigned int totalidx = (legacymetasize -
> > -                                    Z_EROFS_LEGACY_MAP_HEADER_SIZE) / 8;
> > +                                    Z_EROFS_LEGACY_MAP_HEADER_SIZE) / sizeof(struct z_erofs_vle_decompressed_index);
>
> It would be better to keep 80-char limit rule.
>
> Thanks, applied.
>
> Happy chinese new year!
> Gao Xiang
>
> >       const unsigned int logical_clusterbits = inode->z_logical_clusterbits;
> >       u8 *out, *in;
> >       struct z_erofs_compressindex_vec cv[16];
> > --
> > 2.35.0.rc2.247.g8bbb082509-goog



-- 
Sincerely,

Kelvin Zhang

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

* Re: [PATCH v1] erofs-utils: don't hard code constants
  2022-02-01 22:44   ` Kelvin Zhang via Linux-erofs
@ 2022-02-02  2:19     ` Gao Xiang
  0 siblings, 0 replies; 4+ messages in thread
From: Gao Xiang @ 2022-02-02  2:19 UTC (permalink / raw)
  To: Kelvin Zhang; +Cc: Miao Xie, linux-erofs mailing list

On Tue, Feb 01, 2022 at 02:44:46PM -0800, Kelvin Zhang wrote:
> Thanks Gao! I'm reading compressed indices code recently. Is there any
> notes/sketches/design docs you can share with me regarding that?
> 

There are some kernel commit messages to describe the on-disk format:
ec8c24420501d4cf3ed495c4d026984194897276
b86269f43892316ef5a177d7180d09d101a46f22

And Yue Hu wrote his own notes about compacted indexes (in Chinese):
http://tjtech.me/erofs-compacted-index-generation.html

Hope they are useful! I know that may not enough, I will try to write
more this year.

Thanks,
Gao Xiang

> Happy Chinese New Year!
> 
> On Mon, Jan 31, 2022 at 6:51 PM Gao Xiang <hsiangkao@linux.alibaba.com> wrote:
> >
> > On Mon, Jan 31, 2022 at 10:43:27AM -0800, Kelvin Zhang wrote:
> > > Use sizeof(z_erofs_vle_decompressed_index) to compute legacy index count
> > >
> > > Test: th
> > > Signed-off-by: Kelvin Zhang <zhangkelvin@google.com>
> > > ---
> > >  lib/compress.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/lib/compress.c b/lib/compress.c
> > > index 98be7a2..c520a1e 100644
> > > --- a/lib/compress.c
> > > +++ b/lib/compress.c
> > > @@ -359,7 +359,7 @@ int z_erofs_convert_to_compacted_format(struct erofs_inode *inode,
> > >                                                          inode->xattr_isize) +
> > >                                 sizeof(struct z_erofs_map_header);
> > >       const unsigned int totalidx = (legacymetasize -
> > > -                                    Z_EROFS_LEGACY_MAP_HEADER_SIZE) / 8;
> > > +                                    Z_EROFS_LEGACY_MAP_HEADER_SIZE) / sizeof(struct z_erofs_vle_decompressed_index);
> >
> > It would be better to keep 80-char limit rule.
> >
> > Thanks, applied.
> >
> > Happy chinese new year!
> > Gao Xiang
> >
> > >       const unsigned int logical_clusterbits = inode->z_logical_clusterbits;
> > >       u8 *out, *in;
> > >       struct z_erofs_compressindex_vec cv[16];
> > > --
> > > 2.35.0.rc2.247.g8bbb082509-goog
> 
> 
> 
> -- 
> Sincerely,
> 
> Kelvin Zhang

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

end of thread, other threads:[~2022-02-02  2:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31 18:43 [PATCH v1] erofs-utils: don't hard code constants Kelvin Zhang via Linux-erofs
2022-02-01  2:51 ` Gao Xiang
2022-02-01 22:44   ` Kelvin Zhang via Linux-erofs
2022-02-02  2:19     ` Gao Xiang

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.