Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4351955pxu; Wed, 9 Dec 2020 15:07:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5oN/V1HV3O5HaSM8KknbEp3xNlwnWsPb47P2rboY5e+01vT/NFA1atCDJy8UiPOz1eGIb X-Received: by 2002:a50:d6d3:: with SMTP id l19mr4121299edj.340.1607555224348; Wed, 09 Dec 2020 15:07:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607555224; cv=none; d=google.com; s=arc-20160816; b=yyIE+nlI6rvqBdoc7B6IL8xoFhuTYUWGV6Ue3ass8HAlsUMdFs9USosHItYBw73GKg bS5aTYSiOXAkFub/6M/FxOmMbsyZY0zesivrx7f5kny5e4KfPh87jna+1HWd9Oez48FD mSTHUF/5PxpQj/AIqpRGYL2s1Hfp004o4rx6N6XllgPqGSssHOAP4aEipmFDEbWiV99c lthaXoEJzcXRACx6s1zHF4d5WpZJABBgjNNL6iDO5NfvdcdYKEKgqD4VBGgXaQ7QMRcD 4Hq+cNKXuY0UVcfVa4c7BUYUL/x1Psk9dZjtbhfnvHMvIvF4vEj46mJeSb2XJ6rIXBlv nIrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=/SqMUXvAOH4cJHq6nWXxW5ImJK5azvxzmYSftBr0cj8=; b=FBYBpPy1K3Z9TYms1tXyigW36uwE2x/wbhJJmsIgYwapSbC2PldeDmfpvyIlapW9MN k2hGkA7MD+NMcS6LsDAy+XMt+gAv9g65NXgMgKGMjKs8vhGQOZGxxXBm5zXHoA8aHW0u IIw4NWwozTLFURoh4rrRPYaIBQ8umEfBIQ1qZjYybGVSXgzdcnirIBVJuqabHWsnGRiy AX/IU8LcudaTGFpgQa0siE9wHV2cacNnAhzyI9MJQ47fLSafj8LqnQKOGuM/cH9jMPNS aj2l005EsVnRrLh46PqJX6By59V1p+nQ5Sbvy5610bRsZITPUaRZQXyNV2r9BlZaCoTt UrLA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si1469965ejy.467.2020.12.09.15.06.40; Wed, 09 Dec 2020 15:07:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729731AbgLIKJ1 (ORCPT + 99 others); Wed, 9 Dec 2020 05:09:27 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:8970 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728631AbgLIKJ1 (ORCPT ); Wed, 9 Dec 2020 05:09:27 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4CrXmz5MJYzhnbT; Wed, 9 Dec 2020 18:08:19 +0800 (CST) Received: from [10.136.114.67] (10.136.114.67) by smtp.huawei.com (10.3.19.204) with Microsoft SMTP Server (TLS) id 14.3.487.0; Wed, 9 Dec 2020 18:08:42 +0800 Subject: Re: [PATCH v4] erofs: avoid using generic_block_bmap To: Huang Jianan , CC: , , References: <20201209023930.15554-1-huangjianan@oppo.com> From: Chao Yu Message-ID: <23527fc2-811b-321e-10f1-cb5b50affdbb@huawei.com> Date: Wed, 9 Dec 2020 18:08:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20201209023930.15554-1-huangjianan@oppo.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.136.114.67] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/12/9 10:39, 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 > --- > fs/erofs/data.c | 30 ++++++++++-------------------- > 1 file changed, 10 insertions(+), 20 deletions(-) > > diff --git a/fs/erofs/data.c b/fs/erofs/data.c > index 347be146884c..d6ea0a216b57 100644 > --- a/fs/erofs/data.c > +++ b/fs/erofs/data.c > @@ -312,36 +312,26 @@ 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), > + }; > + sector_t blknr = 0; It could be removed? > > if (EROFS_I(inode)->datalayout == EROFS_INODE_FLAT_INLINE) { > erofs_blk_t blks = i_size_read(inode) >> LOG_BLOCK_SIZE; > > if (block >> LOG_SECTORS_PER_BLOCK >= blks) > - return 0; return 0; > + goto out; > } > > - return generic_block_bmap(mapping, block, erofs_get_block); > + if (!erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW)) > + blknr = erofs_blknr(map.m_pa); return erofs_blknr(map.m_pa); > + > +out: > + return blknr; return 0; Anyway, LGTM. Reviewed-by: Chao Yu Thanks, > } > > /* for uncompressed (aligned) files and raw access for other files */ >