lkml.org 
[lkml]   [2022]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 3/4] cachestat: implement cachestat syscall
On Mon, Dec 12, 2022 at 08:23:31AM -0800, Nhat Pham wrote:
> > It would be easier to read if you inverted the condition here.
>
> Oh I think I tried
>
> if (!f.file)
> return -EBADF;
>
> here, but there are some mixing-code-with-decl warnings.
> If I recall correctly, the problem is with this line:
>
> XA_STATE(xas, &mapping->i_pages, first_index);
>
> which is expanded into a declaration:
>
> #define XA_STATE(name, array, index) \
> struct xa_state name = __XA_STATE(array, index, 0, 0)
>
> It requires a valid mapping though, which is
> obtained from f.file:
>
> struct address_space *mapping = f.file->f_mapping;
>
> so it cannot be moved above the if(!f.file) check either...

Perhaps you're trying to do too much in a single function?

\
 
 \ /
  Last update: 2022-12-12 17:26    [W:0.079 / U:0.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site