file.c (a0292f3ebe63f8ed7ea28de57751f6bfb9416242) file.c (75bd228d5637b58e24119a263c1b4e4a875d9498)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* AFS filesystem file handling
3 *
4 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#include <linux/kernel.h>

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

14#include <linux/gfp.h>
15#include <linux/task_io_accounting_ops.h>
16#include <linux/mm.h>
17#include <linux/netfs.h>
18#include "internal.h"
19
20static int afs_file_mmap(struct file *file, struct vm_area_struct *vma);
21static int afs_readpage(struct file *file, struct page *page);
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* AFS filesystem file handling
3 *
4 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#include <linux/kernel.h>

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

14#include <linux/gfp.h>
15#include <linux/task_io_accounting_ops.h>
16#include <linux/mm.h>
17#include <linux/netfs.h>
18#include "internal.h"
19
20static int afs_file_mmap(struct file *file, struct vm_area_struct *vma);
21static int afs_readpage(struct file *file, struct page *page);
22static int afs_symlink_readpage(struct file *file, struct page *page);
22static void afs_invalidatepage(struct page *page, unsigned int offset,
23 unsigned int length);
24static int afs_releasepage(struct page *page, gfp_t gfp_flags);
25
26static void afs_readahead(struct readahead_control *ractl);
27static ssize_t afs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter);
28static void afs_vm_open(struct vm_area_struct *area);
29static void afs_vm_close(struct vm_area_struct *area);

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

44};
45
46const struct inode_operations afs_file_inode_operations = {
47 .getattr = afs_getattr,
48 .setattr = afs_setattr,
49 .permission = afs_permission,
50};
51
23static void afs_invalidatepage(struct page *page, unsigned int offset,
24 unsigned int length);
25static int afs_releasepage(struct page *page, gfp_t gfp_flags);
26
27static void afs_readahead(struct readahead_control *ractl);
28static ssize_t afs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter);
29static void afs_vm_open(struct vm_area_struct *area);
30static void afs_vm_close(struct vm_area_struct *area);

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

45};
46
47const struct inode_operations afs_file_inode_operations = {
48 .getattr = afs_getattr,
49 .setattr = afs_setattr,
50 .permission = afs_permission,
51};
52
52const struct address_space_operations afs_fs_aops = {
53const struct address_space_operations afs_file_aops = {
53 .readpage = afs_readpage,
54 .readahead = afs_readahead,
55 .set_page_dirty = afs_set_page_dirty,
56 .launder_page = afs_launder_page,
57 .releasepage = afs_releasepage,
58 .invalidatepage = afs_invalidatepage,
59 .write_begin = afs_write_begin,
60 .write_end = afs_write_end,
61 .writepage = afs_writepage,
62 .writepages = afs_writepages,
63};
64
54 .readpage = afs_readpage,
55 .readahead = afs_readahead,
56 .set_page_dirty = afs_set_page_dirty,
57 .launder_page = afs_launder_page,
58 .releasepage = afs_releasepage,
59 .invalidatepage = afs_invalidatepage,
60 .write_begin = afs_write_begin,
61 .write_end = afs_write_end,
62 .writepage = afs_writepage,
63 .writepages = afs_writepages,
64};
65
66const struct address_space_operations afs_symlink_aops = {
67 .readpage = afs_symlink_readpage,
68 .releasepage = afs_releasepage,
69 .invalidatepage = afs_invalidatepage,
70};
71
65static const struct vm_operations_struct afs_vm_ops = {
66 .open = afs_vm_open,
67 .close = afs_vm_close,
68 .fault = filemap_fault,
69 .map_pages = afs_vm_map_pages,
70 .page_mkwrite = afs_page_mkwrite,
71};
72

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

308 iov_iter_xarray(&fsreq->def_iter, READ,
309 &fsreq->vnode->vfs_inode.i_mapping->i_pages,
310 fsreq->pos, fsreq->len);
311
312 afs_fetch_data(fsreq->vnode, fsreq);
313 afs_put_read(fsreq);
314}
315
72static const struct vm_operations_struct afs_vm_ops = {
73 .open = afs_vm_open,
74 .close = afs_vm_close,
75 .fault = filemap_fault,
76 .map_pages = afs_vm_map_pages,
77 .page_mkwrite = afs_page_mkwrite,
78};
79

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

315 iov_iter_xarray(&fsreq->def_iter, READ,
316 &fsreq->vnode->vfs_inode.i_mapping->i_pages,
317 fsreq->pos, fsreq->len);
318
319 afs_fetch_data(fsreq->vnode, fsreq);
320 afs_put_read(fsreq);
321}
322
316static int afs_symlink_readpage(struct page *page)
323static int afs_symlink_readpage(struct file *file, struct page *page)
317{
318 struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
319 struct afs_read *fsreq;
320 int ret;
321
322 fsreq = afs_alloc_read(GFP_NOFS);
323 if (!fsreq)
324 return -ENOMEM;

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

373 .begin_cache_operation = afs_begin_cache_operation,
374 .check_write_begin = afs_check_write_begin,
375 .issue_op = afs_req_issue_op,
376 .cleanup = afs_priv_cleanup,
377};
378
379static int afs_readpage(struct file *file, struct page *page)
380{
324{
325 struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
326 struct afs_read *fsreq;
327 int ret;
328
329 fsreq = afs_alloc_read(GFP_NOFS);
330 if (!fsreq)
331 return -ENOMEM;

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

380 .begin_cache_operation = afs_begin_cache_operation,
381 .check_write_begin = afs_check_write_begin,
382 .issue_op = afs_req_issue_op,
383 .cleanup = afs_priv_cleanup,
384};
385
386static int afs_readpage(struct file *file, struct page *page)
387{
381 if (!file)
382 return afs_symlink_readpage(page);
383
384 return netfs_readpage(file, page, &afs_req_ops, NULL);
385}
386
387static void afs_readahead(struct readahead_control *ractl)
388{
389 netfs_readahead(ractl, &afs_req_ops, NULL);
390}
391

--- 193 unchanged lines hidden ---
388 return netfs_readpage(file, page, &afs_req_ops, NULL);
389}
390
391static void afs_readahead(struct readahead_control *ractl)
392{
393 netfs_readahead(ractl, &afs_req_ops, NULL);
394}
395

--- 193 unchanged lines hidden ---