Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2818905rwd; Mon, 29 May 2023 01:02:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6isQLNOWjm3Kvc2zCDZOOwxuh19gHOwl46QG1Oi+t/f1pT5+buVr3j0v6EgunVRFZmiqJP X-Received: by 2002:a05:6a20:7d94:b0:10c:6dbc:2810 with SMTP id v20-20020a056a207d9400b0010c6dbc2810mr7921568pzj.62.1685347374750; Mon, 29 May 2023 01:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685347374; cv=none; d=google.com; s=arc-20160816; b=ZKpGSbdMpZD1FTKy77yuP3UT+hyvIgORFicQ6CAwfcH05gRlLF/+XQox5aWVXvlDoI 8dRprf5Y3TOCSE/vFQtDDDgyWYXOlKTAA3UVoOTFlPtvTt/3OhNpB0jybLdp+FeG2brJ HgoT1FT+1JOuf4e1sAlkoiIj3wfEYHPAhs+x20wcAWsrIvMJjx7Bgg+NvCK7YXVjxL0d p7uHEKac/7ZjsZ7KAwgTqk3weJSL5RXSfABws7JJLVp7Un/Pm8VbjagNhPI3AS8Oz3p1 GtZ11wZH4mEudX92/zzioxR8MElMEAT0vhmDSjzJ5debFoOgZ2hVlBmFx+h85ATp+2bt nAqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=QakrcgJOfxc5ywBP6SiMBP/5qpDEG9Ic9Jl0OZE9QZY=; b=Bx1+eI3EezqAPUWAvNdX7TethJd8384RHJHUU0QSgTvEVjIocqvToxF/yvgDz//E7+ 6s4LujhxPN3d7N7FrmGegIuErmIy8NNc5ZyAUKb9jaGQfgUjXtDGrvfbJYSumSBTu6bF +kJGtoXG4XivWAYc1QwTXggvpynaqQLGxGAiH7imHqvFbGNrw0pZp+ODET3SrZ68Rgg0 Qj6H44f/3zaDk3fCoD6gBL8oJvBz15Bl6qX9TW9RyScNiHKHs7UQVf9ETSMQ4ZIvwzhM lbbCgZxMZj/WqeDG4l/t7xYo5WC8ZtmIU+AUMEZ3ErnBhnS2cUGxFcivbc7jBjCP9nFP Otug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l191-20020a6388c8000000b0053b928deb7asi2251239pgd.344.2023.05.29.01.02.40; Mon, 29 May 2023 01:02:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231564AbjE2HmF (ORCPT + 99 others); Mon, 29 May 2023 03:42:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231572AbjE2Hlr (ORCPT ); Mon, 29 May 2023 03:41:47 -0400 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B43BE1 for ; Mon, 29 May 2023 00:41:43 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0Vjis6Cv_1685346099; Received: from 30.221.134.122(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0Vjis6Cv_1685346099) by smtp.aliyun-inc.com; Mon, 29 May 2023 15:41:40 +0800 Message-ID: <9d928aa7-31cf-e4c1-8694-0aa63e55b382@linux.alibaba.com> Date: Mon, 29 May 2023 15:41:38 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v3 1/5] erofs: introduce erofs_xattr_iter_fixup_aligned() helper To: Jingbo Xu , xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org References: <20230518024551.123990-1-jefflexu@linux.alibaba.com> <20230518024551.123990-2-jefflexu@linux.alibaba.com> From: Gao Xiang In-Reply-To: <20230518024551.123990-2-jefflexu@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2023/5/18 10:45, Jingbo Xu wrote: > Introduce erofs_xattr_iter_fixup_aligned() helper where > it.ofs <= EROFS_BLKSIZ is mandatory. > > Signed-off-by: Jingbo Xu > --- > fs/erofs/xattr.c | 79 +++++++++++++++++++++--------------------------- > 1 file changed, 35 insertions(+), 44 deletions(-) > > diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c > index bbfe7ce170d2..b79be2a556ba 100644 > --- a/fs/erofs/xattr.c > +++ b/fs/erofs/xattr.c > @@ -29,6 +29,28 @@ struct xattr_iter { > unsigned int ofs; > }; > > +static inline int erofs_xattr_iter_fixup(struct xattr_iter *it) > +{ > + if (it->ofs < it->sb->s_blocksize) > + return 0; > + > + it->blkaddr += erofs_blknr(it->sb, it->ofs); > + it->kaddr = erofs_read_metabuf(&it->buf, it->sb, it->blkaddr, EROFS_KMAP); could we use a new buf interface to init_metabuf at once? > + if (IS_ERR(it->kaddr)) > + return PTR_ERR(it->kaddr); > + it->ofs = erofs_blkoff(it->sb, it->ofs); > + return 0; > +} > + > +static inline int erofs_xattr_iter_fixup_aligned(struct xattr_iter *it) Since we're doing cleanup, this name sounds confusing to me since here the meaning is actually "we don't allow pos > blksize", IOWs, any pos <= blksize is allowed here, so 'aligned' is not accurate. Could we think out a better one? Thanks, Gao Xiang