lkml.org 
[lkml]   [2022]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 12/17] md/raid5-cache: Move struct r5l_log definition to raid5-log.h
On Thu, May 26, 2022 at 10:35:59AM -0600, Logan Gunthorpe wrote:
> Move struct r5l_log definition to raid5-log.h. While this reduces
> encapsulation, it is necessary for the definition of r5l_log to be
> public so that rcu_access_pointer() can be used on conf-log in the
> next patch.
>
> rcu_access_pointer(p) doesn't technically dereference the log pointer
> however, it does use typeof(*p) and some older GCC versions (anything
> earlier than gcc-10) will wrongly try to dereference the structure:
>
> include/linux/rcupdate.h:384:9: error: dereferencing pointer to
> incomplete type ‘struct r5l_log’
>
> typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
> ^
>
> include/linux/rcupdate.h:495:31: note: in expansion of
> macro ‘__rcu_access_pointer’
>
> #define rcu_access_pointer(p) __rcu_access_pointer((p),
> __UNIQUE_ID(rcu), __rcu)
>
> To prevent this, simply provide the definition where
> rcu_access_pointer() may be used.

What about just moving any code that does the rcu_access_pointer on
conf->log to raid5-cache.c and doing an out of line call for it
instead?

\
 
 \ /
  Last update: 2022-05-30 07:59    [W:0.084 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site