1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* handling of writes to regular files and writing back to the server
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
8 #include <linux/backing-dev.h>
9 #include <linux/slab.h>
11 #include <linux/pagemap.h>
12 #include <linux/writeback.h>
13 #include <linux/pagevec.h>
14 #include <linux/netfs.h>
17 static void afs_write_to_cache(struct afs_vnode *vnode, loff_t start, size_t len,
18 loff_t i_size, bool caching);
20 #ifdef CONFIG_AFS_FSCACHE
22 * Mark a page as having been made dirty and thus needing writeback. We also
23 * need to pin the cache object to write back to.
25 bool afs_dirty_folio(struct address_space *mapping, struct folio *folio)
27 return fscache_dirty_folio(mapping, folio,
28 afs_vnode_cache(AFS_FS_I(mapping->host)));
30 static void afs_folio_start_fscache(bool caching, struct folio *folio)
33 folio_start_fscache(folio);
36 static void afs_folio_start_fscache(bool caching, struct folio *folio)
42 * prepare to perform part of a write to a page
44 int afs_write_begin(struct file *file, struct address_space *mapping,
45 loff_t pos, unsigned len, unsigned flags,
46 struct page **_page, void **fsdata)
48 struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
56 _enter("{%llx:%llu},%llx,%x",
57 vnode->fid.vid, vnode->fid.vnode, pos, len);
59 /* Prefetch area to be written into the cache if we're caching this
60 * file. We need to do this before we get a lock on the page in case
61 * there's more than one writer competing for the same cache block.
63 ret = netfs_write_begin(file, mapping, pos, len, flags, &folio, fsdata,
68 index = folio_index(folio);
69 from = pos - index * PAGE_SIZE;
73 /* See if this page is already partially written in a way that we can
74 * merge the new write with.
76 if (folio_test_private(folio)) {
77 priv = (unsigned long)folio_get_private(folio);
78 f = afs_folio_dirty_from(folio, priv);
79 t = afs_folio_dirty_to(folio, priv);
82 if (folio_test_writeback(folio)) {
83 trace_afs_folio_dirty(vnode, tracepoint_string("alrdy"), folio);
84 goto flush_conflicting_write;
86 /* If the file is being filled locally, allow inter-write
87 * spaces to be merged into writes. If it's not, only write
88 * back what the user gives us.
90 if (!test_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags) &&
92 goto flush_conflicting_write;
95 *_page = &folio->page;
99 /* The previous write and this write aren't adjacent or overlapping, so
100 * flush the page out.
102 flush_conflicting_write:
103 _debug("flush conflict");
104 ret = folio_write_one(folio);
108 ret = folio_lock_killable(folio);
115 _leave(" = %d", ret);
120 * finalise part of a write to a page
122 int afs_write_end(struct file *file, struct address_space *mapping,
123 loff_t pos, unsigned len, unsigned copied,
124 struct page *subpage, void *fsdata)
126 struct folio *folio = page_folio(subpage);
127 struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
129 unsigned int f, from = offset_in_folio(folio, pos);
130 unsigned int t, to = from + copied;
131 loff_t i_size, write_end_pos;
133 _enter("{%llx:%llu},{%lx}",
134 vnode->fid.vid, vnode->fid.vnode, folio_index(folio));
136 if (!folio_test_uptodate(folio)) {
142 folio_mark_uptodate(folio);
148 write_end_pos = pos + copied;
150 i_size = i_size_read(&vnode->vfs_inode);
151 if (write_end_pos > i_size) {
152 write_seqlock(&vnode->cb_lock);
153 i_size = i_size_read(&vnode->vfs_inode);
154 if (write_end_pos > i_size)
155 afs_set_i_size(vnode, write_end_pos);
156 write_sequnlock(&vnode->cb_lock);
157 fscache_update_cookie(afs_vnode_cache(vnode), NULL, &write_end_pos);
160 if (folio_test_private(folio)) {
161 priv = (unsigned long)folio_get_private(folio);
162 f = afs_folio_dirty_from(folio, priv);
163 t = afs_folio_dirty_to(folio, priv);
168 priv = afs_folio_dirty(folio, f, t);
169 folio_change_private(folio, (void *)priv);
170 trace_afs_folio_dirty(vnode, tracepoint_string("dirty+"), folio);
172 priv = afs_folio_dirty(folio, from, to);
173 folio_attach_private(folio, (void *)priv);
174 trace_afs_folio_dirty(vnode, tracepoint_string("dirty"), folio);
177 if (folio_mark_dirty(folio))
178 _debug("dirtied %lx", folio_index(folio));
187 * kill all the pages in the given range
189 static void afs_kill_pages(struct address_space *mapping,
190 loff_t start, loff_t len)
192 struct afs_vnode *vnode = AFS_FS_I(mapping->host);
194 pgoff_t index = start / PAGE_SIZE;
195 pgoff_t last = (start + len - 1) / PAGE_SIZE, next;
197 _enter("{%llx:%llu},%llx @%llx",
198 vnode->fid.vid, vnode->fid.vnode, len, start);
201 _debug("kill %lx (to %lx)", index, last);
203 folio = filemap_get_folio(mapping, index);
209 next = folio_next_index(folio);
211 folio_clear_uptodate(folio);
212 folio_end_writeback(folio);
214 generic_error_remove_page(mapping, &folio->page);
218 } while (index = next, index <= last);
224 * Redirty all the pages in a given range.
226 static void afs_redirty_pages(struct writeback_control *wbc,
227 struct address_space *mapping,
228 loff_t start, loff_t len)
230 struct afs_vnode *vnode = AFS_FS_I(mapping->host);
232 pgoff_t index = start / PAGE_SIZE;
233 pgoff_t last = (start + len - 1) / PAGE_SIZE, next;
235 _enter("{%llx:%llu},%llx @%llx",
236 vnode->fid.vid, vnode->fid.vnode, len, start);
239 _debug("redirty %llx @%llx", len, start);
241 folio = filemap_get_folio(mapping, index);
247 next = index + folio_nr_pages(folio);
248 folio_redirty_for_writepage(wbc, folio);
249 folio_end_writeback(folio);
251 } while (index = next, index <= last);
257 * completion of write to server
259 static void afs_pages_written_back(struct afs_vnode *vnode, loff_t start, unsigned int len)
261 struct address_space *mapping = vnode->vfs_inode.i_mapping;
265 XA_STATE(xas, &mapping->i_pages, start / PAGE_SIZE);
267 _enter("{%llx:%llu},{%x @%llx}",
268 vnode->fid.vid, vnode->fid.vnode, len, start);
272 end = (start + len - 1) / PAGE_SIZE;
273 xas_for_each(&xas, folio, end) {
274 if (!folio_test_writeback(folio)) {
275 kdebug("bad %x @%llx page %lx %lx",
276 len, start, folio_index(folio), end);
277 ASSERT(folio_test_writeback(folio));
280 trace_afs_folio_dirty(vnode, tracepoint_string("clear"), folio);
281 folio_detach_private(folio);
282 folio_end_writeback(folio);
287 afs_prune_wb_keys(vnode);
292 * Find a key to use for the writeback. We cached the keys used to author the
293 * writes on the vnode. *_wbk will contain the last writeback key used or NULL
294 * and we need to start from there if it's set.
296 static int afs_get_writeback_key(struct afs_vnode *vnode,
297 struct afs_wb_key **_wbk)
299 struct afs_wb_key *wbk = NULL;
301 int ret = -ENOKEY, ret2;
303 spin_lock(&vnode->wb_lock);
305 p = (*_wbk)->vnode_link.next;
307 p = vnode->wb_keys.next;
309 while (p != &vnode->wb_keys) {
310 wbk = list_entry(p, struct afs_wb_key, vnode_link);
311 _debug("wbk %u", key_serial(wbk->key));
312 ret2 = key_validate(wbk->key);
314 refcount_inc(&wbk->usage);
315 _debug("USE WB KEY %u", key_serial(wbk->key));
325 spin_unlock(&vnode->wb_lock);
327 afs_put_wb_key(*_wbk);
332 static void afs_store_data_success(struct afs_operation *op)
334 struct afs_vnode *vnode = op->file[0].vnode;
336 op->ctime = op->file[0].scb.status.mtime_client;
337 afs_vnode_commit_status(op, &op->file[0]);
338 if (op->error == 0) {
339 if (!op->store.laundering)
340 afs_pages_written_back(vnode, op->store.pos, op->store.size);
341 afs_stat_v(vnode, n_stores);
342 atomic_long_add(op->store.size, &afs_v2net(vnode)->n_store_bytes);
346 static const struct afs_operation_ops afs_store_data_operation = {
347 .issue_afs_rpc = afs_fs_store_data,
348 .issue_yfs_rpc = yfs_fs_store_data,
349 .success = afs_store_data_success,
355 static int afs_store_data(struct afs_vnode *vnode, struct iov_iter *iter, loff_t pos,
358 struct afs_operation *op;
359 struct afs_wb_key *wbk = NULL;
360 loff_t size = iov_iter_count(iter), i_size;
363 _enter("%s{%llx:%llu.%u},%llx,%llx",
370 ret = afs_get_writeback_key(vnode, &wbk);
372 _leave(" = %d [no keys]", ret);
376 op = afs_alloc_operation(wbk->key, vnode->volume);
382 i_size = i_size_read(&vnode->vfs_inode);
384 afs_op_set_vnode(op, 0, vnode);
385 op->file[0].dv_delta = 1;
386 op->file[0].modification = true;
387 op->store.write_iter = iter;
389 op->store.size = size;
390 op->store.i_size = max(pos + size, i_size);
391 op->store.laundering = laundering;
392 op->mtime = vnode->vfs_inode.i_mtime;
393 op->flags |= AFS_OPERATION_UNINTR;
394 op->ops = &afs_store_data_operation;
397 afs_begin_vnode_operation(op);
398 afs_wait_for_operation(op);
409 ret = afs_get_writeback_key(vnode, &wbk);
412 op->key = key_get(wbk->key);
419 _leave(" = %d", op->error);
420 return afs_put_operation(op);
424 * Extend the region to be written back to include subsequent contiguously
425 * dirty pages if possible, but don't sleep while doing so.
427 * If this page holds new content, then we can include filler zeros in the
430 static void afs_extend_writeback(struct address_space *mapping,
431 struct afs_vnode *vnode,
442 unsigned int psize, filler = 0;
445 pgoff_t index = (start + len) / PAGE_SIZE;
449 XA_STATE(xas, &mapping->i_pages, index);
453 /* Firstly, we gather up a batch of contiguous dirty pages
454 * under the RCU read lock - but we can't clear the dirty flags
455 * there if any of those pages are mapped.
459 xas_for_each(&xas, folio, ULONG_MAX) {
461 if (xas_retry(&xas, folio))
463 if (xa_is_value(folio))
465 if (folio_index(folio) != index)
468 if (!folio_try_get_rcu(folio)) {
473 /* Has the page moved or been split? */
474 if (unlikely(folio != xas_reload(&xas))) {
479 if (!folio_trylock(folio)) {
483 if (!folio_test_dirty(folio) ||
484 folio_test_writeback(folio) ||
485 folio_test_fscache(folio)) {
491 psize = folio_size(folio);
492 priv = (unsigned long)folio_get_private(folio);
493 f = afs_folio_dirty_from(folio, priv);
494 t = afs_folio_dirty_to(folio, priv);
495 if (f != 0 && !new_content) {
503 if (len >= max_len || *_count <= 0)
505 else if (t == psize || new_content)
508 index += folio_nr_pages(folio);
509 if (!pagevec_add(&pvec, &folio->page))
519 /* Now, if we obtained any pages, we can shift them to being
520 * writable and mark them for caching.
522 if (!pagevec_count(&pvec))
525 for (i = 0; i < pagevec_count(&pvec); i++) {
526 folio = page_folio(pvec.pages[i]);
527 trace_afs_folio_dirty(vnode, tracepoint_string("store+"), folio);
529 if (!folio_clear_dirty_for_io(folio))
531 if (folio_start_writeback(folio))
533 afs_folio_start_fscache(caching, folio);
535 *_count -= folio_nr_pages(folio);
539 pagevec_release(&pvec);
547 * Synchronously write back the locked page and any subsequent non-locked dirty
550 static ssize_t afs_write_back_from_locked_folio(struct address_space *mapping,
551 struct writeback_control *wbc,
553 loff_t start, loff_t end)
555 struct afs_vnode *vnode = AFS_FS_I(mapping->host);
556 struct iov_iter iter;
558 unsigned int offset, to, len, max_len;
559 loff_t i_size = i_size_read(&vnode->vfs_inode);
560 bool new_content = test_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags);
561 bool caching = fscache_cookie_enabled(afs_vnode_cache(vnode));
562 long count = wbc->nr_to_write;
565 _enter(",%lx,%llx-%llx", folio_index(folio), start, end);
567 if (folio_start_writeback(folio))
569 afs_folio_start_fscache(caching, folio);
571 count -= folio_nr_pages(folio);
573 /* Find all consecutive lockable dirty pages that have contiguous
574 * written regions, stopping when we find a page that is not
575 * immediately lockable, is not dirty or is missing, or we reach the
578 priv = (unsigned long)folio_get_private(folio);
579 offset = afs_folio_dirty_from(folio, priv);
580 to = afs_folio_dirty_to(folio, priv);
581 trace_afs_folio_dirty(vnode, tracepoint_string("store"), folio);
585 if (start < i_size) {
586 /* Trim the write to the EOF; the extra data is ignored. Also
587 * put an upper limit on the size of a single storedata op.
589 max_len = 65536 * 4096;
590 max_len = min_t(unsigned long long, max_len, end - start + 1);
591 max_len = min_t(unsigned long long, max_len, i_size - start);
594 (to == folio_size(folio) || new_content))
595 afs_extend_writeback(mapping, vnode, &count,
596 start, max_len, new_content,
598 len = min_t(loff_t, len, max_len);
601 /* We now have a contiguous set of dirty pages, each with writeback
602 * set; the first page is still locked at this point, but all the rest
603 * have been unlocked.
607 if (start < i_size) {
608 _debug("write back %x @%llx [%llx]", len, start, i_size);
610 /* Speculatively write to the cache. We have to fix this up
611 * later if the store fails.
613 afs_write_to_cache(vnode, start, len, i_size, caching);
615 iov_iter_xarray(&iter, WRITE, &mapping->i_pages, start, len);
616 ret = afs_store_data(vnode, &iter, start, false);
618 _debug("write discard %x @%llx [%llx]", len, start, i_size);
620 /* The dirty region was entirely beyond the EOF. */
621 fscache_clear_page_bits(afs_vnode_cache(vnode),
622 mapping, start, len, caching);
623 afs_pages_written_back(vnode, start, len);
629 wbc->nr_to_write = count;
634 pr_notice("kAFS: Unexpected error from FS.StoreData %d\n", ret);
642 afs_redirty_pages(wbc, mapping, start, len);
643 mapping_set_error(mapping, ret);
648 afs_redirty_pages(wbc, mapping, start, len);
649 mapping_set_error(mapping, -ENOSPC);
659 trace_afs_file_error(vnode, ret, afs_file_error_writeback_fail);
660 afs_kill_pages(mapping, start, len);
661 mapping_set_error(mapping, ret);
665 _leave(" = %d", ret);
670 * write a page back to the server
671 * - the caller locked the page for us
673 int afs_writepage(struct page *subpage, struct writeback_control *wbc)
675 struct folio *folio = page_folio(subpage);
679 _enter("{%lx},", folio_index(folio));
681 #ifdef CONFIG_AFS_FSCACHE
682 folio_wait_fscache(folio);
685 start = folio_index(folio) * PAGE_SIZE;
686 ret = afs_write_back_from_locked_folio(folio_mapping(folio), wbc,
687 folio, start, LLONG_MAX - start);
689 _leave(" = %zd", ret);
698 * write a region of pages back to the server
700 static int afs_writepages_region(struct address_space *mapping,
701 struct writeback_control *wbc,
702 loff_t start, loff_t end, loff_t *_next)
705 struct page *head_page;
709 _enter("%llx,%llx,", start, end);
712 pgoff_t index = start / PAGE_SIZE;
714 n = find_get_pages_range_tag(mapping, &index, end / PAGE_SIZE,
715 PAGECACHE_TAG_DIRTY, 1, &head_page);
719 folio = page_folio(head_page);
720 start = folio_pos(folio); /* May regress with THPs */
722 _debug("wback %lx", folio_index(folio));
724 /* At this point we hold neither the i_pages lock nor the
725 * page lock: the page may be truncated or invalidated
726 * (changing page->mapping to NULL), or even swizzled
727 * back from swapper_space to tmpfs file mapping
729 if (wbc->sync_mode != WB_SYNC_NONE) {
730 ret = folio_lock_killable(folio);
736 if (!folio_trylock(folio)) {
742 if (folio_mapping(folio) != mapping ||
743 !folio_test_dirty(folio)) {
744 start += folio_size(folio);
750 if (folio_test_writeback(folio) ||
751 folio_test_fscache(folio)) {
753 if (wbc->sync_mode != WB_SYNC_NONE) {
754 folio_wait_writeback(folio);
755 #ifdef CONFIG_AFS_FSCACHE
756 folio_wait_fscache(folio);
759 start += folio_size(folio);
762 if (wbc->sync_mode == WB_SYNC_NONE) {
763 if (skips >= 5 || need_resched())
770 if (!folio_clear_dirty_for_io(folio))
772 ret = afs_write_back_from_locked_folio(mapping, wbc, folio, start, end);
775 _leave(" = %zd", ret);
782 } while (wbc->nr_to_write > 0);
785 _leave(" = 0 [%llx]", *_next);
790 * write some of the pending data back to the server
792 int afs_writepages(struct address_space *mapping,
793 struct writeback_control *wbc)
795 struct afs_vnode *vnode = AFS_FS_I(mapping->host);
801 /* We have to be careful as we can end up racing with setattr()
802 * truncating the pagecache since the caller doesn't take a lock here
805 if (wbc->sync_mode == WB_SYNC_ALL)
806 down_read(&vnode->validate_lock);
807 else if (!down_read_trylock(&vnode->validate_lock))
810 if (wbc->range_cyclic) {
811 start = mapping->writeback_index * PAGE_SIZE;
812 ret = afs_writepages_region(mapping, wbc, start, LLONG_MAX, &next);
814 mapping->writeback_index = next / PAGE_SIZE;
815 if (start > 0 && wbc->nr_to_write > 0) {
816 ret = afs_writepages_region(mapping, wbc, 0,
819 mapping->writeback_index =
823 } else if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) {
824 ret = afs_writepages_region(mapping, wbc, 0, LLONG_MAX, &next);
825 if (wbc->nr_to_write > 0 && ret == 0)
826 mapping->writeback_index = next / PAGE_SIZE;
828 ret = afs_writepages_region(mapping, wbc,
829 wbc->range_start, wbc->range_end, &next);
832 up_read(&vnode->validate_lock);
833 _leave(" = %d", ret);
838 * write to an AFS file
840 ssize_t afs_file_write(struct kiocb *iocb, struct iov_iter *from)
842 struct afs_vnode *vnode = AFS_FS_I(file_inode(iocb->ki_filp));
843 struct afs_file *af = iocb->ki_filp->private_data;
845 size_t count = iov_iter_count(from);
847 _enter("{%llx:%llu},{%zu},",
848 vnode->fid.vid, vnode->fid.vnode, count);
850 if (IS_SWAPFILE(&vnode->vfs_inode)) {
852 "AFS: Attempt to write to active swap file!\n");
859 result = afs_validate(vnode, af->key);
863 result = generic_file_write_iter(iocb, from);
865 _leave(" = %zd", result);
870 * flush any dirty pages for this process, and check for write errors.
871 * - the return status from this call provides a reliable indication of
872 * whether any write errors occurred for this process.
874 int afs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
876 struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
877 struct afs_file *af = file->private_data;
880 _enter("{%llx:%llu},{n=%pD},%d",
881 vnode->fid.vid, vnode->fid.vnode, file,
884 ret = afs_validate(vnode, af->key);
888 return file_write_and_wait_range(file, start, end);
892 * notification that a previously read-only page is about to become writable
893 * - if it returns an error, the caller will deliver a bus error signal
895 vm_fault_t afs_page_mkwrite(struct vm_fault *vmf)
897 struct folio *folio = page_folio(vmf->page);
898 struct file *file = vmf->vma->vm_file;
899 struct inode *inode = file_inode(file);
900 struct afs_vnode *vnode = AFS_FS_I(inode);
901 struct afs_file *af = file->private_data;
903 vm_fault_t ret = VM_FAULT_RETRY;
905 _enter("{{%llx:%llu}},{%lx}", vnode->fid.vid, vnode->fid.vnode, folio_index(folio));
907 afs_validate(vnode, af->key);
909 sb_start_pagefault(inode->i_sb);
911 /* Wait for the page to be written to the cache before we allow it to
912 * be modified. We then assume the entire page will need writing back.
914 #ifdef CONFIG_AFS_FSCACHE
915 if (folio_test_fscache(folio) &&
916 folio_wait_fscache_killable(folio) < 0)
920 if (folio_wait_writeback_killable(folio))
923 if (folio_lock_killable(folio) < 0)
926 /* We mustn't change folio->private until writeback is complete as that
927 * details the portion of the page we need to write back and we might
928 * need to redirty the page if there's a problem.
930 if (folio_wait_writeback_killable(folio) < 0) {
935 priv = afs_folio_dirty(folio, 0, folio_size(folio));
936 priv = afs_folio_dirty_mmapped(priv);
937 if (folio_test_private(folio)) {
938 folio_change_private(folio, (void *)priv);
939 trace_afs_folio_dirty(vnode, tracepoint_string("mkwrite+"), folio);
941 folio_attach_private(folio, (void *)priv);
942 trace_afs_folio_dirty(vnode, tracepoint_string("mkwrite"), folio);
944 file_update_time(file);
946 ret = VM_FAULT_LOCKED;
948 sb_end_pagefault(inode->i_sb);
953 * Prune the keys cached for writeback. The caller must hold vnode->wb_lock.
955 void afs_prune_wb_keys(struct afs_vnode *vnode)
957 LIST_HEAD(graveyard);
958 struct afs_wb_key *wbk, *tmp;
960 /* Discard unused keys */
961 spin_lock(&vnode->wb_lock);
963 if (!mapping_tagged(&vnode->vfs_inode.i_data, PAGECACHE_TAG_WRITEBACK) &&
964 !mapping_tagged(&vnode->vfs_inode.i_data, PAGECACHE_TAG_DIRTY)) {
965 list_for_each_entry_safe(wbk, tmp, &vnode->wb_keys, vnode_link) {
966 if (refcount_read(&wbk->usage) == 1)
967 list_move(&wbk->vnode_link, &graveyard);
971 spin_unlock(&vnode->wb_lock);
973 while (!list_empty(&graveyard)) {
974 wbk = list_entry(graveyard.next, struct afs_wb_key, vnode_link);
975 list_del(&wbk->vnode_link);
981 * Clean up a page during invalidation.
983 int afs_launder_folio(struct folio *folio)
985 struct afs_vnode *vnode = AFS_FS_I(folio_inode(folio));
986 struct iov_iter iter;
987 struct bio_vec bv[1];
992 _enter("{%lx}", folio->index);
994 priv = (unsigned long)folio_get_private(folio);
995 if (folio_clear_dirty_for_io(folio)) {
997 t = folio_size(folio);
998 if (folio_test_private(folio)) {
999 f = afs_folio_dirty_from(folio, priv);
1000 t = afs_folio_dirty_to(folio, priv);
1003 bv[0].bv_page = &folio->page;
1004 bv[0].bv_offset = f;
1005 bv[0].bv_len = t - f;
1006 iov_iter_bvec(&iter, WRITE, bv, 1, bv[0].bv_len);
1008 trace_afs_folio_dirty(vnode, tracepoint_string("launder"), folio);
1009 ret = afs_store_data(vnode, &iter, folio_pos(folio) + f, true);
1012 trace_afs_folio_dirty(vnode, tracepoint_string("laundered"), folio);
1013 folio_detach_private(folio);
1014 folio_wait_fscache(folio);
1019 * Deal with the completion of writing the data to the cache.
1021 static void afs_write_to_cache_done(void *priv, ssize_t transferred_or_error,
1024 struct afs_vnode *vnode = priv;
1026 if (IS_ERR_VALUE(transferred_or_error) &&
1027 transferred_or_error != -ENOBUFS)
1028 afs_invalidate_cache(vnode, 0);
1032 * Save the write to the cache also.
1034 static void afs_write_to_cache(struct afs_vnode *vnode,
1035 loff_t start, size_t len, loff_t i_size,
1038 fscache_write_to_cache(afs_vnode_cache(vnode),
1039 vnode->vfs_inode.i_mapping, start, len, i_size,
1040 afs_write_to_cache_done, vnode, caching);