udf: convert byte order of constant instead of variable
[safe/jmp/linux-2.6] / fs / gfs2 / rgrp.c
index d7ff9cf..3552110 100644 (file)
@@ -133,10 +133,9 @@ static u32 gfs2_bitfit(unsigned char *buffer, unsigned int buflen, u32 goal,
        u32 blk = goal;
        unsigned int bit, bitlong;
        unsigned long *plong, plong55;
-       static int c = 0;
 
        byte = buffer + (goal / GFS2_NBBY);
-       plong = buffer + (goal / GFS2_NBBY);
+       plong = (unsigned long *)(buffer + (goal / GFS2_NBBY));
        bit = (goal % GFS2_NBBY) * GFS2_BIT_SIZE;
        bitlong = bit;
 #if BITS_PER_LONG == 32
@@ -152,10 +151,8 @@ static u32 gfs2_bitfit(unsigned char *buffer, unsigned int buflen, u32 goal,
                        blk += sizeof(unsigned long) * GFS2_NBBY;
                        continue;
                }
-               if (((*byte >> bit) & GFS2_BIT_MASK) == old_state) {
-                       c++;
+               if (((*byte >> bit) & GFS2_BIT_MASK) == old_state)
                        return blk;
-               }
                bit += GFS2_BIT_SIZE;
                if (bit >= 8) {
                        bit = 0;
@@ -822,11 +819,9 @@ void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd)
 
 struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip)
 {
-       struct gfs2_alloc *al = &ip->i_alloc;
-
-       /* FIXME: Should assert that the correct locks are held here... */
-       memset(al, 0, sizeof(*al));
-       return al;
+       BUG_ON(ip->i_alloc != NULL);
+       ip->i_alloc = kzalloc(sizeof(struct gfs2_alloc), GFP_KERNEL);
+       return ip->i_alloc;
 }
 
 /**
@@ -1064,7 +1059,7 @@ static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked)
        struct inode *inode = NULL;
        struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
        struct gfs2_rgrpd *rgd, *begin = NULL;
-       struct gfs2_alloc *al = &ip->i_alloc;
+       struct gfs2_alloc *al = ip->i_alloc;
        int flags = LM_FLAG_TRY;
        int skipped = 0;
        int loops = 0;
@@ -1179,7 +1174,7 @@ out:
 int gfs2_inplace_reserve_i(struct gfs2_inode *ip, char *file, unsigned int line)
 {
        struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
-       struct gfs2_alloc *al = &ip->i_alloc;
+       struct gfs2_alloc *al = ip->i_alloc;
        struct inode *inode;
        int error = 0;
        u64 last_unlinked = NO_BLOCK;
@@ -1225,7 +1220,7 @@ try_again:
 void gfs2_inplace_release(struct gfs2_inode *ip)
 {
        struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
-       struct gfs2_alloc *al = &ip->i_alloc;
+       struct gfs2_alloc *al = ip->i_alloc;
 
        if (gfs2_assert_warn(sdp, al->al_alloced <= al->al_requested) == -1)
                fs_warn(sdp, "al_alloced = %u, al_requested = %u "
@@ -1415,7 +1410,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart,
 u64 gfs2_alloc_data(struct gfs2_inode *ip)
 {
        struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
-       struct gfs2_alloc *al = &ip->i_alloc;
+       struct gfs2_alloc *al = ip->i_alloc;
        struct gfs2_rgrpd *rgd = al->al_rgd;
        u32 goal, blk;
        u64 block;
@@ -1460,7 +1455,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip)
 u64 gfs2_alloc_meta(struct gfs2_inode *ip)
 {
        struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
-       struct gfs2_alloc *al = &ip->i_alloc;
+       struct gfs2_alloc *al = ip->i_alloc;
        struct gfs2_rgrpd *rgd = al->al_rgd;
        u32 goal, blk;
        u64 block;
@@ -1506,7 +1501,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip)
 u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation)
 {
        struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
-       struct gfs2_alloc *al = &dip->i_alloc;
+       struct gfs2_alloc *al = dip->i_alloc;
        struct gfs2_rgrpd *rgd = al->al_rgd;
        u32 blk;
        u64 block;