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=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 24C95C636C9 for ; Tue, 20 Jul 2021 09:52:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A8F960FDB for ; Tue, 20 Jul 2021 09:52:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234417AbhGTJMC (ORCPT ); Tue, 20 Jul 2021 05:12:02 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:54854 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232506AbhGTJMB (ORCPT ); Tue, 20 Jul 2021 05:12:01 -0400 Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0B1DF1FD3E; Tue, 20 Jul 2021 09:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1626774756; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0S3FE71qGo66t31Vxc28Wi9V+Ayx6OZMuHotTPZ+18Y=; b=c2XzEflSX0tIvkoXclpsr1Pe1rwb9SiwUw5Glll8ctmd9TDuRsQwYS1BLW/AjVcFtvH+Rq W6oJgU04IUmXu1L/1wUNyWdN6bOMgy+b6ADzKJW1x0BccrffxjZDSzIduLav2BcOc6NBmk IKBPPCIKUYUO4NmItmpCSt/z+J74vDI= Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 80D2213AA2; Tue, 20 Jul 2021 09:52:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id +x0ZHeOc9mCHKgAAGKfGzw (envelope-from ); Tue, 20 Jul 2021 09:52:35 +0000 Subject: Re: [PATCH 03/27] iomap: mark the iomap argument to iomap_sector const To: "Darrick J. Wong" , Christoph Hellwig Cc: Dan Williams , Matthew Wilcox , Andreas Gruenbacher , Shiyang Ruan , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, nvdimm@lists.linux.dev, cluster-devel@redhat.com References: <20210719103520.495450-1-hch@lst.de> <20210719103520.495450-4-hch@lst.de> <20210719160820.GE22402@magnolia> From: Nikolay Borisov Message-ID: Date: Tue, 20 Jul 2021 12:52:35 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210719160820.GE22402@magnolia> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On 19.07.21 г. 19:08, Darrick J. Wong wrote: > On Mon, Jul 19, 2021 at 12:34:56PM +0200, Christoph Hellwig wrote: >> Signed-off-by: Christoph Hellwig > > /me wonders, does this have any significant effect on the generated > code? https://theartofmachinery.com/2019/08/12/c_const_isnt_for_performance.html > > It's probably a good idea to feed the optimizer as much usage info as we > can, though I would imagine that for such a simple function it can > probably tell that we don't change *iomap. > > IMHO, constifiying functions is a good way to signal to /programmers/ > that they're not intended to touch the arguments, so > > Reviewed-by: Darrick J. Wong > > --D > >> --- >> include/linux/iomap.h | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/include/linux/iomap.h b/include/linux/iomap.h >> index 093519d91cc9cc..f9c36df6a3061b 100644 >> --- a/include/linux/iomap.h >> +++ b/include/linux/iomap.h >> @@ -91,8 +91,7 @@ struct iomap { >> const struct iomap_page_ops *page_ops; >> }; >> >> -static inline sector_t >> -iomap_sector(struct iomap *iomap, loff_t pos) >> +static inline sector_t iomap_sector(const struct iomap *iomap, loff_t pos) >> { >> return (iomap->addr + pos - iomap->offset) >> SECTOR_SHIFT; >> } >> -- >> 2.30.2 >> >