Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp431132ybz; Fri, 24 Apr 2020 03:00:21 -0700 (PDT) X-Google-Smtp-Source: APiQypL6TPny3qjeGd3beI+BnOou59J98hpYJhc1FbjuTZycJD+CAT+LaM1ylRdn8skqjZYz3IJY X-Received: by 2002:a50:9eaf:: with SMTP id a44mr6710064edf.58.1587722421341; Fri, 24 Apr 2020 03:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587722421; cv=none; d=google.com; s=arc-20160816; b=gO5eX2MwiVGHrk2uXtJcHjFPfFo/BJNEb+wCwiDeDlag2AdxUoSw87BbzryI7uMFI8 rK+v+10wlqppyJjJAwC2gqG25xsC+ms3venC+dNF5uRBP6Aekm3YOg1UqvWuaQvDvYvH tuQqgDJ9EKJa6gd57dzbchLaTFq7gfeGwZWGErmwuDLXxfIsXEef8N3rc7Hgj8VuuToA TpBcAAF/u6QNIU2N6Af11efCEDQ+w59Gwt3Qb4BqRbUFszbXHgVxzadpFrw6yZ/jaCdN 0VH/mPWg4e5rDjxTBxG75y89zNS8M24RB3XQLCFZCzSMKiM5nfgcF5ifS9u/xtWcNdTK EzBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=X6fMf8o+1hwdcD1LLgmXBl9lmHjpROfGFYm5wwhc7so=; b=ofccaiHJ3gw0Xf+Ucn8z7BSGUVvawl0fq4XHyYfjxvy2Oz1VxxxCwrbExpMLiJNgMd YqchAdzMArsh7WknjUwWGKJQHic9hpgFeLsypqwrciIo2ylvD/n0DIEeUzRJt9/WsxDQ MgLFcqbNeRxTQfz3ziC041ew1zFdXdwjfa/3YRGnaZIAm0qZkOxEw8uEjURHPVZqxCVS vsz2k+e2AnAegXzUuxNKXMpfuzC6PR05gqCacX6egsihKvVthpzKcX8w67k6rgNeQL5k dH6ysuuGlkWKmj0RY0aShh0KN6+oiqjYHt74i2g/CA6YXIWkZWpI5ASBxHjME0t+s/x1 2/iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 n25si3121988ejl.342.2020.04.24.02.59.51; Fri, 24 Apr 2020 03:00:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726647AbgDXJ7r (ORCPT + 99 others); Fri, 24 Apr 2020 05:59:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:36590 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726193AbgDXJ7r (ORCPT ); Fri, 24 Apr 2020 05:59:47 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 77463AA7C; Fri, 24 Apr 2020 09:59:45 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 8CC761E128C; Fri, 24 Apr 2020 11:59:45 +0200 (CEST) Date: Fri, 24 Apr 2020 11:59:45 +0200 From: Jan Kara To: Ritesh Harjani Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, Alexander Viro , "Darrick J . Wong" , Christoph Hellwig , Jan Kara , tytso@mit.edu, "Aneesh Kumar K . V" , linux-ext4@vger.kernel.org Subject: Re: [PATCH 2/2] iomap: bmap: Remove the WARN and return the proper block address Message-ID: <20200424095945.GC13069@quack2.suse.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri 24-04-20 12:52:18, Ritesh Harjani wrote: > iomap_bmap() could be called from either of these two paths. > Either when a user is calling an ioctl_fibmap() interface to get > the block mapping address or by some filesystem via use of bmap() > internal kernel API. > bmap() kernel API is well equipped with handling of u64 addresses. > > WARN condition in iomap_bmap_actor() was mainly added to warn all > the fibmap users. But now that in previous patch we have directly added > this WARN condition for all fibmap users and also made sure to return 0 > as block map address in case if addr > INT_MAX. > So we can now remove this logic from here. > > Signed-off-by: Ritesh Harjani Yes, I agree it's better to hadle the overflow in the ioctl than in the iomap actor. The patch looks good to me. You can add: Reviewed-by: Jan Kara Honza > --- > fs/iomap/fiemap.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/fs/iomap/fiemap.c b/fs/iomap/fiemap.c > index bccf305ea9ce..d55e8f491a5e 100644 > --- a/fs/iomap/fiemap.c > +++ b/fs/iomap/fiemap.c > @@ -117,10 +117,7 @@ iomap_bmap_actor(struct inode *inode, loff_t pos, loff_t length, > > if (iomap->type == IOMAP_MAPPED) { > addr = (pos - iomap->offset + iomap->addr) >> inode->i_blkbits; > - if (addr > INT_MAX) > - WARN(1, "would truncate bmap result\n"); > - else > - *bno = addr; > + *bno = addr; > } > return 0; > } > -- > 2.21.0 > -- Jan Kara SUSE Labs, CR