[PATCH -mm 1/2] nilfs2: follow page_mkwrite prototype change for matching fault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This follows the change of page_mkwrite prototype brought by the patch
("mm: page_mkwrite change prototype to match fault") and fixes the
following compilation errors:

  CC      fs/nilfs2/inode.o
  CC      fs/nilfs2/file.o
fs/nilfs2/file.c: In function 'nilfs_page_mkwrite':
fs/nilfs2/file.c:105: warning: passing argument 2 of 'block_page_mkwrite' from incompatible pointer type
fs/nilfs2/file.c: At top level:
fs/nilfs2/file.c:120: warning: initialization from incompatible pointer type

A few detail error codes are rounded to VM_FAULT_SIGBUS to follow the
change.  A subsequent fix is required to improve them as shown in the
additional patch ("fs: fix page_mkwrite error cases in core code and
btrfs").

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@xxxxxxxxxxxxx>
Cc: Nick Piggin <npiggin@xxxxxxx>
---
 fs/nilfs2/file.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c
index df74577..9b4fd96 100644
--- a/fs/nilfs2/file.c
+++ b/fs/nilfs2/file.c
@@ -52,20 +52,21 @@ int nilfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
 	return err;
 }
 
-static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct page *page)
+static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
+	struct page *page = vmf->page;
 	struct inode *inode = vma->vm_file->f_dentry->d_inode;
 	struct nilfs_transaction_info ti;
 	int ret;
 
 	if (unlikely(nilfs_near_disk_full(NILFS_SB(inode->i_sb)->s_nilfs)))
-		return -ENOSPC;
+		return VM_FAULT_SIGBUS; /* -ENOSPC */
 
 	lock_page(page);
 	if (page->mapping != inode->i_mapping ||
 	    page_offset(page) >= i_size_read(inode) || !PageUptodate(page)) {
 		unlock_page(page);
-		return -EINVAL;
+		return VM_FAULT_SIGBUS; /* -EINVAL */
 	}
 
 	/*
@@ -99,10 +100,11 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct page *page)
 	 * fill hole blocks
 	 */
 	ret = nilfs_transaction_begin(inode->i_sb, &ti, 1);
+	/* never returns -ENOMEM, but may return -ENOSPC */
 	if (unlikely(ret))
-		return ret;
+		return VM_FAULT_SIGBUS;
 
-	ret = block_page_mkwrite(vma, page, nilfs_get_block);
+	ret = block_page_mkwrite(vma, vmf, nilfs_get_block);
 	if (unlikely(ret)) {
 		nilfs_transaction_abort(inode->i_sb);
 		return ret;
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux