Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3653249pxu; Tue, 8 Dec 2020 18:52:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/S5f+uWj0oJm7tZxVmh2L0yW/QWLSqfwxP6Iw2Cpi3+RCzTjU4+Y3eWTeoAFV+Pck92Ev X-Received: by 2002:a17:906:234d:: with SMTP id m13mr316701eja.270.1607482340601; Tue, 08 Dec 2020 18:52:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607482340; cv=none; d=google.com; s=arc-20160816; b=ML9d2T38etURkYSueNLpNls8DbCklfNjSIr7yNK0iynzJe8Fbk7msVBFA2BZtDC4pE XpierbxnPvqF4WQ9fzRultF98NPE3LhiCMGJLZS3C1OyJYeD8gSC07PeMSjdFKpZpWM/ 3sxw1zUUUO2xXvNlJOUn+Tl40IgHGfDjQ/evyfX/BZo50V2iClp3fIDSptpOaSu+xk0n KA3sjqlmwIcydkgh+DvxFZplYouryGXt0UCbZhPgjsnhBcKfMMprFU64f87yC/RSxSeJ d1zS0Uhvvn8Ki/or9dN3BTvL4tQbm+MwfKX+Y1/IvXpgw9f0dcM7ZpB3GEX0mcuqZn68 734g== 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=s2jLB9lyGcuiqtUMQzY4BlQmh+O04HP8l3MLhgdpu/U=; b=o0fTK71L0b9eW+vHIC0B0oNjsakuPN8B29BBQK2y16s7vxXKytM9kHMwnsh1TPFXUC Pa3BLtq6Ov/P3X3a0k46cFRfpIMic/wU0Tw25BwF3LrmEn5wUnY36uZt9yePpjT1jQzW tgrzdENi4aixHcSpAIdYWiKFUSXL8TOoPeR1eQvgERiO2hA0iBDzVUaEWGrKNbA6rIk5 bcShzwsPVO67vb3sIaG8InQNQX1BlnpOhGnam1wvUbAHe5BiTJ2LFfezyYSZz5giN6eD wRmooQ9bMnKnEJpdxxE1keGidG9RWfQThEfIgJ6xZpxMKxMHi9KdaxzrW41BMGJUOrPF CCzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="VMDPJdi/"; 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 l2si31736ejf.667.2020.12.08.18.51.58; Tue, 08 Dec 2020 18:52:20 -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="VMDPJdi/"; 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 S1726935AbgLICsG (ORCPT + 99 others); Tue, 8 Dec 2020 21:48:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:48066 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725283AbgLICsG (ORCPT ); Tue, 8 Dec 2020 21:48:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607481999; 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=s2jLB9lyGcuiqtUMQzY4BlQmh+O04HP8l3MLhgdpu/U=; b=VMDPJdi/q+f5wmvZKn1rFvL5N6xvL1haXvygYQL+c8kWFvv6k5r1Zoy/a7uTQBGLL8kmWg L/xPMbRiN01Iwc563Ny41GQ+40RSXOsRzVPn5dcQwMWqI9q91tmmEnVwOee23NADnN5+ql xrAbFWGDk3sGmbOswRsgiqW9ZKEa/9Y= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-292-IHN7BUknNCuXB70aP7C6bg-1; Tue, 08 Dec 2020 21:46:37 -0500 X-MC-Unique: IHN7BUknNCuXB70aP7C6bg-1 Received: by mail-pf1-f200.google.com with SMTP id y2so133254pfr.12 for ; Tue, 08 Dec 2020 18:46:37 -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=s2jLB9lyGcuiqtUMQzY4BlQmh+O04HP8l3MLhgdpu/U=; b=HKZnkdpMo8+UNdVnLm6iqCiidbLLVAb8PcGEoI8hFHkqk60IPcyc2/e+pdWCFlkF+n qj4rlTrj8JDD2TG8Z6evhKr+UKahk7vTf+Q75ucqjtgbpbLgSHzm5KCuiQSYFqdBMdHU evVXCAfjQadr4k1WvGDeEn9uVaFvzLJblorEZLdndLIhKAcB1jpxCLX2vAhGx8MLDbsu 6NAiIr0x4lTicXDsfcCHi4cAALOMNrxM5Fq/CTfzYN9QjBCfFWkVXPaEHqjybrNPuK+K Hc5Zl/d346G2oGrpdDdmLLOg3+ZkTxORX1U2bRc3PUHiPMP3VBOA4MBidbNTif+Mb91O Z1ow== X-Gm-Message-State: AOAM532YqHFaAW7av9Zzxfwea/hYbVfFvPkhCXy+I5JKnVtaDAgnL/bA lAwgFbFyX338GFEa5Q59TGnVzzsfhS/IdVfqjVt9oIu+j90XUZTWnA5ku8J/WKuOeD1sLd28AjQ oUIh2d8kSvBVCh7Q4oHhibYlX X-Received: by 2002:a17:902:9891:b029:d8:fdf6:7c04 with SMTP id s17-20020a1709029891b02900d8fdf67c04mr440242plp.54.1607481996881; Tue, 08 Dec 2020 18:46:36 -0800 (PST) X-Received: by 2002:a17:902:9891:b029:d8:fdf6:7c04 with SMTP id s17-20020a1709029891b02900d8fdf67c04mr440226plp.54.1607481996675; Tue, 08 Dec 2020 18:46:36 -0800 (PST) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id j20sm199721pfd.106.2020.12.08.18.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 18:46:36 -0800 (PST) Date: Wed, 9 Dec 2020 10:46:25 +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 v4] erofs: avoid using generic_block_bmap Message-ID: <20201209024625.GB33948@xiangao.remote.csb> References: <20201209023930.15554-1-huangjianan@oppo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201209023930.15554-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 On Wed, Dec 09, 2020 at 10:39:30AM +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 > --- Looks good to me in general, yet see my v3 reply as below: https://lore.kernel.org/r/20201209024415.GA33948@xiangao.remote.csb/ Thanks, Gao Xiang > 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; > > 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; > + 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); > + > +out: > + return blknr; > } > > /* for uncompressed (aligned) files and raw access for other files */ > -- > 2.25.1 >