Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4559445pxu; Wed, 9 Dec 2020 22:39:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyt+Mg8dKYktC7AkNEWFbTGuqD/W3m2PTxtF2BlNf91yAS1xKtyF4Iy/KvWZKfJrxTWBxTg X-Received: by 2002:a17:906:b14e:: with SMTP id bt14mr5229763ejb.226.1607582398641; Wed, 09 Dec 2020 22:39:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607582398; cv=none; d=google.com; s=arc-20160816; b=gJmqq1ABxgH43EtzmCrJji4fKR7WRchLz/mUhEOL/sNWgSESYU/zpJNSOlRs6AJnTP cdhpG9IoH/6DC0FYknpES/h24RYJG4piw3m8MNr3Jh3UhnbLGbA9O7khj7zhtPvmq8Q9 YggiLc+8SF/WD40v48ESBpWhug2EvKtQ6ApGXdwXZHEIJLNyDxneG8YWvAKFFLjDbnFb 7Qolq+pcXwMAp58wNNi3dixSrGa2XVBvMPKztyemNj1EXAJmIHaZ2rLA5R4z71UyDUxS 8DiNdKgqvwV9Z8zUH63QoRARM3vndIfMNs9RpbE4T+fDx2WnR6n+ZwjfUq3L4P278qGa jhkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=kCGLXGuRmo1k3B8nyMMdd3CDg7kUrDixLDWQgjMK8Gk=; b=Sl0DgAV5D/7h9PXSp5T1Z7gqmUxyU2LQS0aslsw7LlrwfIKletO2DOK4T9UqiilFOn QnlRbsA/AdNWuD0NKpf/+OEFWdMxaMfg4Q1O6K8QsCnN2dEqP+fhyaMrel64sKVTMkzu qtSbJMzlPbmhRYM1msoKqB6YUz/rVG4RKYJ6c2sR9j72bTeVVgE5+tsc+KM9sRdQE+7M BfT3R/tSGqvKRWr3jS4e1ShiwUxaahL1orKza5bhCTQyqSiyXR2ssnevjeIkfuyxVSmF Hqpc9R8J1w4S67MtS0POI1fM9++NHo2OPoyK1YhYaAbln0kylId+v+sKSRY95v28th97 C1mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AL9kIvEf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d11si2125150edv.195.2020.12.09.22.39.34; Wed, 09 Dec 2020 22:39:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AL9kIvEf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729120AbgLJCh6 (ORCPT + 99 others); Wed, 9 Dec 2020 21:37:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:58045 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbgLJChx (ORCPT ); Wed, 9 Dec 2020 21:37:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607567785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kCGLXGuRmo1k3B8nyMMdd3CDg7kUrDixLDWQgjMK8Gk=; b=AL9kIvEfbXBJ2NYOP0vVu4sJhgfXSVu8mTkAxHNYsyg1Yc/dqPiddOGcV0ovhuT7fPG5b4 3F82/upKODemM4mX4hRWPAoVXOHtJ+vk+KnYUU6dKqA3LPo3+zROkYSD7CmxKH4aQBxBx3 wmjFzmXLnp0I0SQBmxxwGKz5sRGUipE= Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-484-RC5U7WOpMi-xb6fWu-Dn2A-1; Wed, 09 Dec 2020 21:36:24 -0500 X-MC-Unique: RC5U7WOpMi-xb6fWu-Dn2A-1 Received: by mail-pf1-f199.google.com with SMTP id e126so2473191pfh.15 for ; Wed, 09 Dec 2020 18:36:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kCGLXGuRmo1k3B8nyMMdd3CDg7kUrDixLDWQgjMK8Gk=; b=PUQqkaLEDHV8cSvZETH5qZpq2ZltVZsUv2MxZ2Sjst6kGckpHBc5SPjuCqCEzdi+IG /sO4siYB+fQQY1B0Xd9N/KU6LS9rRK+fLo+kKdekz3fWujpLy+YsOgZXhcHI5AivrT8G gjRoNwGydoeyEMdFNyW2Mq+EpgnCGKxeKBYZggMo4JNNn3X4aJm2Z/tmIR5mMd8IGABV iQlkYnu4icdOTTvT4WbWc9/Q1hZGyosTUYc1KHYdSGNE4qsE1N5SKi9SFg9/GpBEft6O OzXWof/jAfwTFZMoKL9Z802kTVwpQRpAWybW56UObDA9lgb+AJ1AEZJvt2cGpEwH+/rk w4/A== X-Gm-Message-State: AOAM531Wbsje75HMAFWUygP6YLvs66B2PKKkjAO4OoUJSfwJ5HeEw7dl cEU0skSorWuyI1Tpk1B+w4HJUepPckFlN2N4JxXTVtvY6LRhdhJqCepw7CP2VfLDS8103X3n39R aB4lJwbtjRzf0alvD+jyRtHY9 X-Received: by 2002:a17:90a:df0d:: with SMTP id gp13mr4979744pjb.151.1607567783178; Wed, 09 Dec 2020 18:36:23 -0800 (PST) X-Received: by 2002:a17:90a:df0d:: with SMTP id gp13mr4979727pjb.151.1607567782923; Wed, 09 Dec 2020 18:36:22 -0800 (PST) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id x10sm4067133pfc.157.2020.12.09.18.36.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 18:36:22 -0800 (PST) Date: Thu, 10 Dec 2020 10:36:12 +0800 From: Gao Xiang To: Huang Jianan Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, guoweichao@oppo.com, zhangshiming@oppo.com Subject: Re: [PATCH v5] erofs: avoid using generic_block_bmap Message-ID: <20201210023612.GA247374@xiangao.remote.csb> References: <20201209115740.18802-1-huangjianan@oppo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201209115740.18802-1-huangjianan@oppo.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jianan, On Wed, Dec 09, 2020 at 07:57:40PM +0800, Huang Jianan wrote: > iblock indicates the number of i_blkbits-sized blocks rather than > sectors. > > In addition, considering buffer_head limits mapped size to 32-bits, > should avoid using generic_block_bmap. > > Fixes: 9da681e017a3 ("staging: erofs: support bmap") > Signed-off-by: Huang Jianan > Signed-off-by: Guo Weichao Reviewed-by: Gao Xiang Also, I think Chao has sent his Reviewed-by in the previous reply --- so unless some major modification happens, it needs to be attached with all new versions as a common practice... I will apply it later to for-next, thanks for your patch! Thanks, Gao Xiang > --- > fs/erofs/data.c | 26 +++++++------------------- > 1 file changed, 7 insertions(+), 19 deletions(-) > > diff --git a/fs/erofs/data.c b/fs/erofs/data.c > index 347be146884c..ea4f693bee22 100644 > --- a/fs/erofs/data.c > +++ b/fs/erofs/data.c > @@ -312,27 +312,12 @@ static void erofs_raw_access_readahead(struct readahead_control *rac) > submit_bio(bio); > } > > -static int erofs_get_block(struct inode *inode, sector_t iblock, > - struct buffer_head *bh, int create) > -{ > - struct erofs_map_blocks map = { > - .m_la = iblock << 9, > - }; > - int err; > - > - err = erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW); > - if (err) > - return err; > - > - if (map.m_flags & EROFS_MAP_MAPPED) > - bh->b_blocknr = erofs_blknr(map.m_pa); > - > - return err; > -} > - > static sector_t erofs_bmap(struct address_space *mapping, sector_t block) > { > struct inode *inode = mapping->host; > + struct erofs_map_blocks map = { > + .m_la = blknr_to_addr(block), > + }; > > if (EROFS_I(inode)->datalayout == EROFS_INODE_FLAT_INLINE) { > erofs_blk_t blks = i_size_read(inode) >> LOG_BLOCK_SIZE; > @@ -341,7 +326,10 @@ static sector_t erofs_bmap(struct address_space *mapping, sector_t block) > return 0; > } > > - return generic_block_bmap(mapping, block, erofs_get_block); > + if (!erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW)) > + return erofs_blknr(map.m_pa); > + > + return 0; > } > > /* for uncompressed (aligned) files and raw access for other files */ > -- > 2.25.1 >