linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] erofs-utils: dump: read packed inode only by valid packed_nid
@ 2023-06-02  9:37 Yue Hu
  2023-06-02  9:37 ` [PATCH 2/2] erofs-utils: fsck: check " Yue Hu
  2023-06-02  9:43 ` [PATCH 1/2] erofs-utils: dump: read " Gao Xiang
  0 siblings, 2 replies; 4+ messages in thread
From: Yue Hu @ 2023-06-02  9:37 UTC (permalink / raw)
  To: linux-erofs; +Cc: sunshijie, huyue2, zhangwen

From: Yue Hu <huyue2@coolpad.com>

Since dedupe feature is also using the same feature bit as fragments.
Meanwhile, add missing dedupe feature to feature_lists[].

Fixes: a6336feefe37 ("erofs-utils: dump: support fragments")
Signed-off-by: Yue Hu <huyue2@coolpad.com>
---
 dump/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dump/main.c b/dump/main.c
index fd1923f..b9aa0f5 100644
--- a/dump/main.c
+++ b/dump/main.c
@@ -99,6 +99,7 @@ static struct erofsdump_feature feature_lists[] = {
 	{ false, EROFS_FEATURE_INCOMPAT_DEVICE_TABLE, "device_table" },
 	{ false, EROFS_FEATURE_INCOMPAT_ZTAILPACKING, "ztailpacking" },
 	{ false, EROFS_FEATURE_INCOMPAT_FRAGMENTS, "fragments" },
+	{ false, EROFS_FEATURE_INCOMPAT_DEDUPE, "dedupe" },
 };
 
 static int erofsdump_readdir(struct erofs_dir_context *ctx);
@@ -273,7 +274,7 @@ static int erofsdump_read_packed_inode(void)
 	erofs_off_t occupied_size = 0;
 	struct erofs_inode vi = { .nid = sbi.packed_nid };
 
-	if (!erofs_sb_has_fragments())
+	if (!sbi.packed_nid)
 		return 0;
 
 	err = erofs_read_inode_from_disk(&vi);
@@ -605,7 +606,7 @@ static void erofsdump_show_superblock(void)
 			sbi.xattr_blkaddr);
 	fprintf(stdout, "Filesystem root nid:                          %llu\n",
 			sbi.root_nid | 0ULL);
