Skip to content

Commit 2c547f2

Browse files
taigerhudhowells
authored andcommitted
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: Yue Hu <huyue2@coolpad.com> Signed-off-by: David Howells <dhowells@redhat.com> cc: linux-cachefs@redhat.com Link: https://listman.redhat.com/archives/linux-cachefs/2022-April/006659.html
1 parent 5d3d5b9 commit 2c547f2

4 files changed

Lines changed: 16 additions & 21 deletions

File tree

Documentation/filesystems/caching/netfs-api.rst

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -404,22 +404,21 @@ schedule a write of that region::
404404
And if an error occurs before that point is reached, the marks can be removed
405405
by calling::
406406

407-
void fscache_clear_page_bits(struct fscache_cookie *cookie,
408-
struct address_space *mapping,
407+
void fscache_clear_page_bits(struct address_space *mapping,
409408
loff_t start, size_t len,
410409
bool caching)
411410

412-
In both of these functions, the cookie representing the cache object to be
413-
written to and a pointer to the mapping to which the source pages are attached
414-
are passed in; start and len indicate the size of the region that's going to be
415-
written (it doesn't have to align to page boundaries necessarily, but it does
416-
have to align to DIO boundaries on the backing filesystem). The caching
417-
parameter indicates if caching should be skipped, and if false, the functions
418-
do nothing.
419-
420-
The write function takes some additional parameters: i_size indicates the size
421-
of the netfs file and term_func indicates an optional completion function, to
422-
which term_func_priv will be passed, along with the error or amount written.
411+
In these functions, a pointer to the mapping to which the source pages are
412+
attached is passed in and start and len indicate the size of the region that's
413+
going to be written (it doesn't have to align to page boundaries necessarily,
414+
but it does have to align to DIO boundaries on the backing filesystem). The
415+
caching parameter indicates if caching should be skipped, and if false, the
416+
functions do nothing.
417+
418+
The write function takes some additional parameters: the cookie representing
419+
the cache object to be written to, i_size indicates the size of the netfs file
420+
and term_func indicates an optional completion function, to which
421+
term_func_priv will be passed, along with the error or amount written.
423422

424423
Note that the write function will always run asynchronously and will unmark all
425424
the pages upon completion before calling term_func.

fs/afs/write.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,7 @@ static ssize_t afs_write_back_from_locked_folio(struct address_space *mapping,
616616
_debug("write discard %x @%llx [%llx]", len, start, i_size);
617617

618618
/* The dirty region was entirely beyond the EOF. */
619-
fscache_clear_page_bits(afs_vnode_cache(vnode),
620-
mapping, start, len, caching);
619+
fscache_clear_page_bits(mapping, start, len, caching);
621620
afs_pages_written_back(vnode, start, len);
622621
ret = 0;
623622
}

fs/fscache/io.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,7 @@ static void fscache_wreq_done(void *priv, ssize_t transferred_or_error,
235235
{
236236
struct fscache_write_request *wreq = priv;
237237

238-
fscache_clear_page_bits(fscache_cres_cookie(&wreq->cache_resources),
239-
wreq->mapping, wreq->start, wreq->len,
238+
fscache_clear_page_bits(wreq->mapping, wreq->start, wreq->len,
240239
wreq->set_bits);
241240

242241
if (wreq->term_func)
@@ -296,7 +295,7 @@ void __fscache_write_to_cache(struct fscache_cookie *cookie,
296295
abandon_free:
297296
kfree(wreq);
298297
abandon:
299-
fscache_clear_page_bits(cookie, mapping, start, len, cond);
298+
fscache_clear_page_bits(mapping, start, len, cond);
300299
if (term_func)
301300
term_func(term_func_priv, ret, false);
302301
}

include/linux/fscache.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,6 @@ int fscache_write(struct netfs_cache_resources *cres,
573573

574574
/**
575575
* fscache_clear_page_bits - Clear the PG_fscache bits from a set of pages
576-
* @cookie: The cookie representing the cache object
577576
* @mapping: The netfs inode to use as the source
578577
* @start: The start position in @mapping
579578
* @len: The amount of data to unlock
@@ -582,8 +581,7 @@ int fscache_write(struct netfs_cache_resources *cres,
582581
* Clear the PG_fscache flag from a sequence of pages and wake up anyone who's
583582
* waiting.
584583
*/
585-
static inline void fscache_clear_page_bits(struct fscache_cookie *cookie,
586-
struct address_space *mapping,
584+
static inline void fscache_clear_page_bits(struct address_space *mapping,
587585
loff_t start, size_t len,
588586
bool caching)
589587
{

0 commit comments

Comments
 (0)