Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E17FDC28B30 for ; Sun, 16 Mar 2025 17:19:58 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4ZG4bx3c5xz2yRm; Mon, 17 Mar 2025 04:19:57 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=115.124.30.111 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1742145597; cv=none; b=ZHU9gzIHEghik6wWhxlGblXs+K1C9C5l9RrDzQQwc5dARI2Ce3klwkoz7cgKJrAv/+F0xZztFU9D2TgXE4bPBshf3xix4RtmDK3NSKwnAN4/IIS4eHUY1kMXIYOx/IdBB9V4XrI9zTJsn3qxTv6uPT0dlF4+ZMKGRgqZ9iYgnMew3lEl4oFrRtalclqYbZ+pLvl1fhczCehRpKVtldlFlpzlxcG8caR+D6D2BfFNF5pop1MU1s4zmudslKCy6Sj8EaKVCixY2cs50pv9knnF0i/xYjcVn7VwJYJQIvNdvJmSThmww2JI/LkWTHfiU7Hl61ur2hr8iejvvjvqbvXX4Q== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1742145597; c=relaxed/relaxed; bh=fzOy707LWkwGKF9chjVOZk3NWtrTE4bTaEOfE4ij2iQ=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=NQ6tWdI81+5IqZpTT4A6PMya4s3n12uR/U0NSCyVbDmoaOxCwKk7xT++Me+0SBKly3WS+GgltqXZ4qzjNJjgaCZP8d8R0KxKNp+f9wvM7irSYSBx8f2lmA8Nmgz+YI9UteVaofji1Q2pp83vdrV8xWKCrIJklj1KNHtyDEaxJw4FfNGla6cCAQ6ngyUw/K5kk86TkcRCvAV+NA5xeKaipmka25tTT9VSfTjF+rTl0mrM2rXLs9PBcUqcudtV/9Hr8LKNgbF48r9mKizFz9U3k0sUPRCyUoD0TqljotSPDgxoW5yErlzdv5u9+k1Fqc05Nc4q4hxKxBEbnsxJFrNl9g== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; dkim=pass (1024-bit key; unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=XQajXYNl; dkim-atps=neutral; spf=pass (client-ip=115.124.30.111; helo=out30-111.freemail.mail.aliyun.com; envelope-from=hsiangkao@linux.alibaba.com; receiver=lists.ozlabs.org) smtp.mailfrom=linux.alibaba.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=XQajXYNl; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.alibaba.com (client-ip=115.124.30.111; helo=out30-111.freemail.mail.aliyun.com; envelope-from=hsiangkao@linux.alibaba.com; receiver=lists.ozlabs.org) Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) (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 4ZG4bw2g1Zz2xlK for ; Mon, 17 Mar 2025 04:19:55 +1100 (AEDT) DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1742145592; h=Message-ID:Date:MIME-Version:Subject:From:To:Content-Type; bh=fzOy707LWkwGKF9chjVOZk3NWtrTE4bTaEOfE4ij2iQ=; b=XQajXYNleMKe6epvwiPQMOaoopdS/cdmvAxRj2WuVsbZPXiOceB/HYq7kRJ+SbED6rni9nE1wTqMje6ZWJQAMMCzyqF43TWXdC5NWMrokDnRN2/HX+N8re90lIezExCH5LQrGSzdXf09d/T6faLh6/FnX/im1jNPTfR4b7OOWA0= Received: from 30.134.66.95(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0WRVXgmw_1742145589 cluster:ay36) by smtp.aliyun-inc.com; Mon, 17 Mar 2025 01:19:50 +0800 Message-ID: <793c8af4-d651-48ff-830d-6a8cfd18d697@linux.alibaba.com> Date: Mon, 17 Mar 2025 01:19:49 +0800 X-Mailing-List: linux-erofs@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Subscribe: , , List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5] erofs: use Z_EROFS_LCLUSTER_TYPE_MAX to simplify switches From: Gao Xiang To: Chao Yu Cc: linux-kernel@vger.kernel.org, Hongzhen Luo , linux-erofs mailing list References: <20250210032923.3382136-1-hongzhen@linux.alibaba.com> <511c5fd9-307e-4c56-9d20-796dd06f775c@kernel.org> <489be3d1-a755-4756-ba82-a8f5a0dc9156@linux.alibaba.com> In-Reply-To: <489be3d1-a755-4756-ba82-a8f5a0dc9156@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2025/3/17 01:17, Gao Xiang wrote: > Hi Chao, > > On 2025/3/16 10:36, Chao Yu wrote: >> On 2025/2/10 11:29, Hongzhen Luo wrote: >>> There's no need to enumerate each type.  No logic changes. >>> >>> Signed-off-by: Hongzhen Luo >> >> Looks good to me, feel free to add: >> >> Reviewed-by: Chao Yu >> >> And one minor comment below. >> >>> diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c >>> index 689437e99a5a..d278ebd60281 100644 >>> --- a/fs/erofs/zmap.c >>> +++ b/fs/erofs/zmap.c >>> @@ -265,26 +265,22 @@ static int z_erofs_extent_lookback(struct z_erofs_maprecorder *m, >>>           if (err) >>>               return err; >>> -        switch (m->type) { >>> -        case Z_EROFS_LCLUSTER_TYPE_NONHEAD: >>> +        if (m->type >= Z_EROFS_LCLUSTER_TYPE_MAX) { >>> +            erofs_err(sb, "unknown type %u @ lcn %lu of nid %llu", >>> +                  m->type, lcn, vi->nid); >>> +            DBG_BUGON(1); >>> +            return -EOPNOTSUPP; `m->type >= Z_EROFS_LCLUSTER_TYPE_MAX` is checked here BTW, I think the patch is good. Thanks, Gao Xiang