Commit 2c547f29 authored by Yue Hu's avatar Yue Hu Committed by David Howells

fscache: Remove the cookie parameter from fscache_clear_page_bits()

The cookie is not used at all, remove it and update the usage in io.c
and afs/write.c (which is the only user outside of fscache currently)
at the same time.

[DH: Amended the documentation also]
Signed-off-by: default avatarYue Hu <huyue2@coolpad.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: linux-cachefs@redhat.com
Link: https://listman.redhat.com/archives/linux-cachefs/2022-April/006659.html
parent 5d3d5b96
...@@ -404,22 +404,21 @@ schedule a write of that region:: ...@@ -404,22 +404,21 @@ schedule a write of that region::
And if an error occurs before that point is reached, the marks can be removed And if an error occurs before that point is reached, the marks can be removed
by calling:: by calling::
void fscache_clear_page_bits(struct fscache_cookie *cookie, void fscache_clear_page_bits(struct address_space *mapping,
struct address_space *mapping,
loff_t start, size_t len, loff_t start, size_t len,
bool caching) bool caching)
In both of these functions, the cookie representing the cache object to be In these functions, a pointer to the mapping to which the source pages are
written to and a pointer to the mapping to which the source pages are attached attached is passed in and start and len indicate the size of the region that's
are passed in; start and len indicate the size of the region that's going to be going to be written (it doesn't have to align to page boundaries necessarily,
written (it doesn't have to align to page boundaries necessarily, but it does but it does have to align to DIO boundaries on the backing filesystem). The
have to align to DIO boundaries on the backing filesystem). The caching caching parameter indicates if caching should be skipped, and if false, the
parameter indicates if caching should be skipped, and if false, the functions functions do nothing.
do nothing.
The write function takes some additional parameters: the cookie representing
The write function takes some additional parameters: i_size indicates the size the cache object to be written to, i_size indicates the size of the netfs file
of the netfs file and term_func indicates an optional completion function, to and term_func indicates an optional completion function, to which
which term_func_priv will be passed, along with the error or amount written. term_func_priv will be passed, along with the error or amount written.
Note that the write function will always run asynchronously and will unmark all Note that the write function will always run asynchronously and will unmark all
the pages upon completion before calling term_func. the pages upon completion before calling term_func.
......
...@@ -616,8 +616,7 @@ static ssize_t afs_write_back_from_locked_folio(struct address_space *mapping, ...@@ -616,8 +616,7 @@ static ssize_t afs_write_back_from_locked_folio(struct address_space *mapping,
_debug("write discard %x @%llx [%llx]", len, start, i_size); _debug("write discard %x @%llx [%llx]", len, start, i_size);
/* The dirty region was entirely beyond the EOF. */ /* The dirty region was entirely beyond the EOF. */
fscache_clear_page_bits(afs_vnode_cache(vnode), fscache_clear_page_bits(mapping, start, len, caching);
mapping, start, len, caching);
afs_pages_written_back(vnode, start, len); afs_pages_written_back(vnode, start, len);
ret = 0; ret = 0;
} }
......
...@@ -235,8 +235,7 @@ static void fscache_wreq_done(void *priv, ssize_t transferred_or_error, ...@@ -235,8 +235,7 @@ static void fscache_wreq_done(void *priv, ssize_t transferred_or_error,
{ {
struct fscache_write_request *wreq = priv; struct fscache_write_request *wreq = priv;
fscache_clear_page_bits(fscache_cres_cookie(&wreq->cache_resources), fscache_clear_page_bits(wreq->mapping, wreq->start, wreq->len,
wreq->mapping, wreq->start, wreq->len,
wreq->set_bits); wreq->set_bits);
if (wreq->term_func) if (wreq->term_func)
...@@ -296,7 +295,7 @@ void __fscache_write_to_cache(struct fscache_cookie *cookie, ...@@ -296,7 +295,7 @@ void __fscache_write_to_cache(struct fscache_cookie *cookie,
abandon_free: abandon_free:
kfree(wreq); kfree(wreq);
abandon: abandon:
fscache_clear_page_bits(cookie, mapping, start, len, cond); fscache_clear_page_bits(mapping, start, len, cond);
if (term_func) if (term_func)
term_func(term_func_priv, ret, false); term_func(term_func_priv, ret, false);
} }
......
...@@ -573,7 +573,6 @@ int fscache_write(struct netfs_cache_resources *cres, ...@@ -573,7 +573,6 @@ int fscache_write(struct netfs_cache_resources *cres,
/** /**
* fscache_clear_page_bits - Clear the PG_fscache bits from a set of pages * fscache_clear_page_bits - Clear the PG_fscache bits from a set of pages
* @cookie: The cookie representing the cache object
* @mapping: The netfs inode to use as the source * @mapping: The netfs inode to use as the source
* @start: The start position in @mapping * @start: The start position in @mapping
* @len: The amount of data to unlock * @len: The amount of data to unlock
...@@ -582,8 +581,7 @@ int fscache_write(struct netfs_cache_resources *cres, ...@@ -582,8 +581,7 @@ int fscache_write(struct netfs_cache_resources *cres,
* Clear the PG_fscache flag from a sequence of pages and wake up anyone who's * Clear the PG_fscache flag from a sequence of pages and wake up anyone who's
* waiting. * waiting.
*/ */
static inline void fscache_clear_page_bits(struct fscache_cookie *cookie, static inline void fscache_clear_page_bits(struct address_space *mapping,
struct address_space *mapping,
loff_t start, size_t len, loff_t start, size_t len,
bool caching) bool caching)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment