]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/gfs2/ops_file.c
mm: page_mkwrite change prototype to match fault
[linux-2.6-omap-h63xx.git] / fs / gfs2 / ops_file.c
index 48ec3d5e29eb8727a9cd2d14893cee271af54e49..70b9b8548945d92450afc5936eddf72744ecccd7 100644 (file)
@@ -337,8 +337,9 @@ static int gfs2_allocate_page_backing(struct page *page)
  * blocks allocated on disk to back that page.
  */
 
-static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
+static int gfs2_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 gfs2_inode *ip = GFS2_I(inode);
        struct gfs2_sbd *sdp = GFS2_SB(inode);
@@ -355,6 +356,9 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
        if (ret)
                goto out;
 
+       set_bit(GLF_DIRTY, &ip->i_gl->gl_flags);
+       set_bit(GIF_SW_PAGED, &ip->i_flags);
+
        ret = gfs2_write_alloc_required(ip, pos, PAGE_CACHE_SIZE, &alloc_required);
        if (ret || !alloc_required)
                goto out_unlock;
@@ -395,8 +399,6 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
                        goto out_unlock_page;
        }
        ret = gfs2_allocate_page_backing(page);
-       if (!ret)
-               set_bit(GIF_SW_PAGED, &ip->i_flags);
 
 out_unlock_page:
        unlock_page(page);
@@ -411,6 +413,8 @@ out_unlock:
        gfs2_glock_dq(&gh);
 out:
        gfs2_holder_uninit(&gh);
+       if (ret)
+               ret = VM_FAULT_SIGBUS;
        return ret;
 }