From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com ([74.125.82.68]:52060 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751742AbeFEMRj (ORCPT ); Tue, 5 Jun 2018 08:17:39 -0400 Received: by mail-wm0-f68.google.com with SMTP id r15-v6so4516194wmc.1 for ; Tue, 05 Jun 2018 05:17:39 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20180605120733.boqsxhku77warm7s@twin.jikos.cz> References: <20180604193123.27655-1-agruenba@redhat.com> <20180604193123.27655-7-agruenba@redhat.com> <20180605120733.boqsxhku77warm7s@twin.jikos.cz> From: =?UTF-8?Q?Andreas_Gr=C3=BCnbacher?= Date: Tue, 5 Jun 2018 14:17:38 +0200 Message-ID: Subject: Re: [PATCH v8 06/10] iomap: Add page_write_end iomap hook To: dsterba@suse.cz Cc: Andreas Gruenbacher , cluster-devel , Christoph Hellwig , Linux FS-devel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 2018-06-05 14:07 GMT+02:00 David Sterba : > On Mon, Jun 04, 2018 at 09:31:19PM +0200, Andreas Gruenbacher wrote: >> --- a/fs/iomap.c >> +++ b/fs/iomap.c >> @@ -181,16 +181,22 @@ iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags, >> >> static int >> iomap_write_end(struct inode *inode, loff_t pos, unsigned len, >> - unsigned copied, struct page *page, struct iomap *iomap) >> + unsigned copied, struct page *page, struct iomap *iomap, >> + const struct iomap_ops *ops) >> { >> + typeof(ops->page_write_end) page_write_end = ops->page_write_end; > > Is the reason to use typeof is to avoid repeating the type of > page_write_end? Yes, the type is void (*)(struct inode *, loff_t, unsigned, struct page *, struct iomap *), which is a bit bulky. > As it's only for a temporary variable with 2 uses, > ops->page_write_end does not hurt readability nor is too much typing. > I would not recommend using typeof outside of the justified contexts > like macros or without a good reason. Andreas