From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f66.google.com ([209.85.221.66]:39111 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726452AbeIFMix (ORCPT ); Thu, 6 Sep 2018 08:38:53 -0400 Received: by mail-wr1-f66.google.com with SMTP id s14-v6so1336451wrw.6 for ; Thu, 06 Sep 2018 01:04:40 -0700 (PDT) Date: Thu, 6 Sep 2018 10:04:37 +0200 From: Carlos Maiolino To: Christoph Hellwig Cc: Eric Sandeen , linux-fsdevel@vger.kernel.org, david@fromorbit.com Subject: Re: [PATCH 1/2] fs: Replace direct ->bmap calls by bmap() Message-ID: <20180906080437.jwz6qtoo36uuw7ce@odin.usersys.redhat.com> References: <20180905135748.30098-1-cmaiolino@redhat.com> <20180905135748.30098-2-cmaiolino@redhat.com> <20180905185539.GA423@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180905185539.GA423@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Sep 05, 2018 at 08:55:39PM +0200, Christoph Hellwig wrote: > On Wed, Sep 05, 2018 at 09:23:26AM -0500, Eric Sandeen wrote: > > > block0 = page->index; > > > block0 <<= shift; > > > > > > - block = inode->i_mapping->a_ops->bmap(inode->i_mapping, block0); > > > + block = bmap(inode, block0); > > > > Prior to this there's an ASSERT that inode->i_mapping->a_ops->bmap > > exists. Should that stay, if the goal is to move all ->bmap use out > > of calling code? > > I think it needs to go away. /me will keep it in mind > > > OTOH, what will this code do if bmap() finds that there > > is no ->bmap present and returns 0? > > I think we just need to fix the bmap() prototype so that it can return > error, which would be very useful for various reasons. Something like > this: > > int bmap(struct address_space *mapping, sector_t *block) > { > if (!mapping->a_ops->bmap) > return -EINVAL; > *block = mapping->a_ops->bmap(mapping, *block); > return 0; > } > > then add fiemap support with real error handling later. Will do, thanks for the suggestion. -- Carlos