Re: [PATCH v3 13/20] netfs: Add a netfs inode context

From: David Howells
Date: Wed Mar 16 2022 - 05:06:39 EST


I found a couple of issues here:

Firstly, netfs_is_cache_enabled() causes the generic/522 xfstest to take 60s
longer. This can be fixed by:

- return fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie);
+ return fscache_cookie_valid(cookie) && cookie->cache_priv &&
+ fscache_cookie_enabled(cookie);

There's no point trying to do caching if there's no cache actually attached.
I wonder if I should actually make this change in fscache_cookie_enabled()
rather than here.


Secondly, the above causes netfs_skip_folio_read() to be skipped a lot more
often than it should, and this hides an incorrect change there. I made
netfs_skip_folio_read() copy the folio size into a variable to avoid issuing
the calculation multiple times, but I then gave the wrong length when clearing
the tail of the page. This can be fixed by:

- zero_user_segments(&folio->page, 0, offset, offset + len, len);
+ zero_user_segments(&folio->page, 0, offset, offset + len, plen);

David