Commit 401b25aa authored by Souptick Joarder's avatar Souptick Joarder Committed by Theodore Ts'o

ext4: convert fault handler to use vm_fault_t type

Return type of ext4_page_mkwrite and ext4_filemap_fault are
changed to use vm_fault_t type.

With this patch all the callers of block_page_mkwrite_return()
are changed to handle vm_fault_t. So converting the return type
of block_page_mkwrite_return() to vm_fault_t.
Signed-off-by: default avatarSouptick Joarder <jrdr.linux@gmail.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Reviewed-by: default avatarMatthew Wilcox <willy@infradead.org>
parent 625ef8a3
...@@ -2487,8 +2487,8 @@ extern int ext4_writepage_trans_blocks(struct inode *); ...@@ -2487,8 +2487,8 @@ extern int ext4_writepage_trans_blocks(struct inode *);
extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks); extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode, extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,
loff_t lstart, loff_t lend); loff_t lstart, loff_t lend);
extern int ext4_page_mkwrite(struct vm_fault *vmf); extern vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf);
extern int ext4_filemap_fault(struct vm_fault *vmf); extern vm_fault_t ext4_filemap_fault(struct vm_fault *vmf);
extern qsize_t *ext4_get_reserved_space(struct inode *inode); extern qsize_t *ext4_get_reserved_space(struct inode *inode);
extern int ext4_get_projid(struct inode *inode, kprojid_t *projid); extern int ext4_get_projid(struct inode *inode, kprojid_t *projid);
extern void ext4_da_release_space(struct inode *inode, int to_free); extern void ext4_da_release_space(struct inode *inode, int to_free);
......
...@@ -6184,13 +6184,14 @@ static int ext4_bh_unmapped(handle_t *handle, struct buffer_head *bh) ...@@ -6184,13 +6184,14 @@ static int ext4_bh_unmapped(handle_t *handle, struct buffer_head *bh)
return !buffer_mapped(bh); return !buffer_mapped(bh);
} }
int ext4_page_mkwrite(struct vm_fault *vmf) vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf)
{ {
struct vm_area_struct *vma = vmf->vma; struct vm_area_struct *vma = vmf->vma;
struct page *page = vmf->page; struct page *page = vmf->page;
loff_t size; loff_t size;
unsigned long len; unsigned long len;
int ret; int err;
vm_fault_t ret;
struct file *file = vma->vm_file; struct file *file = vma->vm_file;
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
struct address_space *mapping = inode->i_mapping; struct address_space *mapping = inode->i_mapping;
...@@ -6203,8 +6204,8 @@ int ext4_page_mkwrite(struct vm_fault *vmf) ...@@ -6203,8 +6204,8 @@ int ext4_page_mkwrite(struct vm_fault *vmf)
down_read(&EXT4_I(inode)->i_mmap_sem); down_read(&EXT4_I(inode)->i_mmap_sem);
ret = ext4_convert_inline_data(inode); err = ext4_convert_inline_data(inode);
if (ret) if (err)
goto out_ret; goto out_ret;
/* Delalloc case is easy... */ /* Delalloc case is easy... */
...@@ -6212,9 +6213,9 @@ int ext4_page_mkwrite(struct vm_fault *vmf) ...@@ -6212,9 +6213,9 @@ int ext4_page_mkwrite(struct vm_fault *vmf)
!ext4_should_journal_data(inode) && !ext4_should_journal_data(inode) &&
!ext4_nonda_switch(inode->i_sb)) { !ext4_nonda_switch(inode->i_sb)) {
do { do {
ret = block_page_mkwrite(vma, vmf, err = block_page_mkwrite(vma, vmf,
ext4_da_get_block_prep); ext4_da_get_block_prep);
} while (ret == -ENOSPC && } while (err == -ENOSPC &&
ext4_should_retry_alloc(inode->i_sb, &retries)); ext4_should_retry_alloc(inode->i_sb, &retries));
goto out_ret; goto out_ret;
} }
...@@ -6259,8 +6260,8 @@ int ext4_page_mkwrite(struct vm_fault *vmf) ...@@ -6259,8 +6260,8 @@ int ext4_page_mkwrite(struct vm_fault *vmf)
ret = VM_FAULT_SIGBUS; ret = VM_FAULT_SIGBUS;
goto out; goto out;
} }
ret = block_page_mkwrite(vma, vmf, get_block); err = block_page_mkwrite(vma, vmf, get_block);
if (!ret && ext4_should_journal_data(inode)) { if (!err && ext4_should_journal_data(inode)) {
if (ext4_walk_page_buffers(handle, page_buffers(page), 0, if (ext4_walk_page_buffers(handle, page_buffers(page), 0,
PAGE_SIZE, NULL, do_journal_get_write_access)) { PAGE_SIZE, NULL, do_journal_get_write_access)) {
unlock_page(page); unlock_page(page);
...@@ -6271,24 +6272,24 @@ int ext4_page_mkwrite(struct vm_fault *vmf) ...@@ -6271,24 +6272,24 @@ int ext4_page_mkwrite(struct vm_fault *vmf)
ext4_set_inode_state(inode, EXT4_STATE_JDATA); ext4_set_inode_state(inode, EXT4_STATE_JDATA);
} }
ext4_journal_stop(handle); ext4_journal_stop(handle);
if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) if (err == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
goto retry_alloc; goto retry_alloc;
out_ret: out_ret:
ret = block_page_mkwrite_return(ret); ret = block_page_mkwrite_return(err);
out: out:
up_read(&EXT4_I(inode)->i_mmap_sem); up_read(&EXT4_I(inode)->i_mmap_sem);
sb_end_pagefault(inode->i_sb); sb_end_pagefault(inode->i_sb);
return ret; return ret;
} }
int ext4_filemap_fault(struct vm_fault *vmf) vm_fault_t ext4_filemap_fault(struct vm_fault *vmf)
{ {
struct inode *inode = file_inode(vmf->vma->vm_file); struct inode *inode = file_inode(vmf->vma->vm_file);
int err; vm_fault_t ret;
down_read(&EXT4_I(inode)->i_mmap_sem); down_read(&EXT4_I(inode)->i_mmap_sem);
err = filemap_fault(vmf); ret = filemap_fault(vmf);
up_read(&EXT4_I(inode)->i_mmap_sem); up_read(&EXT4_I(inode)->i_mmap_sem);
return err; return ret;
} }
...@@ -242,7 +242,7 @@ int block_commit_write(struct page *page, unsigned from, unsigned to); ...@@ -242,7 +242,7 @@ int block_commit_write(struct page *page, unsigned from, unsigned to);
int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
get_block_t get_block); get_block_t get_block);
/* Convert errno to return value from ->page_mkwrite() call */ /* Convert errno to return value from ->page_mkwrite() call */
static inline int block_page_mkwrite_return(int err) static inline vm_fault_t block_page_mkwrite_return(int err)
{ {
if (err == 0) if (err == 0)
return VM_FAULT_LOCKED; return VM_FAULT_LOCKED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment