[GFS2] Update copyright date to 2006
[profile/ivi/kernel-adaptation-intel-automotive.git] / fs / gfs2 / ops_vm.c
index a1b409c..263c1fb 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
- * Copyright (C) 2004-2005 Red Hat, Inc.  All rights reserved.
+ * Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
  *
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
 #include <linux/buffer_head.h>
 #include <linux/mm.h>
 #include <linux/pagemap.h>
-#include <asm/semaphore.h>
+#include <linux/gfs2_ondisk.h>
 
 #include "gfs2.h"
+#include "lm_interface.h"
+#include "incore.h"
 #include "bmap.h"
 #include "glock.h"
 #include "inode.h"
@@ -25,6 +27,7 @@
 #include "quota.h"
 #include "rgrp.h"
 #include "trans.h"
+#include "util.h"
 
 static void pfault_be_greedy(struct gfs2_inode *ip)
 {
@@ -43,13 +46,11 @@ static void pfault_be_greedy(struct gfs2_inode *ip)
 static struct page *gfs2_private_nopage(struct vm_area_struct *area,
                                        unsigned long address, int *type)
 {
-       struct gfs2_inode *ip = get_v2ip(area->vm_file->f_mapping->host);
+       struct gfs2_inode *ip = area->vm_file->f_mapping->host->u.generic_ip;
        struct gfs2_holder i_gh;
        struct page *result;
        int error;
 
-       atomic_inc(&ip->i_sbd->sd_ops_vm);
-
        error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh);
        if (error)
                return NULL;
@@ -70,7 +71,8 @@ static int alloc_page_backing(struct gfs2_inode *ip, struct page *page)
 {
        struct gfs2_sbd *sdp = ip->i_sbd;
        unsigned long index = page->index;
-       uint64_t lblock = index << (PAGE_CACHE_SHIFT - sdp->sd_sb.sb_bsize_shift);
+       uint64_t lblock = index << (PAGE_CACHE_SHIFT -
+                                   sdp->sd_sb.sb_bsize_shift);
        unsigned int blocks = PAGE_CACHE_SIZE >> sdp->sd_sb.sb_bsize_shift;
        struct gfs2_alloc *al;
        unsigned int data_blocks, ind_blocks;
@@ -87,8 +89,7 @@ static int alloc_page_backing(struct gfs2_inode *ip, struct page *page)
        if (error)
                goto out_gunlock_q;
 
-       gfs2_write_calc_reserv(ip, PAGE_CACHE_SIZE,
-                             &data_blocks, &ind_blocks);
+       gfs2_write_calc_reserv(ip, PAGE_CACHE_SIZE, &data_blocks, &ind_blocks);
 
        al->al_requested = data_blocks + ind_blocks;
 
@@ -96,8 +97,7 @@ static int alloc_page_backing(struct gfs2_inode *ip, struct page *page)
        if (error)
                goto out_gunlock_q;
 
-       error = gfs2_trans_begin(sdp,
-                                al->al_rgd->rd_ri.ri_length +
+       error = gfs2_trans_begin(sdp, al->al_rgd->rd_ri.ri_length +
                                 ind_blocks + RES_DINODE +
                                 RES_STATFS + RES_QUOTA, 0);
        if (error)
@@ -114,7 +114,7 @@ static int alloc_page_backing(struct gfs2_inode *ip, struct page *page)
                unsigned int extlen;
                int new = 1;
 
-               error = gfs2_block_map(ip, lblock, &new, &dblock, &extlen);
+               error = gfs2_extent_map(ip->i_vnode, lblock, &new, &dblock, &extlen);
                if (error)
                        goto out_trans;
 
@@ -142,22 +142,18 @@ static int alloc_page_backing(struct gfs2_inode *ip, struct page *page)
 static struct page *gfs2_sharewrite_nopage(struct vm_area_struct *area,
                                           unsigned long address, int *type)
 {
-       struct gfs2_inode *ip = get_v2ip(area->vm_file->f_mapping->host);
+       struct gfs2_inode *ip = area->vm_file->f_mapping->host->u.generic_ip;
        struct gfs2_holder i_gh;
        struct page *result = NULL;
-       unsigned long index = ((address - area->vm_start) >> PAGE_CACHE_SHIFT) + area->vm_pgoff;
+       unsigned long index = ((address - area->vm_start) >> PAGE_CACHE_SHIFT) +
+                             area->vm_pgoff;
        int alloc_required;
        int error;
 
-       atomic_inc(&ip->i_sbd->sd_ops_vm);
-
        error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
        if (error)
                return NULL;
 
-       if (gfs2_is_jdata(ip))
-               goto out;
-
        set_bit(GIF_PAGED, &ip->i_flags);
        set_bit(GIF_SW_PAGED, &ip->i_flags);