[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <78a6ffae-7701-e0dd-3130-a9a95473d16b@deltatee.com>
Date: Thu, 28 Apr 2022 09:44:52 -0600
From: Logan Gunthorpe <logang@...tatee.com>
To: Guoqing Jiang <guoqing.jiang@...ux.dev>,
linux-kernel@...r.kernel.org, linux-raid@...r.kernel.org,
Song Liu <song@...nel.org>
Cc: Christoph Hellwig <hch@...radead.org>,
Stephen Bates <sbates@...thlin.com>,
Martin Oliveira <Martin.Oliveira@...eticom.com>,
David Sloan <David.Sloan@...eticom.com>,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v2 01/12] md/raid5: Factor out ahead_of_reshape() function
On 2022-04-27 19:49, Guoqing Jiang wrote:
>
>
> On 4/28/22 12:07 AM, Logan Gunthorpe wrote:
>>
>> On 2022-04-26 19:28, Guoqing Jiang wrote:
>>>> +static bool ahead_of_reshape(struct mddev *mddev, sector_t sector,
>>>> + sector_t reshape_sector)
>>>> +{
>>>> + if (mddev->reshape_backwards)
>>>> + return sector < reshape_sector;
>>>> + else
>>>> + return sector >= reshape_sector;
>>>> +}
>>> I think it can be an inline function.
>> Marking static functions in C files as inline is not recommended. GCC
>> will inline it, if it is appropriate.
>>
>> https://yarchive.net/comp/linux/inline.html
>> https://www.kernel.org/doc/local/inline.html
>
> Thanks for the link, then I suppose those can be deleted
> linux> grep "static inline" drivers/md/md.h -r
It's standard practice to annotate small functions in headers with
"static inline". Without the inline annotation, any C file that includes
the header and doesn't use the function will emit a "defined but not
used warning".
Functions in headers also should, by definition, be small and
specifically inline-able (ie they are used as a type-safe macro).
static functions in C files (not headers) should not have the inline
keyword as GCC can optimize them and inline them as it sees fit and the
inline keyword doesn't actually do anything.
Logan
Powered by blists - more mailing lists