]> err.no Git - linux-2.6/blobdiff - fs/gfs2/ops_address.c
[GFS2] trivial sparse lock annotations
[linux-2.6] / fs / gfs2 / ops_address.c
index 2483d8741060cd5dff6052b3625b1efca03614e0..2b556dd034bb6c35a64f7822da3aeeb06a23f22c 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/gfs2_ondisk.h>
 #include <linux/lm_interface.h>
 #include <linux/backing-dev.h>
-#include <linux/pagevec.h>
 
 #include "gfs2.h"
 #include "incore.h"
@@ -278,7 +277,7 @@ static int gfs2_write_jdata_pagevec(struct address_space *mapping,
        int i;
        int ret;
 
-       ret = gfs2_trans_begin(sdp, nrblocks, 0);
+       ret = gfs2_trans_begin(sdp, nrblocks, nrblocks);
        if (ret < 0)
                return ret;
 
@@ -439,7 +438,7 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
        int error;
 
        /*
-        * Due to the order of unstuffing files and ->nopage(), we can be
+        * Due to the order of unstuffing files and ->fault(), we can be
         * asked for a zero page in the case of a stuffed file being extended,
         * so we need to supply one here. It doesn't happen often.
         */
@@ -508,26 +507,23 @@ static int __gfs2_readpage(void *file, struct page *page)
 static int gfs2_readpage(struct file *file, struct page *page)
 {
        struct gfs2_inode *ip = GFS2_I(page->mapping->host);
-       struct gfs2_holder *gh;
+       struct gfs2_holder gh;
        int error;
 
-       gh = gfs2_glock_is_locked_by_me(ip->i_gl);
-       if (!gh) {
-               gh = kmalloc(sizeof(struct gfs2_holder), GFP_NOFS);
-               if (!gh)
-                       return -ENOBUFS;
-               gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, gh);
+       gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME|LM_FLAG_TRY_1CB, &gh);
+       error = gfs2_glock_nq_atime(&gh);
+       if (unlikely(error)) {
                unlock_page(page);
-               error = gfs2_glock_nq_atime(gh);
-               if (likely(error != 0))
-                       goto out;
-               return AOP_TRUNCATED_PAGE;
+               goto out;
        }
        error = __gfs2_readpage(file, page);
-       gfs2_glock_dq(gh);
+       gfs2_glock_dq(&gh);
 out:
-       gfs2_holder_uninit(gh);
-       kfree(gh);
+       gfs2_holder_uninit(&gh);
+       if (error == GLR_TRYFAILED) {
+               yield();
+               return AOP_TRUNCATED_PAGE;
+       }
        return error;
 }
 
@@ -654,14 +650,10 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
                        goto out_unlock;
                }
 
-               error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
+               error = gfs2_quota_lock_check(ip);
                if (error)
                        goto out_alloc_put;
 
-               error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
-               if (error)
-                       goto out_qunlock;
-
                al->al_requested = data_blocks + ind_blocks;
                error = gfs2_inplace_reserve(ip);
                if (error)