All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH stable 5.15.y] erofs: fix compact 4B support for 16k block size
@ 2023-07-21  2:22 Gao Xiang
  2023-07-21  5:29   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Gao Xiang @ 2023-07-21  2:22 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, linux-erofs, Gao Xiang

commit 001b8ccd0650727e54ec16ef72bf1b8eeab7168e upstream.

In compact 4B, two adjacent lclusters are packed together as a unit to
form on-disk indexes for effective random access, as below:

(amortized = 4, vcnt = 2)
       _____________________________________________
      |___@_____ encoded bits __________|_ blkaddr _|
      0        .                                    amortized * vcnt = 8
      .             .
      .                  .              amortized * vcnt - 4 = 4
      .                        .
      .____________________________.
      |_type (2 bits)_|_clusterofs_|

Therefore, encoded bits for each pack are 32 bits (4 bytes). IOWs,
since each lcluster can get 16 bits for its type and clusterofs, the
maximum supported lclustersize for compact 4B format is 16k (14 bits).

Fix this to enable compact 4B format for 16k lclusters (blocks), which
is tested on an arm64 server with 16k page size.

Fixes: 152a333a5895 ("staging: erofs: add compacted compression indexes support")
Link: https://lore.kernel.org/r/20230601112341.56960-1-hsiangkao@linux.alibaba.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
resolve a trivial conflict.

 fs/erofs/zmap.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index 2c8575a8f6da..15cac6baf6d2 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -253,7 +253,7 @@ static int unpack_compacted_index(struct z_erofs_maprecorder *m,
 	u8 *in, type;
 	bool big_pcluster;
 
-	if (1 << amortizedshift == 4)
+	if (1 << amortizedshift == 4 && lclusterbits <= 14)
 		vcnt = 2;
 	else if (1 << amortizedshift == 2 && lclusterbits == 12)
 		vcnt = 16;
@@ -351,7 +351,6 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
 {
 	struct inode *const inode = m->inode;
 	struct erofs_inode *const vi = EROFS_I(inode);
-	const unsigned int lclusterbits = vi->z_logical_clusterbits;
 	const erofs_off_t ebase = ALIGN(iloc(EROFS_I_SB(inode), vi->nid) +
 					vi->inode_isize + vi->xattr_isize, 8) +
 		sizeof(struct z_erofs_map_header);
@@ -361,9 +360,6 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
 	erofs_off_t pos;
 	int err;
 
-	if (lclusterbits != 12)
-		return -EOPNOTSUPP;
-
 	if (lcn >= totalidx)
 		return -EINVAL;
 
-- 
2.24.4


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

* Re: [PATCH stable 5.15.y] erofs: fix compact 4B support for 16k block size
  2023-07-21  2:22 [PATCH stable 5.15.y] erofs: fix compact 4B support for 16k block size Gao Xiang
@ 2023-07-21  5:29   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2023-07-21  5:29 UTC (permalink / raw)
  To: Gao Xiang; +Cc: stable, linux-erofs

On Fri, Jul 21, 2023 at 10:22:21AM +0800, Gao Xiang wrote:
> commit 001b8ccd0650727e54ec16ef72bf1b8eeab7168e upstream.
> 
> In compact 4B, two adjacent lclusters are packed together as a unit to
> form on-disk indexes for effective random access, as below:
> 
> (amortized = 4, vcnt = 2)
>        _____________________________________________
>       |___@_____ encoded bits __________|_ blkaddr _|
>       0        .                                    amortized * vcnt = 8
>       .             .
>       .                  .              amortized * vcnt - 4 = 4
>       .                        .
>       .____________________________.
>       |_type (2 bits)_|_clusterofs_|
> 
> Therefore, encoded bits for each pack are 32 bits (4 bytes). IOWs,
> since each lcluster can get 16 bits for its type and clusterofs, the
> maximum supported lclustersize for compact 4B format is 16k (14 bits).
> 
> Fix this to enable compact 4B format for 16k lclusters (blocks), which
> is tested on an arm64 server with 16k page size.
> 
> Fixes: 152a333a5895 ("staging: erofs: add compacted compression indexes support")
> Link: https://lore.kernel.org/r/20230601112341.56960-1-hsiangkao@linux.alibaba.com
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
> resolve a trivial conflict.

All now queued up.

thanks,

greg k-h

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

* Re: [PATCH stable 5.15.y] erofs: fix compact 4B support for 16k block size
@ 2023-07-21  5:29   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2023-07-21  5:29 UTC (permalink / raw)
  To: Gao Xiang; +Cc: linux-erofs, stable

On Fri, Jul 21, 2023 at 10:22:21AM +0800, Gao Xiang wrote:
> commit 001b8ccd0650727e54ec16ef72bf1b8eeab7168e upstream.
> 
> In compact 4B, two adjacent lclusters are packed together as a unit to
> form on-disk indexes for effective random access, as below:
> 
> (amortized = 4, vcnt = 2)
>        _____________________________________________
>       |___@_____ encoded bits __________|_ blkaddr _|
>       0        .                                    amortized * vcnt = 8
>       .             .
>       .                  .              amortized * vcnt - 4 = 4
>       .                        .
>       .____________________________.
>       |_type (2 bits)_|_clusterofs_|
> 
> Therefore, encoded bits for each pack are 32 bits (4 bytes). IOWs,
> since each lcluster can get 16 bits for its type and clusterofs, the
> maximum supported lclustersize for compact 4B format is 16k (14 bits).
> 
> Fix this to enable compact 4B format for 16k lclusters (blocks), which
> is tested on an arm64 server with 16k page size.
> 
> Fixes: 152a333a5895 ("staging: erofs: add compacted compression indexes support")
> Link: https://lore.kernel.org/r/20230601112341.56960-1-hsiangkao@linux.alibaba.com
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
> resolve a trivial conflict.

All now queued up.

thanks,

greg k-h

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

end of thread, other threads:[~2023-07-21  5:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21  2:22 [PATCH stable 5.15.y] erofs: fix compact 4B support for 16k block size Gao Xiang
2023-07-21  5:29 ` Greg Kroah-Hartman
2023-07-21  5:29   ` Greg Kroah-Hartman

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.