mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
mm: page_mkwrite change prototype to match fault
Change the page_mkwrite prototype to take a struct vm_fault, and return VM_FAULT_xxx flags. There should be no functional change. This makes it possible to return much more detailed error information to the VM (and also can provide more information eg. virtual_address to the driver, which might be important in some special cases). This is required for a subsequent fix. And will also make it easier to merge page_mkwrite() with fault() in future. Signed-off-by: Nick Piggin <[email protected]> Cc: Chris Mason <[email protected]> Cc: Trond Myklebust <[email protected]> Cc: Miklos Szeredi <[email protected]> Cc: Steven Whitehouse <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Artem Bityutskiy <[email protected]> Cc: Felix Blyakher <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
c2fdf3a9b2
commit
c2ec175c39
16 changed files with 65 additions and 23 deletions
|
|
@ -1434,8 +1434,9 @@ static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags)
|
|||
* mmap()d file has taken write protection fault and is being made
|
||||
* writable. UBIFS must ensure page is budgeted for.
|
||||
*/
|
||||
static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
|
||||
static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||||
{
|
||||
struct page *page = vmf->page;
|
||||
struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
|
||||
struct ubifs_info *c = inode->i_sb->s_fs_info;
|
||||
struct timespec now = ubifs_current_time(inode);
|
||||
|
|
@ -1447,7 +1448,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
|
|||
ubifs_assert(!(inode->i_sb->s_flags & MS_RDONLY));
|
||||
|
||||
if (unlikely(c->ro_media))
|
||||
return -EROFS;
|
||||
return VM_FAULT_SIGBUS; /* -EROFS */
|
||||
|
||||
/*
|
||||
* We have not locked @page so far so we may budget for changing the
|
||||
|
|
@ -1480,7 +1481,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
|
|||
if (err == -ENOSPC)
|
||||
ubifs_warn("out of space for mmapped file "
|
||||
"(inode number %lu)", inode->i_ino);
|
||||
return err;
|
||||
return VM_FAULT_SIGBUS;
|
||||
}
|
||||
|
||||
lock_page(page);
|
||||
|
|
@ -1520,6 +1521,8 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
|
|||
out_unlock:
|
||||
unlock_page(page);
|
||||
ubifs_release_budget(c, &req);
|
||||
if (err)
|
||||
err = VM_FAULT_SIGBUS;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue