mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
btrfs: change return type of btrfs_page_mkwrite to vm_fault_t
Use the new return type vm_fault_t for fault handler. For now, this is
just documenting that the function returns a VM_FAULT value rather than
an errno. Once all instances are converted, vm_fault_t will become a
distinct type.
Reference commit 1c8f422059
("mm: change return type to vm_fault_t")
vmf_error() is the newly introduced inline function in 4.17-rc6.
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
9d311e11fc
commit
a528a24150
@ -3197,7 +3197,7 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
|
|||||||
size_t size, struct bio *bio,
|
size_t size, struct bio *bio,
|
||||||
unsigned long bio_flags);
|
unsigned long bio_flags);
|
||||||
void btrfs_set_range_writeback(void *private_data, u64 start, u64 end);
|
void btrfs_set_range_writeback(void *private_data, u64 start, u64 end);
|
||||||
int btrfs_page_mkwrite(struct vm_fault *vmf);
|
vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf);
|
||||||
int btrfs_readpage(struct file *file, struct page *page);
|
int btrfs_readpage(struct file *file, struct page *page);
|
||||||
void btrfs_evict_inode(struct inode *inode);
|
void btrfs_evict_inode(struct inode *inode);
|
||||||
int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc);
|
int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc);
|
||||||
|
@ -8872,7 +8872,7 @@ again:
|
|||||||
* beyond EOF, then the page is guaranteed safe against truncation until we
|
* beyond EOF, then the page is guaranteed safe against truncation until we
|
||||||
* unlock the page.
|
* unlock the page.
|
||||||
*/
|
*/
|
||||||
int btrfs_page_mkwrite(struct vm_fault *vmf)
|
vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
|
||||||
{
|
{
|
||||||
struct page *page = vmf->page;
|
struct page *page = vmf->page;
|
||||||
struct inode *inode = file_inode(vmf->vma->vm_file);
|
struct inode *inode = file_inode(vmf->vma->vm_file);
|
||||||
@ -8884,7 +8884,8 @@ int btrfs_page_mkwrite(struct vm_fault *vmf)
|
|||||||
char *kaddr;
|
char *kaddr;
|
||||||
unsigned long zero_start;
|
unsigned long zero_start;
|
||||||
loff_t size;
|
loff_t size;
|
||||||
int ret;
|
vm_fault_t ret;
|
||||||
|
int ret2;
|
||||||
int reserved = 0;
|
int reserved = 0;
|
||||||
u64 reserved_space;
|
u64 reserved_space;
|
||||||
u64 page_start;
|
u64 page_start;
|
||||||
@ -8906,17 +8907,14 @@ int btrfs_page_mkwrite(struct vm_fault *vmf)
|
|||||||
* end up waiting indefinitely to get a lock on the page currently
|
* end up waiting indefinitely to get a lock on the page currently
|
||||||
* being processed by btrfs_page_mkwrite() function.
|
* being processed by btrfs_page_mkwrite() function.
|
||||||
*/
|
*/
|
||||||
ret = btrfs_delalloc_reserve_space(inode, &data_reserved, page_start,
|
ret2 = btrfs_delalloc_reserve_space(inode, &data_reserved, page_start,
|
||||||
reserved_space);
|
reserved_space);
|
||||||
if (!ret) {
|
if (!ret2) {
|
||||||
ret = file_update_time(vmf->vma->vm_file);
|
ret2 = file_update_time(vmf->vma->vm_file);
|
||||||
reserved = 1;
|
reserved = 1;
|
||||||
}
|
}
|
||||||
if (ret) {
|
if (ret2) {
|
||||||
if (ret == -ENOMEM)
|
ret = vmf_error(ret2);
|
||||||
ret = VM_FAULT_OOM;
|
|
||||||
else /* -ENOSPC, -EIO, etc */
|
|
||||||
ret = VM_FAULT_SIGBUS;
|
|
||||||
if (reserved)
|
if (reserved)
|
||||||
goto out;
|
goto out;
|
||||||
goto out_noreserve;
|
goto out_noreserve;
|
||||||
@ -8975,15 +8973,15 @@ again:
|
|||||||
EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG,
|
EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG,
|
||||||
0, 0, &cached_state);
|
0, 0, &cached_state);
|
||||||
|
|
||||||
ret = btrfs_set_extent_delalloc(inode, page_start, end, 0,
|
ret2 = btrfs_set_extent_delalloc(inode, page_start, end, 0,
|
||||||
&cached_state, 0);
|
&cached_state, 0);
|
||||||
if (ret) {
|
if (ret2) {
|
||||||
unlock_extent_cached(io_tree, page_start, page_end,
|
unlock_extent_cached(io_tree, page_start, page_end,
|
||||||
&cached_state);
|
&cached_state);
|
||||||
ret = VM_FAULT_SIGBUS;
|
ret = VM_FAULT_SIGBUS;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret2 = 0;
|
||||||
|
|
||||||
/* page is wholly or partially inside EOF */
|
/* page is wholly or partially inside EOF */
|
||||||
if (page_start + PAGE_SIZE > size)
|
if (page_start + PAGE_SIZE > size)
|
||||||
@ -9008,7 +9006,7 @@ again:
|
|||||||
unlock_extent_cached(io_tree, page_start, page_end, &cached_state);
|
unlock_extent_cached(io_tree, page_start, page_end, &cached_state);
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
if (!ret) {
|
if (!ret2) {
|
||||||
btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, true);
|
btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, true);
|
||||||
sb_end_pagefault(inode->i_sb);
|
sb_end_pagefault(inode->i_sb);
|
||||||
extent_changeset_free(data_reserved);
|
extent_changeset_free(data_reserved);
|
||||||
|
Loading…
Reference in New Issue
Block a user