Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C11CFC43381 for ; Wed, 20 Feb 2019 08:37:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9AEDE20685 for ; Wed, 20 Feb 2019 08:37:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726486AbfBTIhp (ORCPT ); Wed, 20 Feb 2019 03:37:45 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:35885 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726239AbfBTIhR (ORCPT ); Wed, 20 Feb 2019 03:37:17 -0500 Received: by mail-wr1-f66.google.com with SMTP id o17so24965443wrw.3 for ; Wed, 20 Feb 2019 00:37:16 -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=otdqkR4q3+yVQ/OQQbgr3+AsyHPePlkTzGmj6TV6IbU=; b=Fz43PgIHHZbwlXF6pYA9bt7gDficbJC0CsZa5y36mRmAwx6IAmggVbTu9ChJRzrCgU QhPc7A32oJPDVewGQ0pYvr1A84GNfdzra2S0iUxdxEmBp9xJSlSjaJMZvNRxFfwX46w7 0Q/14W0COOjJ1hGJlrHcOWp2nvzwbvmcB7gtdEooROpylkzJ8f0AZfJaypOwV5UOopUj A3tER8hvmKInNYHhUwZaOQNeZS2hUbIL8urZTSrhB6vjURExqWIr3pLX2gaZ7jAL/VdW lcmHipPvntUPX3fYJMx7ZpBTZfrTDoH8PDttixcSRniIaRKigLsE6RFlRF32UPu1tTXE N/ew== X-Gm-Message-State: AHQUAuYdJ0HM9ftdf/zQnPMik90gUxWXL3xj9d77uPbMJNnZB25r+gtE GofPilamyhsb6TvrjdJwTqxRSzifJOM= X-Google-Smtp-Source: AHgI3IYN1SNPD3SYjha7hytZPpoaasKHXrPX3kgD9FdKoKkMED3gIhPkASr5/ivHyyTkj8MJTdg4Uw== X-Received: by 2002:adf:fd46:: with SMTP id h6mr23170309wrs.170.1550651835699; Wed, 20 Feb 2019 00:37:15 -0800 (PST) Received: from hades.usersys.redhat.com (ip-89-103-126-188.net.upcbroadband.cz. [89.103.126.188]) by smtp.gmail.com with ESMTPSA id v6sm15145391wro.57.2019.02.20.00.37.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Feb 2019 00:37:14 -0800 (PST) Date: Wed, 20 Feb 2019 09:37:12 +0100 From: Carlos Maiolino To: Andreas Dilger Cc: linux-fsdevel@vger.kernel.org, hch@lst.de, darrick.wong@oracle.com Subject: Re: [PATCH RFC 8/9] Use FIEMAP for FIBMAP calls Message-ID: <20190220083712.kuhlibbybrtr3sds@hades.usersys.redhat.com> References: <20190218130331.15882-1-cmaiolino@redhat.com> <20190218130331.15882-9-cmaiolino@redhat.com> <53A529CE-E363-443E-AC2D-30EDE4A50A97@dilger.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53A529CE-E363-443E-AC2D-30EDE4A50A97@dilger.ca> User-Agent: NeoMutt/20180716 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org > > Comments are much appreciated. > > > > Cheers > > Looks pretty reasonable. A few minor nits, but nothing serious. Thanks for the review... > > > diff --git a/fs/inode.c b/fs/inode.c > > index db681d310465..323dfe3d26fd 100644 > > --- a/fs/inode.c > > +++ b/fs/inode.c > > > > +static int fiemap_fill_kernel_extent(struct fiemap_extent_info *fieinfo, > > + u64 logical, u64 phys, u64 len, u32 flags) > > +{ > > + > > +out: > > + if (flags & FIEMAP_EXTENT_LAST) > > + return 1; > > + return 0; > > Why not just the straight return: > > return !!(flags & FIEMAP_EXTENT_LAST); > > or if this function is only returning 0 or 1 then it could return bool and be: > > return flags & FIEMAP_EXTENT_LAST; Christoph asked to leave it on the good if () style :P > > > @@ -1594,10 +1666,14 @@ EXPORT_SYMBOL(iput); > > */ > > int bmap(struct inode *inode, sector_t *block) > > { > > - if (!inode->i_mapping->a_ops->bmap) > > + if (inode->i_op->fiemap) > > + return bmap_fiemap(inode, block); > > + else if (inode->i_mapping->a_ops->bmap) > > + *block = inode->i_mapping->a_ops->bmap(inode->i_mapping, > > + *block); > > Typically there is no "else" after return. Makes sense. > > > @@ -113,7 +110,11 @@ int fiemap_fill_user_extent(struct fiemap_extent_info *fieinfo, u64 logical, > > fieinfo->fi_extents_mapped++; > > if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max) > > return 1; > > - return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0; > > + > > +out: > > + if (flags & FIEMAP_EXTENT_LAST) > > + return 1; > > + return 0; > > } > > As above, the simpler code would be: > > return !!(flags & FIEMAP_EXTENT_LAST); Same here, discussed on the last thread (I guess) > > Cheers, Andreas Thanks again for the review -- Carlos