1 /* Cache page management and data I/O routines
3 * Copyright (C) 2004-2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
12 #define FSCACHE_DEBUG_LEVEL PAGE
13 #include <linux/module.h>
14 #include <linux/fscache-cache.h>
15 #include <linux/buffer_head.h>
16 #include <linux/pagevec.h>
20 * check to see if a page is being written to the cache
22 bool __fscache_check_page_write(struct fscache_cookie *cookie, struct page *page)
27 val = radix_tree_lookup(&cookie->stores, page->index);
32 EXPORT_SYMBOL(__fscache_check_page_write);
35 * wait for a page to finish being written to the cache
37 void __fscache_wait_on_page_write(struct fscache_cookie *cookie, struct page *page)
39 wait_queue_head_t *wq = bit_waitqueue(&cookie->flags, 0);
41 wait_event(*wq, !__fscache_check_page_write(cookie, page));
43 EXPORT_SYMBOL(__fscache_wait_on_page_write);
46 * note that a page has finished being written to the cache
48 static void fscache_end_page_write(struct fscache_cookie *cookie, struct page *page)
52 spin_lock(&cookie->lock);
53 xpage = radix_tree_delete(&cookie->stores, page->index);
54 spin_unlock(&cookie->lock);
55 ASSERT(xpage != NULL);
57 wake_up_bit(&cookie->flags, 0);
61 * actually apply the changed attributes to a cache object
63 static void fscache_attr_changed_op(struct fscache_operation *op)
65 struct fscache_object *object = op->object;
68 _enter("{OBJ%x OP%x}", object->debug_id, op->debug_id);
70 fscache_stat(&fscache_n_attr_changed_calls);
72 if (fscache_object_is_active(object)) {
73 fscache_set_op_state(op, "CallFS");
74 fscache_stat(&fscache_n_cop_attr_changed);
75 ret = object->cache->ops->attr_changed(object);
76 fscache_stat_d(&fscache_n_cop_attr_changed);
77 fscache_set_op_state(op, "Done");
79 fscache_abort_object(object);
86 * notification that the attributes on an object have changed
88 int __fscache_attr_changed(struct fscache_cookie *cookie)
90 struct fscache_operation *op;
91 struct fscache_object *object;
95 ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX);
97 fscache_stat(&fscache_n_attr_changed);
99 op = kzalloc(sizeof(*op), GFP_KERNEL);
101 fscache_stat(&fscache_n_attr_changed_nomem);
102 _leave(" = -ENOMEM");
106 fscache_operation_init(op, NULL);
107 fscache_operation_init_slow(op, fscache_attr_changed_op);
108 op->flags = FSCACHE_OP_SLOW | (1 << FSCACHE_OP_EXCLUSIVE);
109 fscache_set_op_name(op, "Attr");
111 spin_lock(&cookie->lock);
113 if (hlist_empty(&cookie->backing_objects))
115 object = hlist_entry(cookie->backing_objects.first,
116 struct fscache_object, cookie_link);
118 if (fscache_submit_exclusive_op(object, op) < 0)
120 spin_unlock(&cookie->lock);
121 fscache_stat(&fscache_n_attr_changed_ok);
122 fscache_put_operation(op);
127 spin_unlock(&cookie->lock);
129 fscache_stat(&fscache_n_attr_changed_nobufs);
130 _leave(" = %d", -ENOBUFS);
133 EXPORT_SYMBOL(__fscache_attr_changed);
136 * handle secondary execution given to a retrieval op on behalf of the
139 static void fscache_retrieval_work(struct work_struct *work)
141 struct fscache_retrieval *op =
142 container_of(work, struct fscache_retrieval, op.fast_work);
145 _enter("{OP%x}", op->op.debug_id);
148 op->op.processor(&op->op);
149 fscache_hist(fscache_ops_histogram, start);
150 fscache_put_operation(&op->op);
154 * release a retrieval op reference
156 static void fscache_release_retrieval_op(struct fscache_operation *_op)
158 struct fscache_retrieval *op =
159 container_of(_op, struct fscache_retrieval, op);
161 _enter("{OP%x}", op->op.debug_id);
163 fscache_hist(fscache_retrieval_histogram, op->start_time);
165 fscache_put_context(op->op.object->cookie, op->context);
171 * allocate a retrieval op
173 static struct fscache_retrieval *fscache_alloc_retrieval(
174 struct address_space *mapping,
175 fscache_rw_complete_t end_io_func,
178 struct fscache_retrieval *op;
180 /* allocate a retrieval operation and attempt to submit it */
181 op = kzalloc(sizeof(*op), GFP_NOIO);
183 fscache_stat(&fscache_n_retrievals_nomem);
187 fscache_operation_init(&op->op, fscache_release_retrieval_op);
188 op->op.flags = FSCACHE_OP_MYTHREAD | (1 << FSCACHE_OP_WAITING);
189 op->mapping = mapping;
190 op->end_io_func = end_io_func;
191 op->context = context;
192 op->start_time = jiffies;
193 INIT_WORK(&op->op.fast_work, fscache_retrieval_work);
194 INIT_LIST_HEAD(&op->to_do);
195 fscache_set_op_name(&op->op, "Retr");
200 * wait for a deferred lookup to complete
202 static int fscache_wait_for_deferred_lookup(struct fscache_cookie *cookie)
208 if (!test_bit(FSCACHE_COOKIE_LOOKING_UP, &cookie->flags)) {
209 _leave(" = 0 [imm]");
213 fscache_stat(&fscache_n_retrievals_wait);
216 if (wait_on_bit(&cookie->flags, FSCACHE_COOKIE_LOOKING_UP,
217 fscache_wait_bit_interruptible,
218 TASK_INTERRUPTIBLE) != 0) {
219 fscache_stat(&fscache_n_retrievals_intr);
220 _leave(" = -ERESTARTSYS");
224 ASSERT(!test_bit(FSCACHE_COOKIE_LOOKING_UP, &cookie->flags));
227 fscache_hist(fscache_retrieval_delay_histogram, jif);
228 _leave(" = 0 [dly]");
233 * read a page from the cache or allocate a block in which to store it
235 * -ENOMEM - out of memory, nothing done
236 * -ERESTARTSYS - interrupted
237 * -ENOBUFS - no backing object available in which to cache the block
238 * -ENODATA - no data available in the backing object for this block
239 * 0 - dispatched a read - it'll call end_io_func() when finished
241 int __fscache_read_or_alloc_page(struct fscache_cookie *cookie,
243 fscache_rw_complete_t end_io_func,
247 struct fscache_retrieval *op;
248 struct fscache_object *object;
251 _enter("%p,%p,,,", cookie, page);
253 fscache_stat(&fscache_n_retrievals);
255 if (hlist_empty(&cookie->backing_objects))
258 ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX);
259 ASSERTCMP(page, !=, NULL);
261 if (fscache_wait_for_deferred_lookup(cookie) < 0)
264 op = fscache_alloc_retrieval(page->mapping, end_io_func, context);
266 _leave(" = -ENOMEM");
269 fscache_set_op_name(&op->op, "RetrRA1");
271 spin_lock(&cookie->lock);
273 if (hlist_empty(&cookie->backing_objects))
275 object = hlist_entry(cookie->backing_objects.first,
276 struct fscache_object, cookie_link);
278 ASSERTCMP(object->state, >, FSCACHE_OBJECT_LOOKING_UP);
280 atomic_inc(&object->n_reads);
281 set_bit(FSCACHE_OP_DEC_READ_CNT, &op->op.flags);
283 if (fscache_submit_op(object, &op->op) < 0)
285 spin_unlock(&cookie->lock);
287 fscache_stat(&fscache_n_retrieval_ops);
289 /* pin the netfs read context in case we need to do the actual netfs
290 * read because we've encountered a cache read failure */
291 fscache_get_context(object->cookie, op->context);
293 /* we wait for the operation to become active, and then process it
294 * *here*, in this thread, and not in the thread pool */
295 if (test_bit(FSCACHE_OP_WAITING, &op->op.flags)) {
297 fscache_stat(&fscache_n_retrieval_op_waits);
298 if (wait_on_bit(&op->op.flags, FSCACHE_OP_WAITING,
299 fscache_wait_bit_interruptible,
300 TASK_INTERRUPTIBLE) < 0) {
301 ret = fscache_cancel_op(&op->op);
307 /* it's been removed from the pending queue by another
308 * party, so we should get to run shortly */
309 wait_on_bit(&op->op.flags, FSCACHE_OP_WAITING,
310 fscache_wait_bit, TASK_UNINTERRUPTIBLE);
315 /* ask the cache to honour the operation */
316 if (test_bit(FSCACHE_COOKIE_NO_DATA_YET, &object->cookie->flags)) {
317 fscache_stat(&fscache_n_cop_allocate_page);
318 ret = object->cache->ops->allocate_page(op, page, gfp);
319 fscache_stat_d(&fscache_n_cop_allocate_page);
323 fscache_stat(&fscache_n_cop_read_or_alloc_page);
324 ret = object->cache->ops->read_or_alloc_page(op, page, gfp);
325 fscache_stat_d(&fscache_n_cop_read_or_alloc_page);
330 fscache_stat(&fscache_n_retrievals_nomem);
331 else if (ret == -ERESTARTSYS)
332 fscache_stat(&fscache_n_retrievals_intr);
333 else if (ret == -ENODATA)
334 fscache_stat(&fscache_n_retrievals_nodata);
336 fscache_stat(&fscache_n_retrievals_nobufs);
338 fscache_stat(&fscache_n_retrievals_ok);
340 fscache_put_retrieval(op);
341 _leave(" = %d", ret);
345 spin_unlock(&cookie->lock);
348 fscache_stat(&fscache_n_retrievals_nobufs);
349 _leave(" = -ENOBUFS");
352 EXPORT_SYMBOL(__fscache_read_or_alloc_page);
355 * read a list of page from the cache or allocate a block in which to store
358 * -ENOMEM - out of memory, some pages may be being read
359 * -ERESTARTSYS - interrupted, some pages may be being read
360 * -ENOBUFS - no backing object or space available in which to cache any
361 * pages not being read
362 * -ENODATA - no data available in the backing object for some or all of
364 * 0 - dispatched a read on all pages
366 * end_io_func() will be called for each page read from the cache as it is
367 * finishes being read
369 * any pages for which a read is dispatched will be removed from pages and
372 int __fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
373 struct address_space *mapping,
374 struct list_head *pages,
376 fscache_rw_complete_t end_io_func,
380 struct fscache_retrieval *op;
381 struct fscache_object *object;
384 _enter("%p,,%d,,,", cookie, *nr_pages);
386 fscache_stat(&fscache_n_retrievals);
388 if (hlist_empty(&cookie->backing_objects))
391 ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX);
392 ASSERTCMP(*nr_pages, >, 0);
393 ASSERT(!list_empty(pages));
395 if (fscache_wait_for_deferred_lookup(cookie) < 0)
398 op = fscache_alloc_retrieval(mapping, end_io_func, context);
401 fscache_set_op_name(&op->op, "RetrRAN");
403 spin_lock(&cookie->lock);
405 if (hlist_empty(&cookie->backing_objects))
407 object = hlist_entry(cookie->backing_objects.first,
408 struct fscache_object, cookie_link);
410 atomic_inc(&object->n_reads);
411 set_bit(FSCACHE_OP_DEC_READ_CNT, &op->op.flags);
413 if (fscache_submit_op(object, &op->op) < 0)
415 spin_unlock(&cookie->lock);
417 fscache_stat(&fscache_n_retrieval_ops);
419 /* pin the netfs read context in case we need to do the actual netfs
420 * read because we've encountered a cache read failure */
421 fscache_get_context(object->cookie, op->context);
423 /* we wait for the operation to become active, and then process it
424 * *here*, in this thread, and not in the thread pool */
425 if (test_bit(FSCACHE_OP_WAITING, &op->op.flags)) {
427 fscache_stat(&fscache_n_retrieval_op_waits);
428 if (wait_on_bit(&op->op.flags, FSCACHE_OP_WAITING,
429 fscache_wait_bit_interruptible,
430 TASK_INTERRUPTIBLE) < 0) {
431 ret = fscache_cancel_op(&op->op);
437 /* it's been removed from the pending queue by another
438 * party, so we should get to run shortly */
439 wait_on_bit(&op->op.flags, FSCACHE_OP_WAITING,
440 fscache_wait_bit, TASK_UNINTERRUPTIBLE);
445 /* ask the cache to honour the operation */
446 if (test_bit(FSCACHE_COOKIE_NO_DATA_YET, &object->cookie->flags)) {
447 fscache_stat(&fscache_n_cop_allocate_pages);
448 ret = object->cache->ops->allocate_pages(
449 op, pages, nr_pages, gfp);
450 fscache_stat_d(&fscache_n_cop_allocate_pages);
452 fscache_stat(&fscache_n_cop_read_or_alloc_pages);
453 ret = object->cache->ops->read_or_alloc_pages(
454 op, pages, nr_pages, gfp);
455 fscache_stat_d(&fscache_n_cop_read_or_alloc_pages);
460 fscache_stat(&fscache_n_retrievals_nomem);
461 else if (ret == -ERESTARTSYS)
462 fscache_stat(&fscache_n_retrievals_intr);
463 else if (ret == -ENODATA)
464 fscache_stat(&fscache_n_retrievals_nodata);
466 fscache_stat(&fscache_n_retrievals_nobufs);
468 fscache_stat(&fscache_n_retrievals_ok);
470 fscache_put_retrieval(op);
471 _leave(" = %d", ret);
475 spin_unlock(&cookie->lock);
478 fscache_stat(&fscache_n_retrievals_nobufs);
479 _leave(" = -ENOBUFS");
482 EXPORT_SYMBOL(__fscache_read_or_alloc_pages);
485 * allocate a block in the cache on which to store a page
487 * -ENOMEM - out of memory, nothing done
488 * -ERESTARTSYS - interrupted
489 * -ENOBUFS - no backing object available in which to cache the block
490 * 0 - block allocated
492 int __fscache_alloc_page(struct fscache_cookie *cookie,
496 struct fscache_retrieval *op;
497 struct fscache_object *object;
500 _enter("%p,%p,,,", cookie, page);
502 fscache_stat(&fscache_n_allocs);
504 if (hlist_empty(&cookie->backing_objects))
507 ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX);
508 ASSERTCMP(page, !=, NULL);
510 if (fscache_wait_for_deferred_lookup(cookie) < 0)
513 op = fscache_alloc_retrieval(page->mapping, NULL, NULL);
516 fscache_set_op_name(&op->op, "RetrAL1");
518 spin_lock(&cookie->lock);
520 if (hlist_empty(&cookie->backing_objects))
522 object = hlist_entry(cookie->backing_objects.first,
523 struct fscache_object, cookie_link);
525 if (fscache_submit_op(object, &op->op) < 0)
527 spin_unlock(&cookie->lock);
529 fscache_stat(&fscache_n_alloc_ops);
531 if (test_bit(FSCACHE_OP_WAITING, &op->op.flags)) {
533 fscache_stat(&fscache_n_alloc_op_waits);
534 if (wait_on_bit(&op->op.flags, FSCACHE_OP_WAITING,
535 fscache_wait_bit_interruptible,
536 TASK_INTERRUPTIBLE) < 0) {
537 ret = fscache_cancel_op(&op->op);
543 /* it's been removed from the pending queue by another
544 * party, so we should get to run shortly */
545 wait_on_bit(&op->op.flags, FSCACHE_OP_WAITING,
546 fscache_wait_bit, TASK_UNINTERRUPTIBLE);
551 /* ask the cache to honour the operation */
552 fscache_stat(&fscache_n_cop_allocate_page);
553 ret = object->cache->ops->allocate_page(op, page, gfp);
554 fscache_stat_d(&fscache_n_cop_allocate_page);
557 if (ret == -ERESTARTSYS)
558 fscache_stat(&fscache_n_allocs_intr);
560 fscache_stat(&fscache_n_allocs_nobufs);
562 fscache_stat(&fscache_n_allocs_ok);
564 fscache_put_retrieval(op);
565 _leave(" = %d", ret);
569 spin_unlock(&cookie->lock);
572 fscache_stat(&fscache_n_allocs_nobufs);
573 _leave(" = -ENOBUFS");
576 EXPORT_SYMBOL(__fscache_alloc_page);
579 * release a write op reference
581 static void fscache_release_write_op(struct fscache_operation *_op)
583 _enter("{OP%x}", _op->debug_id);
587 * perform the background storage of a page into the cache
589 static void fscache_write_op(struct fscache_operation *_op)
591 struct fscache_storage *op =
592 container_of(_op, struct fscache_storage, op);
593 struct fscache_object *object = op->op.object;
594 struct fscache_cookie *cookie = object->cookie;
600 _enter("{OP%x,%d}", op->op.debug_id, atomic_read(&op->op.usage));
602 fscache_set_op_state(&op->op, "GetPage");
604 spin_lock(&cookie->lock);
605 spin_lock(&object->lock);
607 if (!fscache_object_is_active(object)) {
608 spin_unlock(&object->lock);
609 spin_unlock(&cookie->lock);
614 fscache_stat(&fscache_n_store_calls);
616 /* find a page to store */
618 n = radix_tree_gang_lookup_tag(&cookie->stores, results, 0, 1,
619 FSCACHE_COOKIE_PENDING_TAG);
623 _debug("gang %d [%lx]", n, page->index);
624 if (page->index > op->store_limit)
627 radix_tree_tag_clear(&cookie->stores, page->index,
628 FSCACHE_COOKIE_PENDING_TAG);
630 spin_unlock(&object->lock);
631 spin_unlock(&cookie->lock);
634 fscache_set_op_state(&op->op, "Store");
635 fscache_stat(&fscache_n_cop_write_page);
636 ret = object->cache->ops->write_page(op, page);
637 fscache_stat_d(&fscache_n_cop_write_page);
638 fscache_set_op_state(&op->op, "EndWrite");
639 fscache_end_page_write(cookie, page);
640 page_cache_release(page);
642 fscache_set_op_state(&op->op, "Abort");
643 fscache_abort_object(object);
645 fscache_enqueue_operation(&op->op);
653 /* this writer is going away and there aren't any more things to
656 clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags);
657 spin_unlock(&object->lock);
658 spin_unlock(&cookie->lock);
663 * request a page be stored in the cache
665 * -ENOMEM - out of memory, nothing done
666 * -ENOBUFS - no backing object available in which to cache the page
667 * 0 - dispatched a write - it'll call end_io_func() when finished
669 * if the cookie still has a backing object at this point, that object can be
670 * in one of a few states with respect to storage processing:
672 * (1) negative lookup, object not yet created (FSCACHE_COOKIE_CREATING is
675 * (a) no writes yet (set FSCACHE_COOKIE_PENDING_FILL and queue deferred
678 * (b) writes deferred till post-creation (mark page for writing and
679 * return immediately)
681 * (2) negative lookup, object created, initial fill being made from netfs
682 * (FSCACHE_COOKIE_INITIAL_FILL is set)
684 * (a) fill point not yet reached this page (mark page for writing and
687 * (b) fill point passed this page (queue op to store this page)
689 * (3) object extant (queue op to store this page)
691 * any other state is invalid
693 int __fscache_write_page(struct fscache_cookie *cookie,
697 struct fscache_storage *op;
698 struct fscache_object *object;
701 _enter("%p,%x,", cookie, (u32) page->flags);
703 ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX);
704 ASSERT(PageFsCache(page));
706 fscache_stat(&fscache_n_stores);
708 op = kzalloc(sizeof(*op), GFP_NOIO);
712 fscache_operation_init(&op->op, fscache_release_write_op);
713 fscache_operation_init_slow(&op->op, fscache_write_op);
714 op->op.flags = FSCACHE_OP_SLOW | (1 << FSCACHE_OP_WAITING);
715 fscache_set_op_name(&op->op, "Write1");
717 ret = radix_tree_preload(gfp & ~__GFP_HIGHMEM);
722 spin_lock(&cookie->lock);
724 if (hlist_empty(&cookie->backing_objects))
726 object = hlist_entry(cookie->backing_objects.first,
727 struct fscache_object, cookie_link);
728 if (test_bit(FSCACHE_IOERROR, &object->cache->flags))
731 /* add the page to the pending-storage radix tree on the backing
733 spin_lock(&object->lock);
735 _debug("store limit %llx", (unsigned long long) object->store_limit);
737 ret = radix_tree_insert(&cookie->stores, page->index, page);
741 _debug("insert failed %d", ret);
742 goto nobufs_unlock_obj;
745 radix_tree_tag_set(&cookie->stores, page->index,
746 FSCACHE_COOKIE_PENDING_TAG);
747 page_cache_get(page);
749 /* we only want one writer at a time, but we do need to queue new
750 * writers after exclusive ops */
751 if (test_and_set_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags))
752 goto already_pending;
754 spin_unlock(&object->lock);
756 op->op.debug_id = atomic_inc_return(&fscache_op_debug_id);
757 op->store_limit = object->store_limit;
759 if (fscache_submit_op(object, &op->op) < 0)
762 spin_unlock(&cookie->lock);
763 radix_tree_preload_end();
764 fscache_stat(&fscache_n_store_ops);
765 fscache_stat(&fscache_n_stores_ok);
767 /* the slow work queue now carries its own ref on the object */
768 fscache_put_operation(&op->op);
773 fscache_stat(&fscache_n_stores_again);
775 spin_unlock(&object->lock);
776 spin_unlock(&cookie->lock);
777 radix_tree_preload_end();
779 fscache_stat(&fscache_n_stores_ok);
784 radix_tree_delete(&cookie->stores, page->index);
785 page_cache_release(page);
790 spin_unlock(&object->lock);
792 spin_unlock(&cookie->lock);
793 radix_tree_preload_end();
795 fscache_stat(&fscache_n_stores_nobufs);
796 _leave(" = -ENOBUFS");
802 fscache_stat(&fscache_n_stores_oom);
803 _leave(" = -ENOMEM");
806 EXPORT_SYMBOL(__fscache_write_page);
809 * remove a page from the cache
811 void __fscache_uncache_page(struct fscache_cookie *cookie, struct page *page)
813 struct fscache_object *object;
817 ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX);
818 ASSERTCMP(page, !=, NULL);
820 fscache_stat(&fscache_n_uncaches);
822 /* cache withdrawal may beat us to it */
823 if (!PageFsCache(page))
827 spin_lock(&cookie->lock);
829 if (hlist_empty(&cookie->backing_objects)) {
830 ClearPageFsCache(page);
834 object = hlist_entry(cookie->backing_objects.first,
835 struct fscache_object, cookie_link);
837 /* there might now be stuff on disk we could read */
838 clear_bit(FSCACHE_COOKIE_NO_DATA_YET, &cookie->flags);
840 /* only invoke the cache backend if we managed to mark the page
841 * uncached here; this deals with synchronisation vs withdrawal */
842 if (TestClearPageFsCache(page) &&
843 object->cache->ops->uncache_page) {
844 /* the cache backend releases the cookie lock */
845 fscache_stat(&fscache_n_cop_uncache_page);
846 object->cache->ops->uncache_page(object, page);
847 fscache_stat_d(&fscache_n_cop_uncache_page);
852 spin_unlock(&cookie->lock);
856 EXPORT_SYMBOL(__fscache_uncache_page);
859 * fscache_mark_pages_cached - Mark pages as being cached
860 * @op: The retrieval op pages are being marked for
861 * @pagevec: The pages to be marked
863 * Mark a bunch of netfs pages as being cached. After this is called,
864 * the netfs must call fscache_uncache_page() to remove the mark.
866 void fscache_mark_pages_cached(struct fscache_retrieval *op,
867 struct pagevec *pagevec)
869 struct fscache_cookie *cookie = op->op.object->cookie;
872 #ifdef CONFIG_FSCACHE_STATS
873 atomic_add(pagevec->nr, &fscache_n_marks);
876 for (loop = 0; loop < pagevec->nr; loop++) {
877 struct page *page = pagevec->pages[loop];
879 _debug("- mark %p{%lx}", page, page->index);
880 if (TestSetPageFsCache(page)) {
881 static bool once_only;
884 printk(KERN_WARNING "FS-Cache:"
885 " Cookie type %s marked page %lx"
887 cookie->def->name, page->index);
892 if (cookie->def->mark_pages_cached)
893 cookie->def->mark_pages_cached(cookie->netfs_data,
894 op->mapping, pagevec);
895 pagevec_reinit(pagevec);
897 EXPORT_SYMBOL(fscache_mark_pages_cached);