Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp316163rwb; Thu, 1 Dec 2022 02:33:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf5G7oXrb3NSGkek0ZIZzVCdLXtS6Qg68yXwD6ZerUNtkvknsLYnFbgUWQErHOJiHK+Dt8/H X-Received: by 2002:a17:906:1713:b0:7a3:fc74:7fb4 with SMTP id c19-20020a170906171300b007a3fc747fb4mr57705905eje.17.1669890811314; Thu, 01 Dec 2022 02:33:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669890811; cv=none; d=google.com; s=arc-20160816; b=X3QDPL8SHMdv/+fCXhq6/IGVpKwDpLUD6+G90UyZnux6s2tzREJERka4gHMW/GAfYS i9YZM0Al6oIMibMHl5OOvJwOtIkh+aO7JUlZpr/vAJj3S1u83gX8JTo9rA+EtkEB6Njg MkVt3w0Ej9Q1KSxA+i5R5zgo6BYWa67atjkoMeyIoGqDcXiL9NIB2QwtoUJ+BqPsgaCP BHYv+IdH35UmQtxBoPZVhf2pFdrYn1DAAX5DqfARlok5+lAOGFiJvYOHKBA0jVwBG9XH yjSGErMS6Ym03hYm0C4MCDtYno6BOoJzG0Ar/sPWW54LicuGgBcOiuZBlK99mbuYHB32 4ZpQ== 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:content-language:subject:user-agent:mime-version :date:message-id; bh=9Ljcs7ALt0ETKJgp+IU8MKLd2aqSEOh0tW5TZOfDyeM=; b=ofVrJoQTxYms+xvLZu1X7oHCNZSylafuEINYYcKqUf5HfXTUPzIbUdct9jbcoOzm6a eCbk3Dl6EvqG3Y7tp/+L2aEcWWBfFnJ3cdxHTChmteb1svkPTJrEBilQFK0lgMNlad5U hCeBYSOZ1nOX1hMM+LkJ85pER1HjupFasCJf63K1GpLx/gEHPFGuv8nc7HdibYcGynBx ep/mtn0ngYejV07k4OxwvBzqMMV6/XGjErvVEs/9EsK/8AQu2cVpvskV2L9jTLXvNFTS kN//cqAKKqEveoYGCJWCsyBXVLLMwVj9oF45nvrZTBwbYe0mOWZSQfhZGpBKePzkgUEP HlQA== 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 du10-20020a17090772ca00b0079330b37fb6si3408958ejc.880.2022.12.01.02.33.11; Thu, 01 Dec 2022 02:33:31 -0800 (PST) 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 S230245AbiLAKJz (ORCPT + 83 others); Thu, 1 Dec 2022 05:09:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230333AbiLAKJ2 (ORCPT ); Thu, 1 Dec 2022 05:09:28 -0500 Received: from out30-7.freemail.mail.aliyun.com (out30-7.freemail.mail.aliyun.com [115.124.30.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D899B2D75F for ; Thu, 1 Dec 2022 02:09:26 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VW8IkAi_1669889363; Received: from 30.221.129.69(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VW8IkAi_1669889363) by smtp.aliyun-inc.com; Thu, 01 Dec 2022 18:09:24 +0800 Message-ID: <016136f8-7402-3f57-0e16-1a3f3ec055ec@linux.alibaba.com> Date: Thu, 1 Dec 2022 18:09:23 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH v2] erofs: use kmap_local_page() only for erofs_bread() Content-Language: en-US To: Gao Xiang , linux-erofs@lists.ozlabs.org, Chao Yu Cc: LKML References: <20221018105313.4940-1-hsiangkao@linux.alibaba.com> From: Jingbo Xu In-Reply-To: <20221018105313.4940-1-hsiangkao@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, 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 On 10/18/22 6:53 PM, Gao Xiang wrote: > Convert all mapped erofs_bread() users to use kmap_local_page() > instead of kmap() or kmap_atomic(). Reviewed-and-tested-by: Jingbo Xu > > Signed-off-by: Gao Xiang > --- > fs/erofs/data.c | 8 ++------ > fs/erofs/internal.h | 3 +-- > fs/erofs/xattr.c | 8 ++++---- > fs/erofs/zmap.c | 4 ++-- > 4 files changed, 9 insertions(+), 14 deletions(-) > > diff --git a/fs/erofs/data.c b/fs/erofs/data.c > index fe8ac0e163f7..fe1ae80284bf 100644 > --- a/fs/erofs/data.c > +++ b/fs/erofs/data.c > @@ -13,9 +13,7 @@ > void erofs_unmap_metabuf(struct erofs_buf *buf) > { > if (buf->kmap_type == EROFS_KMAP) > - kunmap(buf->page); > - else if (buf->kmap_type == EROFS_KMAP_ATOMIC) > - kunmap_atomic(buf->base); > + kunmap_local(buf->base); > buf->base = NULL; > buf->kmap_type = EROFS_NO_KMAP; > } > @@ -54,9 +52,7 @@ void *erofs_bread(struct erofs_buf *buf, struct inode *inode, > } > if (buf->kmap_type == EROFS_NO_KMAP) { > if (type == EROFS_KMAP) > - buf->base = kmap(page); > - else if (type == EROFS_KMAP_ATOMIC) > - buf->base = kmap_atomic(page); > + buf->base = kmap_local_page(page); > buf->kmap_type = type; > } else if (buf->kmap_type != type) { > DBG_BUGON(1); > diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h > index 1701df48c446..67dc8e177211 100644 > --- a/fs/erofs/internal.h > +++ b/fs/erofs/internal.h > @@ -253,8 +253,7 @@ static inline int erofs_wait_on_workgroup_freezed(struct erofs_workgroup *grp) > > enum erofs_kmap_type { > EROFS_NO_KMAP, /* don't map the buffer */ > - EROFS_KMAP, /* use kmap() to map the buffer */ > - EROFS_KMAP_ATOMIC, /* use kmap_atomic() to map the buffer */ > + EROFS_KMAP, /* use kmap_local_page() to map the buffer */ > }; > > struct erofs_buf { > diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c > index 8106bcb5a38d..a62fb8a3318a 100644 > --- a/fs/erofs/xattr.c > +++ b/fs/erofs/xattr.c > @@ -148,7 +148,7 @@ static inline int xattr_iter_fixup(struct xattr_iter *it) > > it->blkaddr += erofs_blknr(it->ofs); > it->kaddr = erofs_read_metabuf(&it->buf, it->sb, it->blkaddr, > - EROFS_KMAP_ATOMIC); > + EROFS_KMAP); > if (IS_ERR(it->kaddr)) > return PTR_ERR(it->kaddr); > it->ofs = erofs_blkoff(it->ofs); > @@ -174,7 +174,7 @@ static int inline_xattr_iter_begin(struct xattr_iter *it, > it->ofs = erofs_blkoff(iloc(sbi, vi->nid) + inline_xattr_ofs); > > it->kaddr = erofs_read_metabuf(&it->buf, inode->i_sb, it->blkaddr, > - EROFS_KMAP_ATOMIC); > + EROFS_KMAP); > if (IS_ERR(it->kaddr)) > return PTR_ERR(it->kaddr); > return vi->xattr_isize - xattr_header_sz; > @@ -368,7 +368,7 @@ static int shared_getxattr(struct inode *inode, struct getxattr_iter *it) > > it->it.ofs = xattrblock_offset(sbi, vi->xattr_shared_xattrs[i]); > it->it.kaddr = erofs_read_metabuf(&it->it.buf, sb, blkaddr, > - EROFS_KMAP_ATOMIC); > + EROFS_KMAP); > if (IS_ERR(it->it.kaddr)) > return PTR_ERR(it->it.kaddr); > it->it.blkaddr = blkaddr; > @@ -580,7 +580,7 @@ static int shared_listxattr(struct listxattr_iter *it) > > it->it.ofs = xattrblock_offset(sbi, vi->xattr_shared_xattrs[i]); > it->it.kaddr = erofs_read_metabuf(&it->it.buf, sb, blkaddr, > - EROFS_KMAP_ATOMIC); > + EROFS_KMAP); > if (IS_ERR(it->it.kaddr)) > return PTR_ERR(it->it.kaddr); > it->it.blkaddr = blkaddr; > diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c > index 0bb66927e3d0..749a5ac943f4 100644 > --- a/fs/erofs/zmap.c > +++ b/fs/erofs/zmap.c > @@ -178,7 +178,7 @@ static int legacy_load_cluster_from_disk(struct z_erofs_maprecorder *m, > unsigned int advise, type; > > m->kaddr = erofs_read_metabuf(&m->map->buf, inode->i_sb, > - erofs_blknr(pos), EROFS_KMAP_ATOMIC); > + erofs_blknr(pos), EROFS_KMAP); > if (IS_ERR(m->kaddr)) > return PTR_ERR(m->kaddr); > > @@ -416,7 +416,7 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, > out: > pos += lcn * (1 << amortizedshift); > m->kaddr = erofs_read_metabuf(&m->map->buf, inode->i_sb, > - erofs_blknr(pos), EROFS_KMAP_ATOMIC); > + erofs_blknr(pos), EROFS_KMAP); > if (IS_ERR(m->kaddr)) > return PTR_ERR(m->kaddr); > return unpack_compacted_index(m, amortizedshift, pos, lookahead); -- Thanks, Jingbo