1 ext4: convert fault handler to use vm_fault_t type
3 From: Souptick Joarder <jrdr.linux@gmail.com>
5 Return type of ext4_page_mkwrite and ext4_filemap_fault are
6 changed to use vm_fault_t type.
8 With this patch all the callers of block_page_mkwrite_return()
9 are changed to handle vm_fault_t. So converting the return type
10 of block_page_mkwrite_return() to vm_fault_t.
12 Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
13 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
14 Reviewed-by: Matthew Wilcox <willy@infradead.org>
16 fs/ext4/ext4.h | 4 ++--
17 fs/ext4/inode.c | 29 +++++++++++++++--------------
18 include/linux/buffer_head.h | 2 +-
19 3 files changed, 18 insertions(+), 17 deletions(-)
21 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
22 index 0f0edd1..8506b14 100644
25 @@ -2469,8 +2469,8 @@ int do_journal_get_write_access(handle_t *handle,
26 extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
27 extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,
28 loff_t lstart, loff_t lend);
29 -extern int ext4_page_mkwrite(struct vm_fault *vmf);
30 -extern int ext4_filemap_fault(struct vm_fault *vmf);
31 +extern vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf);
32 +extern vm_fault_t ext4_filemap_fault(struct vm_fault *vmf);
33 extern qsize_t *ext4_get_reserved_space(struct inode *inode);
34 extern int ext4_get_projid(struct inode *inode, kprojid_t *projid);
35 extern void ext4_da_update_reserve_space(struct inode *inode,
36 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
37 index d0dd585..7c1723b 100644
40 @@ -6151,13 +6151,14 @@ static int ext4_bh_unmapped(handle_t *handle, struct buffer_head *bh)
41 return !buffer_mapped(bh);
44 -int ext4_page_mkwrite(struct vm_fault *vmf)
45 +vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf)
47 struct vm_area_struct *vma = vmf->vma;
48 struct page *page = vmf->page;
54 struct file *file = vma->vm_file;
55 struct inode *inode = file_inode(file);
56 struct address_space *mapping = inode->i_mapping;
57 @@ -6170,8 +6171,8 @@ int ext4_page_mkwrite(struct vm_fault *vmf)
59 down_read(&EXT4_I(inode)->i_mmap_sem);
61 - ret = ext4_convert_inline_data(inode);
63 + err = ext4_convert_inline_data(inode);
67 /* Delalloc case is easy... */
68 @@ -6179,9 +6180,9 @@ int ext4_page_mkwrite(struct vm_fault *vmf)
69 !ext4_should_journal_data(inode) &&
70 !ext4_nonda_switch(inode->i_sb)) {
72 - ret = block_page_mkwrite(vma, vmf,
73 + err = block_page_mkwrite(vma, vmf,
74 ext4_da_get_block_prep);
75 - } while (ret == -ENOSPC &&
76 + } while (err == -ENOSPC &&
77 ext4_should_retry_alloc(inode->i_sb, &retries));
80 @@ -6226,8 +6227,8 @@ int ext4_page_mkwrite(struct vm_fault *vmf)
81 ret = VM_FAULT_SIGBUS;
84 - ret = block_page_mkwrite(vma, vmf, get_block);
85 - if (!ret && ext4_should_journal_data(inode)) {
86 + err = block_page_mkwrite(vma, vmf, get_block);
87 + if (!err && ext4_should_journal_data(inode)) {
88 if (ext4_walk_page_buffers(handle, page_buffers(page), 0,
89 PAGE_SIZE, NULL, do_journal_get_write_access)) {
91 @@ -6238,24 +6239,24 @@ int ext4_page_mkwrite(struct vm_fault *vmf)
92 ext4_set_inode_state(inode, EXT4_STATE_JDATA);
94 ext4_journal_stop(handle);
95 - if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
96 + if (err == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
99 - ret = block_page_mkwrite_return(ret);
100 + ret = block_page_mkwrite_return(err);
102 up_read(&EXT4_I(inode)->i_mmap_sem);
103 sb_end_pagefault(inode->i_sb);
107 -int ext4_filemap_fault(struct vm_fault *vmf)
108 +vm_fault_t ext4_filemap_fault(struct vm_fault *vmf)
110 struct inode *inode = file_inode(vmf->vma->vm_file);
114 down_read(&EXT4_I(inode)->i_mmap_sem);
115 - err = filemap_fault(vmf);
116 + ret = filemap_fault(vmf);
117 up_read(&EXT4_I(inode)->i_mmap_sem);
122 diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
123 index 96225a7..7b73ef7 100644
124 --- a/include/linux/buffer_head.h
125 +++ b/include/linux/buffer_head.h
126 @@ -242,7 +242,7 @@ int cont_write_begin(struct file *, struct address_space *, loff_t,
127 int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
128 get_block_t get_block);
129 /* Convert errno to return value from ->page_mkwrite() call */
130 -static inline int block_page_mkwrite_return(int err)
131 +static inline vm_fault_t block_page_mkwrite_return(int err)
134 return VM_FAULT_LOCKED;