write.c (e87b03f5830ecd8ca21836d3ee48c74f8d58fa31) write.c (5cbf03985c67c7f0ac8c5382cf5d4d0d630f95f3)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* handling of writes to regular files and writing back to the server
3 *
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#include <linux/backing-dev.h>

--- 916 unchanged lines hidden (view full) ---

925
926 sb_start_pagefault(inode->i_sb);
927
928 /* Wait for the page to be written to the cache before we allow it to
929 * be modified. We then assume the entire page will need writing back.
930 */
931#ifdef CONFIG_AFS_FSCACHE
932 if (PageFsCache(page) &&
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* handling of writes to regular files and writing back to the server
3 *
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#include <linux/backing-dev.h>

--- 916 unchanged lines hidden (view full) ---

925
926 sb_start_pagefault(inode->i_sb);
927
928 /* Wait for the page to be written to the cache before we allow it to
929 * be modified. We then assume the entire page will need writing back.
930 */
931#ifdef CONFIG_AFS_FSCACHE
932 if (PageFsCache(page) &&
933 wait_on_page_bit_killable(page, PG_fscache) < 0)
933 wait_on_page_fscache_killable(page) < 0)
934 return VM_FAULT_RETRY;
935#endif
936
937 if (wait_on_page_writeback_killable(page))
938 return VM_FAULT_RETRY;
939
940 if (lock_page_killable(page) < 0)
941 return VM_FAULT_RETRY;
942
943 /* We mustn't change page->private until writeback is complete as that
944 * details the portion of the page we need to write back and we might
945 * need to redirty the page if there's a problem.
946 */
934 return VM_FAULT_RETRY;
935#endif
936
937 if (wait_on_page_writeback_killable(page))
938 return VM_FAULT_RETRY;
939
940 if (lock_page_killable(page) < 0)
941 return VM_FAULT_RETRY;
942
943 /* We mustn't change page->private until writeback is complete as that
944 * details the portion of the page we need to write back and we might
945 * need to redirty the page if there's a problem.
946 */
947 wait_on_page_writeback(page);
947 if (wait_on_page_writeback_killable(page) < 0) {
948 unlock_page(page);
949 return VM_FAULT_RETRY;
950 }
948
949 priv = afs_page_dirty(page, 0, thp_size(page));
950 priv = afs_page_dirty_mmapped(priv);
951 if (PagePrivate(page)) {
952 set_page_private(page, priv);
953 trace_afs_page_dirty(vnode, tracepoint_string("mkwrite+"), page);
954 } else {
955 attach_page_private(page, (void *)priv);

--- 75 unchanged lines hidden ---
951
952 priv = afs_page_dirty(page, 0, thp_size(page));
953 priv = afs_page_dirty_mmapped(priv);
954 if (PagePrivate(page)) {
955 set_page_private(page, priv);
956 trace_afs_page_dirty(vnode, tracepoint_string("mkwrite+"), page);
957 } else {
958 attach_page_private(page, (void *)priv);

--- 75 unchanged lines hidden ---