NFS: Kill the obsolete NFS_PARANOIA
[powerpc.git] / fs / gfs2 / rgrp.c
index 5f8e225..1727f50 100644 (file)
@@ -7,7 +7,6 @@
  * of the GNU General Public License version 2.
  */
 
-#include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/completion.h>
@@ -28,6 +27,7 @@
 #include "trans.h"
 #include "ops_file.h"
 #include "util.h"
+#include "log.h"
 
 #define BFITNOENT ((u32)~0)
 
@@ -253,7 +253,7 @@ void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd)
 
 }
 
-static inline int rgrp_contains_block(struct gfs2_rindex *ri, u64 block)
+static inline int rgrp_contains_block(struct gfs2_rindex_host *ri, u64 block)
 {
        u64 first = ri->ri_data0;
        u64 last = first + ri->ri_data;
@@ -698,8 +698,6 @@ struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip)
  * @al: the struct gfs2_alloc structure describing the reservation
  *
  * If there's room for the requested blocks to be allocated from the RG:
- *   Sets the $al_reserved_data field in @al.
- *   Sets the $al_reserved_meta field in @al.
  *   Sets the $al_rgd field in @al.
  *
  * Returns: 1 on success (it fits), 0 on failure (it doesn't fit)
@@ -710,6 +708,9 @@ static int try_rgrp_fit(struct gfs2_rgrpd *rgd, struct gfs2_alloc *al)
        struct gfs2_sbd *sdp = rgd->rd_sbd;
        int ret = 0;
 
+       if (rgd->rd_rg.rg_flags & GFS2_RGF_NOALLOC)
+               return 0;
+
        spin_lock(&sdp->sd_rindex_spin);
        if (rgd->rd_free_clone >= al->al_requested) {
                al->al_rgd = rgd;
@@ -896,7 +897,7 @@ static int get_local_rgrp(struct gfs2_inode *ip)
        rgd = recent_rgrp_first(sdp, ip->i_last_rg_alloc);
 
        while (rgd) {
-               error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 
+               error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
                                           LM_FLAG_TRY, &al->al_rgd_gh);
                switch (error) {
                case 0:
@@ -942,9 +943,13 @@ static int get_local_rgrp(struct gfs2_inode *ip)
                        rgd = gfs2_rgrpd_get_first(sdp);
 
                if (rgd == begin) {
-                       if (++loops >= 2 || !skipped)
+                       if (++loops >= 3)
                                return -ENOSPC;
+                       if (!skipped)
+                               loops++;
                        flags = 0;
+                       if (loops == 2)
+                               gfs2_log_flush(sdp, NULL);
                }
        }
 
@@ -1217,7 +1222,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip)
        al->al_alloced++;
 
        gfs2_statfs_change(sdp, 0, -1, 0);
-       gfs2_quota_change(ip, +1, ip->i_di.di_uid, ip->i_di.di_gid);
+       gfs2_quota_change(ip, +1, ip->i_inode.i_uid, ip->i_inode.i_gid);
 
        spin_lock(&sdp->sd_rindex_spin);
        rgd->rd_free_clone--;
@@ -1261,7 +1266,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip)
        al->al_alloced++;
 
        gfs2_statfs_change(sdp, 0, -1, 0);
-       gfs2_quota_change(ip, +1, ip->i_di.di_uid, ip->i_di.di_gid);
+       gfs2_quota_change(ip, +1, ip->i_inode.i_uid, ip->i_inode.i_gid);
        gfs2_trans_add_unrevoke(sdp, block);
 
        spin_lock(&sdp->sd_rindex_spin);
@@ -1337,8 +1342,7 @@ void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen)
        gfs2_trans_add_rg(rgd);
 
        gfs2_statfs_change(sdp, 0, +blen, 0);
-       gfs2_quota_change(ip, -(s64)blen,
-                        ip->i_di.di_uid, ip->i_di.di_gid);
+       gfs2_quota_change(ip, -(s64)blen, ip->i_inode.i_uid, ip->i_inode.i_gid);
 }
 
 /**
@@ -1366,7 +1370,7 @@ void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen)
        gfs2_trans_add_rg(rgd);
 
        gfs2_statfs_change(sdp, 0, +blen, 0);
-       gfs2_quota_change(ip, -(s64)blen, ip->i_di.di_uid, ip->i_di.di_gid);
+       gfs2_quota_change(ip, -(s64)blen, ip->i_inode.i_uid, ip->i_inode.i_gid);
        gfs2_meta_wipe(ip, bstart, blen);
 }
 
@@ -1411,7 +1415,7 @@ static void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, u64 blkno)
 void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip)
 {
        gfs2_free_uninit_di(rgd, ip->i_num.no_addr);
-       gfs2_quota_change(ip, -1, ip->i_di.di_uid, ip->i_di.di_gid);
+       gfs2_quota_change(ip, -1, ip->i_inode.i_uid, ip->i_inode.i_gid);
        gfs2_meta_wipe(ip, ip->i_num.no_addr, 1);
 }