diff options
author | Nick Piggin <npiggin@suse.de> | 2009-03-31 18:23:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 11:59:14 -0400 |
commit | c2ec175c39f62949438354f603f4aa170846aabb (patch) | |
tree | f2c9bf1bec2deabe2d3a5092405b027637b6ead3 /fs/ubifs | |
parent | c2fdf3a9b2d52842808a8e551b53b55dd9b45030 (diff) |
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 <npiggin@suse.de>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <joel.becker@oracle.com>
Cc: Artem Bityutskiy <dedekind@infradead.org>
Cc: Felix Blyakher <felixb@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/file.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 93b6de51f261..0ff89fe71e51 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
@@ -1434,8 +1434,9 @@ static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags) | |||
1434 | * mmap()d file has taken write protection fault and is being made | 1434 | * mmap()d file has taken write protection fault and is being made |
1435 | * writable. UBIFS must ensure page is budgeted for. | 1435 | * writable. UBIFS must ensure page is budgeted for. |
1436 | */ | 1436 | */ |
1437 | static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page) | 1437 | static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) |
1438 | { | 1438 | { |
1439 | struct page *page = vmf->page; | ||
1439 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 1440 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; |
1440 | struct ubifs_info *c = inode->i_sb->s_fs_info; | 1441 | struct ubifs_info *c = inode->i_sb->s_fs_info; |
1441 | struct timespec now = ubifs_current_time(inode); | 1442 | 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) | |||
1447 | ubifs_assert(!(inode->i_sb->s_flags & MS_RDONLY)); | 1448 | ubifs_assert(!(inode->i_sb->s_flags & MS_RDONLY)); |
1448 | 1449 | ||
1449 | if (unlikely(c->ro_media)) | 1450 | if (unlikely(c->ro_media)) |
1450 | return -EROFS; | 1451 | return VM_FAULT_SIGBUS; /* -EROFS */ |
1451 | 1452 | ||
1452 | /* | 1453 | /* |
1453 | * We have not locked @page so far so we may budget for changing the | 1454 | * 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) | |||
1480 | if (err == -ENOSPC) | 1481 | if (err == -ENOSPC) |
1481 | ubifs_warn("out of space for mmapped file " | 1482 | ubifs_warn("out of space for mmapped file " |
1482 | "(inode number %lu)", inode->i_ino); | 1483 | "(inode number %lu)", inode->i_ino); |
1483 | return err; | 1484 | return VM_FAULT_SIGBUS; |
1484 | } | 1485 | } |
1485 | 1486 | ||
1486 | lock_page(page); | 1487 | lock_page(page); |
@@ -1520,6 +1521,8 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page) | |||
1520 | out_unlock: | 1521 | out_unlock: |
1521 | unlock_page(page); | 1522 | unlock_page(page); |
1522 | ubifs_release_budget(c, &req); | 1523 | ubifs_release_budget(c, &req); |
1524 | if (err) | ||
1525 | err = VM_FAULT_SIGBUS; | ||
1523 | return err; | 1526 | return err; |
1524 | } | 1527 | } |
1525 | 1528 | ||