]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/gfs2/dir.c
hwmon: (lm90) Move 16-bit value read to a separate function
[linux-2.6-omap-h63xx.git] / fs / gfs2 / dir.c
index a3753c7989f70a70e78a3cc5e499bd2385d05cba..eed040d8ba3abc407496689af3a909030ae647fe 100644 (file)
@@ -1089,7 +1089,7 @@ static int dir_double_exhash(struct gfs2_inode *dip)
 
        /*  Allocate both the "from" and "to" buffers in one big chunk  */
 
-       buf = kcalloc(3, sdp->sd_hash_bsize, GFP_KERNEL | __GFP_NOFAIL);
+       buf = kcalloc(3, sdp->sd_hash_bsize, GFP_NOFS | __GFP_NOFAIL);
 
        for (block = dip->i_di.di_size >> sdp->sd_hash_bsize_shift; block--;) {
                error = gfs2_dir_read_data(dip, (char *)buf,
@@ -1378,7 +1378,7 @@ static int dir_e_read(struct inode *inode, u64 *offset, void *opaque,
        hash = gfs2_dir_offset2hash(*offset);
        index = hash >> (32 - dip->i_depth);
 
-       lp = kmalloc(sdp->sd_hash_bsize, GFP_KERNEL);
+       lp = kmalloc(sdp->sd_hash_bsize, GFP_NOFS);
        if (!lp)
                return -ENOMEM;
 
@@ -1443,7 +1443,7 @@ int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque,
 
        error = -ENOMEM;
        /* 96 is max number of dirents which can be stuffed into an inode */
-       darr = kmalloc(96 * sizeof(struct gfs2_dirent *), GFP_KERNEL);
+       darr = kmalloc(96 * sizeof(struct gfs2_dirent *), GFP_NOFS);
        if (darr) {
                g.pdent = darr;
                g.offset = 0;
@@ -1789,7 +1789,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data)
                return -EIO;
        }
 
-       lp = kmalloc(sdp->sd_hash_bsize, GFP_KERNEL);
+       lp = kmalloc(sdp->sd_hash_bsize, GFP_NOFS);
        if (!lp)
                return -ENOMEM;
 
@@ -1864,15 +1864,18 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
 
        memset(&rlist, 0, sizeof(struct gfs2_rgrp_list));
 
-       ht = kzalloc(size, GFP_KERNEL);
+       ht = kzalloc(size, GFP_NOFS);
        if (!ht)
                return -ENOMEM;
 
-       gfs2_alloc_get(dip);
+       if (!gfs2_alloc_get(dip)) {
+               error = -ENOMEM;
+               goto out;
+       }
 
        error = gfs2_quota_hold(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
        if (error)
-               goto out;
+               goto out_put;
 
        error = gfs2_rindex_hold(sdp, &dip->i_alloc->al_ri_gh);
        if (error)
@@ -1946,8 +1949,9 @@ out_rlist:
        gfs2_glock_dq_uninit(&dip->i_alloc->al_ri_gh);
 out_qs:
        gfs2_quota_unhold(dip);
-out:
+out_put:
        gfs2_alloc_put(dip);
+out:
        kfree(ht);
        return error;
 }