-	if (erofs_sb_has_fragments())
+	if (sbi.packed_nid > 0)
 		fprintf(stdout, "Filesystem packed nid:                        %llu\n",
 			sbi.packed_nid | 0ULL);
 	fprintf(stdout, "Filesystem inode count:                       %llu\n",
-- 
2.17.1


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

* [PATCH 2/2] erofs-utils: fsck: check packed inode only by valid packed_nid
  2023-06-02  9:37 [PATCH 1/2] erofs-utils: dump: read packed inode only by valid packed_nid Yue Hu
@ 2023-06-02  9:37 ` Yue Hu
  2023-06-02  9:42   ` Gao Xiang
  2023-06-02  9:43 ` [PATCH 1/2] erofs-utils: dump: read " Gao Xiang
  1 sibling, 1 reply; 4+ messages in thread
From: Yue Hu @ 2023-06-02  9:37 UTC (permalink / raw)
  To: linux-erofs; +Cc: sunshijie, huyue2, zhangwen

From: Yue Hu <huyue2@coolpad.com>

Since dedupe feature is also using the same feature bit as fragments.

Fixes: 017f5b402d14 ("erofs-utils: fsck: add a check to packed inode")
Signed-off-by: Yue Hu <huyue2@coolpad.com>
---
 fsck/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fsck/main.c b/fsck/main.c
index ad40537..de59532 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -789,7 +789,7 @@ int main(int argc, char **argv)
 		goto exit_put_super;
 	}
 
-	if (erofs_sb_has_fragments()) {
+	if (sbi.packed_nid > 0) {
 		err = erofsfsck_check_inode(sbi.packed_nid, sbi.packed_nid);
 		if (err) {
 			erofs_err("failed to verify packed file");
-- 
2.17.1


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

* Re: [PATCH 2/2] erofs-utils: fsck: check packed inode only by valid packed_nid
  2023-06-02  9:37 ` [PATCH 2/2] erofs-utils: fsck: check " Yue Hu
@ 2023-06-02  9:42   ` Gao Xiang
  0 siblings, 0 replies; 4+ messages in thread
From: Gao Xiang @ 2023-06-02  9:42 UTC (permalink / raw)
  To: Yue Hu, linux-erofs; +Cc: sunshijie, huyue2, zhangwen



On 2023/6/2 17:37, Yue Hu wrote:
> From: Yue Hu <huyue2@coolpad.com>
> 
> Since dedupe feature is also using the same feature bit as fragments.
> 
> Fixes: 017f5b402d14 ("erofs-utils: fsck: add a check to packed inode")
> Signed-off-by: Yue Hu <huyue2@coolpad.com>

We should check both
erofs_sb_has_fragments() && sbi.packed_nid > 0 here.

Thanks,
Gao Xiang

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

* Re: [PATCH 1/2] erofs-utils: dump: read packed inode only by valid packed_nid
  2023-06-02  9:37 [PATCH 1/2] erofs-utils: dump: read packed inode only by valid packed_nid Yue Hu
  2023-06-02  9:37 ` [PATCH 2/2] erofs-utils: fsck: check " Yue Hu
@ 2023-06-02  9:43 ` Gao Xiang
  1 sibling, 0 replies; 4+ messages in thread
From: Gao Xiang @ 2023-06-02  9:43 UTC (permalink / raw)
  To: Yue Hu, linux-erofs; +Cc: sunshijie, huyue2, zhangwen



On 2023/6/2 17:37, Yue Hu wrote:
> From: Yue Hu <huyue2@coolpad.com>
> 
> Since dedupe feature is also using the same feature bit as fragments.
> Meanwhile, add missing dedupe feature to feature_lists[].
> 
> Fixes: a6336feefe37 ("erofs-utils: dump: support fragments")
> Signed-off-by: Yue Hu <huyue2@coolpad.com>

We should check both
erofs_sb_has_fragments() && sbi.packed_nid > 0 here.

Thanks,
Gao Xiang

> ---
>   dump/main.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/dump/main.c b/dump/main.c
> index fd1923f..b9aa0f5 100644
> --- a/dump/main.c
> +++ b/dump/main.c
> @@ -99,6 +99,7 @@ static struct erofsdump_feature feature_lists[] = {
>   	{ false, EROFS_FEATURE_INCOMPAT_DEVICE_TABLE, "device_table" },
>   	{ false, EROFS_FEATURE_INCOMPAT_ZTAILPACKING, "ztailpacking" },
>   	{ false, EROFS_FEATURE_INCOMPAT_FRAGMENTS, "fragments" },
> +	{ false, EROFS_FEATURE_INCOMPAT_DEDUPE, "dedupe" },
>   };
>   
>   static int erofsdump_readdir(struct erofs_dir_context *ctx);
> @@ -273,7 +274,7 @@ static int erofsdump_read_packed_inode(void)
>   	erofs_off_t occupied_size = 0;
>   	struct erofs_inode vi = { .nid = sbi.packed_nid };
>   
> -	if (!erofs_sb_has_fragments())
> +	if (!sbi.packed_nid)
>   		return 0;
>   
>   	err = erofs_read_inode_from_disk(&vi);
> @@ -605,7 +606,7 @@ static void erofsdump_show_superblock(void)
>   			sbi.xattr_blkaddr);
>   	fprintf(stdout, "Filesystem root nid:                          %llu\n",
>   			sbi.root_nid | 0ULL);
> -	if (erofs_sb_has_fragments())
> +	if (sbi.packed_nid > 0)
>   		fprintf(stdout, "Filesystem packed nid:                        %llu\n",
>   			sbi.packed_nid | 0ULL);
>   	fprintf(stdout, "Filesystem inode count:                       %llu\n",

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

end of thread, other threads:[~2023-06-02  9:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02  9:37 [PATCH 1/2] erofs-utils: dump: read packed inode only by valid packed_nid Yue Hu
2023-06-02  9:37 ` [PATCH 2/2] erofs-utils: fsck: check " Yue Hu
2023-06-02  9:42   ` Gao Xiang
2023-06-02  9:43 ` [PATCH 1/2] erofs-utils: dump: read " 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).