Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E5CE606A31A for ; Mon, 30 Nov 2026 20:07:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iceoLE7F Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4jdZn64m9Tz2y8F; Tue, 01 Dec 2026 07:07:22 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2600:3c04:e001:324:0:1991:8:25" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1796069242; cv=none; b=fUAhLhMA4gI5GqPmPmh8oqGoSlSvW7+asH53h1Hf390+jaAt9EGCCD1CPbAtYCMm57111gy/AWESjf7vSi+gKxvkkp2XdzEcUL0r1Lli/ECH4nnMyOEJaJ2VshhqB86JYUMhAQ/MGWTb98rjCu4rHC3Jiryz2SvaDZReTB7Ekw2TDQasGBX0w0iUm7y5zzLKzXzxyjCERfLqSo+72P1xPNlNOjLEtXAnExvwDyFO1+tup4Zez6nEkSi1JdFmRUV352GeIl3Cw6d2LyFb6ZSG6fN+h6HOUYp3JWLlhjxwRruQ0zHcZNIDDDonAqiJIU0o2o0GXNtm6cV28gfNNgEpnw== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1796069242; c=relaxed/relaxed; bh=VDsIIJgj28t/BTQSMnqjXj8UlwMJojHY/TnL1jyZXGw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XInxhQ0ieckjMCpYJnifJORPEMko4n1VXrCfPRSVmH5saq8rwcLdSEZxAHGXDG5X+HT0m2nneWnsOfuxHCLBcvSUbiGaivF3NQ41RBrb8LQx94+plElNP1Kd1ANwx1F3SfiRBCXwBKJrfJ5wKugZ6izypwz7pELDyvOdujn25SExNw/tSlhmN/GA2JF4Y0Iwi1A6i7ml2lAbL+1CiP93T9qdPnPtFaco6JnALJOOEWzVClsWQEKmSud7TZKgFMKZhik1ayfqXpHDSljdepP32U3DfHY3GRWo4Kn+2KUDi5yMR5cloYMOxHpKxykhsOLt6tzTf8slv4kUtlDtO3A80w== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iceoLE7F; dkim-atps=neutral; spf=pass (client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=xiang@kernel.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iceoLE7F; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=xiang@kernel.org; receiver=lists.ozlabs.org) Received: from tor.source.kernel.org (tor.source.kernel.org [IPv6:2600:3c04:e001:324:0:1991:8:25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4jdZn54pf4z2xM9 for ; Tue, 01 Dec 2026 07:07:21 +1100 (AEDT) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 62AF6609FE; Mon, 30 Nov 2026 20:07:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83E8F1F0089A; Mon, 30 Nov 2026 20:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796069237; bh=VDsIIJgj28t/BTQSMnqjXj8UlwMJojHY/TnL1jyZXGw=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=iceoLE7FehUk/eMS2lqT9tQc/G7nqJf1qy0tZSXCmecwYeErVhLF9qQVB7ciTqCQZ iXz+GMU8xUsxupVG+ulunI2t8wq656vCa8yOlDF6q9x48YeaED0h8VfwBfYGiJNZpV 61Z4xNevD1IzkRPcW8CVKhwR0RsbCedwVO1833KZXXsyDGfsnCiRL99vU6AUMx6TT5 88CxbcDvIGeSkBPwaxhE5JlyEYkblfEGToHJaDOSlUPhrVQclWGQwb/N0SAyA1UHtF sndmJdYHRL8U9x34SfHBJloEZnFZ+8EcSS2jjahvdzZdYQ3MSwjez0FwtugFByE+KK eNLVV7kKcclpQ== Date: Mon, 30 Nov 2026 21:07:08 +0100 From: Gao Xiang To: "wy.xu" Cc: Gao Xiang , linux-erofs@lists.ozlabs.org, Yifan Zhao Subject: Re: [PATCH v4 10/10] erofs-utils: mkfs: support file deltas in manifests Message-ID: Mail-Followup-To: "wy.xu" , Gao Xiang , linux-erofs@lists.ozlabs.org, Yifan Zhao References: <20261126120221.4384-1-xiang.gao@docker.com> <20261127040427.99710-1-xiang.gao@docker.com> <20261127040427.99710-4-xiang.gao@docker.com> <5539e991-43e1-4129-9334-096b97cf67da@deepseek.com> X-Mailing-List: linux-erofs@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Subscribe: , , Precedence: list X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5539e991-43e1-4129-9334-096b97cf67da@deepseek.com> X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Mon, Nov 30, 2026 at 03:54:46PM +0800, wy.xu wrote: > > 在 2026/11/27 12:04, Gao Xiang 写道: > > static int erofs_manifest_parse_record(struct erofs_importer *im, > > - struct erofs_inode *root, char *line) > > + struct erofs_inode *root, > > + char *line) > > { > > - char *fields[2], *token, *path; > > - int i, ret; > > + char *fields[3], *token, *imagepath, *srcpath; > > + unsigned int nr = 0; > > + bool dm_snap = false; > > + int ret; > > - for (i = 0; i < ARRAY_SIZE(fields); ++i) { > > - do { > > - token = strsep(&line, " "); > > - } while (token && !*token); > > - if (!token) > > + while ((token = strsep(&line, " "))) { > > + if (!*token) > > + continue; > > + if (nr == ARRAY_SIZE(fields)) > > return -EINVAL; > > - fields[i] = token; > > + fields[nr++] = token; > > } > > - while ((token = strsep(&line, " "))) > > - if (*token) > > - return -EINVAL; > > + if (!nr) > > + return -EINVAL; > > + if (!strncmp(fields[0], "DIFF[", 5)) { > > + size_t len = strlen(fields[0]); > > - if (erofs_manifest_decode(fields[0]) || *fields[0] != '/' || > > - erofs_manifest_decode(fields[1])) > > + if (len <= 6 || fields[0][len - 1] != ']' || nr != 3) > > + return -EINVAL; > > + fields[0][len - 1] = '\0'; > > + if (strcmp(fields[0] + 5, "DM_SNAP")) > > + return -EOPNOTSUPP; > > + dm_snap = true; > > + } > > + if (nr != (dm_snap ? 3 : 2)) > > return -EINVAL; > > - if (asprintf(&path, "%s/%s", im->params->source, fields[1]) < 0) > > + imagepath = fields[dm_snap ? 1 : 0]; > > + token = fields[dm_snap ? 2 : 1]; > > Can we get a more meaningful name here instead of "token"? Fixed. > > > > + if (erofs_manifest_decode(imagepath) || *imagepath != '/' || > > + erofs_manifest_decode(token)) > > + return -EINVAL; > > + if (asprintf(&srcpath, "%s/%s", im->params->source, token) < 0) > > return -ENOMEM; > > - ret = erofs_manifest_load_local(im, root, fields[0], path); > > - free(path); > > + ret = erofs_manifest_load_local(im, root, > > + imagepath, srcpath, dm_snap); > > + free(srcpath); > > return ret; > > } > > -/* The importer has not taken ownership of the tree on a parse error. */ > > +/* The importer has not taken ownership of a new tree on a load error. */ > > static void erofs_manifest_drop_children(struct erofs_inode *dir) > > { > > struct erofs_dentry *d, *next; > > @@ -253,18 +308,26 @@ static void erofs_manifest_drop_children(struct erofs_inode *dir) > > int erofs_manifest_load(struct erofs_importer *im, FILE *fp) > > { > > - struct erofs_inode *root; > > + struct erofs_inode *root = im->root; > > + bool newroot = !root; > > It seems that im->root is always non-NULL. Fixed. > > > > @@ -976,10 +977,14 @@ static int mkfs_parse_sources(int argc, char *argv[], int optind) > > { > > erofs_os_stat_t st; > > int err, fd; > > - char *s; > > + char *s, *datadir = NULL; > > + if (manifest_file) { > > + datadir = argv[--argc]; > > + if (optind == argc) > > + goto out_datadir; > > + } > > > Can we simplify the logic a bit here? somethig like: Could you just submit a follow-up patch to improve this? That would be helpful to me. Thanks, Gao Xiang