Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5555402rwi; Tue, 18 Oct 2022 00:18:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66LgnCsprpRuZULIenUlap9BU3HCZU0OenokRAeicZsqHyPJhVY7ao8QJqdnMqtupozFrX X-Received: by 2002:a05:6402:320e:b0:45c:ae50:dbca with SMTP id g14-20020a056402320e00b0045cae50dbcamr1390501eda.104.1666077486255; Tue, 18 Oct 2022 00:18:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666077486; cv=none; d=google.com; s=arc-20160816; b=xmfP/cZeI/2u7ViJGcGQ20LGM1tABjjosJGYMHnZ450NtfxhYWWNJzD3TLeisYhvav 5T/eIF9C1PIYA9lrjBfZJbLnggWODnvAWtPUiyOVCsRJwm9Knie6KT7CScNMolbJa361 Kvl9U+TNBftgwLPA4ELdYTAkySncjb81j+LXh/nqxQ3ECeTElfJMUh8IU6FRhUJ/L77C AgBjneDafCYeB3QEBJuRTv3enRPL2mD0ncrwR9lYp4581ZEVQKKs6mbVl90I1+asJHx0 hEZiJUWILqcDg6pHEclAsPQOzaod79elKqY+s1tZqF4VY6tbZX+MGVtCzdsIymRiQk8T Rhug== 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=kQy0ZUr0QhIgh+SKKKuLORb3HaPISqzQzzSQmcm1wWQ=; b=tScZ23q37zQovlit3jzY29uuX9ANVoZbAhySuV7tm4VmQsuN2WEBmsoo7QAJfb3Aly UQVNF9o2Ume7SGYyU8vQY/OzZhwS8D0uQWtTQIbjZi+WL3Chg0QaU9UPBp8BIeXP4ZQX DY8lAxyBzd4lKmPvzzrNI6XRTyY0Nl8u2KKZOGiB+CwfAPUV0I8GGiNIvtMTCg4VICpW mCOUt74A7AfTDcVRiG7hqu5CAtnG8Zu8tuzbSvOllcr+2J5kZjC9zbP5gwLodii/5KMQ ZhGIW4IDWktXmFw/GrOEi6NJKSrxt+R5FTBGxXskiSi9FupXSSn8oA99cWfCvYB4ONUe kHzw== 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 t11-20020a056402524b00b0045c1782d77fsi12038776edd.40.2022.10.18.00.17.38; Tue, 18 Oct 2022 00:18:06 -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 S229843AbiJRGrd (ORCPT + 99 others); Tue, 18 Oct 2022 02:47:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiJRGrb (ORCPT ); Tue, 18 Oct 2022 02:47:31 -0400 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78C41A59B3 for ; Mon, 17 Oct 2022 23:47:28 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VSTSjO6_1666075645; Received: from 30.221.130.77(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VSTSjO6_1666075645) by smtp.aliyun-inc.com; Tue, 18 Oct 2022 14:47:26 +0800 Message-ID: <537dcde9-864e-37d4-1898-2307d254c69d@linux.alibaba.com> Date: Tue, 18 Oct 2022 14:47:24 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH] 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: <20221018035536.114792-1-hsiangkao@linux.alibaba.com> From: JeffleXu In-Reply-To: <20221018035536.114792-1-hsiangkao@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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 11:55 AM, Gao Xiang wrote: > Convert all mapped erofs_bread() users to use kmap_local_page() > instead of kmap() or kmap_atomic(). > > Signed-off-by: Gao Xiang LGTM. Reviewed-by: Jingbo Xu > --- > 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..3873395173b5 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->page); > 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