From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT 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 5B13CC43219 for ; Thu, 25 Apr 2019 15:03:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7BA612081C for ; Thu, 25 Apr 2019 15:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727210AbfDYPD4 (ORCPT ); Thu, 25 Apr 2019 11:03:56 -0400 Received: from verein.lst.de ([213.95.11.211]:35185 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726842AbfDYPD4 (ORCPT ); Thu, 25 Apr 2019 11:03:56 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 7866168B20; Thu, 25 Apr 2019 17:03:40 +0200 (CEST) Date: Thu, 25 Apr 2019 17:03:40 +0200 From: Christoph Hellwig To: Jan Kara Cc: Andreas Gruenbacher , cluster-devel@redhat.com, Christoph Hellwig , Bob Peterson , Dave Chinner , Ross Lagerwall , Mark Syms , Edwin =?iso-8859-1?B?VPZy9ms=?= , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/2] iomap: Add a page_prepare callback Message-ID: <20190425150340.GA17504@lst.de> References: <20190424171804.4305-1-agruenba@redhat.com> <20190425083252.GB21215@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190425083252.GB21215@quack2.suse.cz> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, Apr 25, 2019 at 10:32:52AM +0200, Jan Kara wrote: > Also just looking at the code I was wondering about the following. E.g. in > iomap_write_end() we have code like: > > if (iomap->type == IOMAP_INLINE) { > foo > } else if (iomap->flags & IOMAP_F_BUFFER_HEAD) { > bar > } else { > baz > } > > if (iomap->page_done) > iomap->page_done(...); > > And now something very similar is in iomap_write_begin(). So won't it be > more natural to just mandate ->page_prepare() and ->page_done() callbacks > and each filesystem would set it to a helper function it needs? Probably we > could get rid of IOMAP_F_BUFFER_HEAD flag that way... I don't want pointless indirect calls for the default, non-buffer head case. Also inline really is a special case independent of what the caller could pass in as flags or callbacks. We could try to hide the buffer_head stuff in there, but then again I'd rather kill that off sooner than later.