]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[GFS2] Tidy up bmap/inode code
authorSteven Whitehouse <swhiteho@redhat.com>
Mon, 4 Sep 2006 15:41:31 +0000 (11:41 -0400)
committerSteven Whitehouse <swhiteho@redhat.com>
Mon, 4 Sep 2006 15:41:31 +0000 (11:41 -0400)
As per Jan Engelhardt's third set of comments, this make various
code style changes and moves the structures from format.h into
super.c, which was the only place that format.h was actually used.

Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/bmap.c
fs/gfs2/format.h [deleted file]
fs/gfs2/glops.c
fs/gfs2/inode.c
fs/gfs2/super.c

index 913c0e5490e9902487f2c3bc9452f7593187459f..b75a2f93dadab05187dad73077512c15db6e1643 100644 (file)
@@ -94,7 +94,7 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh,
                map_bh(bh, inode->i_sb, block);
 
        set_buffer_uptodate(bh);
-       if ((sdp->sd_args.ar_data == GFS2_DATA_ORDERED) || gfs2_is_jdata(ip))
+       if (sdp->sd_args.ar_data == GFS2_DATA_ORDERED || gfs2_is_jdata(ip))
                gfs2_trans_add_bh(ip->i_gl, bh, 0);
        mark_buffer_dirty(bh);
 
@@ -369,7 +369,7 @@ static inline u64 *metapointer(struct buffer_head *bh, int *boundary,
        u64 *ptr;
        *boundary = 0;
        ptr = ((u64 *)(bh->b_data + head_size)) + mp->mp_list[height];
-       if (ptr + 1 == (u64*)(bh->b_data + bh->b_size))
+       if (ptr + 1 == (u64 *)(bh->b_data + bh->b_size))
                *boundary = 1;
        return ptr;
 }
@@ -456,7 +456,7 @@ static struct buffer_head *gfs2_block_pointers(struct inode *inode, u64 lblock,
        if (gfs2_assert_warn(sdp, !gfs2_is_stuffed(ip)))
                goto out;
 
-       bsize = (gfs2_is_dir(ip)) ? sdp->sd_jbsize : sdp->sd_sb.sb_bsize;
+       bsize = gfs2_is_dir(ip) ? sdp->sd_jbsize : sdp->sd_sb.sb_bsize;
 
        height = calc_tree_height(ip, (lblock + 1) * bsize);
        if (ip->i_di.di_height < height) {
@@ -554,7 +554,7 @@ int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsi
        bh = gfs2_block_pointers(inode, lblock, new, dblock, &boundary, &mp);
        *extlen = 1;
 
-       if (bh && !IS_ERR(bh) && *dblock && !*new) {
+       if (bh != NULL && !IS_ERR(bh) && *dblock != 0 && *new == 0) {
                u64 tmp_dblock;
                int tmp_new;
                unsigned int nptrs;
@@ -565,7 +565,7 @@ int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsi
                        lookup_block(ip, bh, end_of_metadata, &mp, 0, &tmp_new, &tmp_dblock);
                        if (*dblock + *extlen != tmp_dblock)
                                break;
-                       (*extlen)++;
+                       ++*extlen;
                }
        }
        bmap_unlock(inode, create);
@@ -612,10 +612,8 @@ static int recursive_scan(struct gfs2_inode *ip, struct buffer_head *dibh,
                        return error;
                dibh = bh;
 
-               top = (uint64_t *)(bh->b_data + sizeof(struct gfs2_dinode)) +
-                       mp->mp_list[0];
-               bottom = (uint64_t *)(bh->b_data + sizeof(struct gfs2_dinode)) +
-                       sdp->sd_diptrs;
+               top = (u64 *)(bh->b_data + sizeof(struct gfs2_dinode)) + mp->mp_list[0];
+               bottom = (u64 *)(bh->b_data + sizeof(struct gfs2_dinode)) + sdp->sd_diptrs;
        } else {
                error = gfs2_meta_indirect_buffer(ip, height, block, 0, &bh);
                if (error)
diff --git a/fs/gfs2/format.h b/fs/gfs2/format.h
deleted file mode 100644 (file)
index 9acbf45..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) Sistina Software, Inc.  1997-2003 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
- * of the GNU General Public License version 2.
- */
-
-#ifndef __FORMAT_DOT_H__
-#define __FORMAT_DOT_H__
-
-static const uint32_t gfs2_old_fs_formats[] = {
-       0
-};
-
-static const uint32_t gfs2_old_multihost_formats[] = {
-       0
-};
-
-#endif /* __FORMAT_DOT_H__ */
index 8e1d8ee68e2ec2b7ae1e2cd73927625b8fe966fd..d3e7b082a918095661605076093a02fc4d7491bc 100644 (file)
@@ -234,7 +234,6 @@ static void inode_go_sync(struct gfs2_glock *gl, int flags)
                if (flags & DIO_RELEASE)
                        gfs2_ail_empty_gl(gl);
        }
-
 }
 
 /**
@@ -324,12 +323,11 @@ static void inode_go_unlock(struct gfs2_holder *gh)
        struct gfs2_glock *gl = gh->gh_gl;
        struct gfs2_inode *ip = gl->gl_object;
 
-       if (ip) {
-               if (test_bit(GLF_DIRTY, &gl->gl_flags))
-                       gfs2_inode_attr_in(ip);
-
-               gfs2_meta_cache_flush(ip);
-       }
+       if (ip == NULL)
+               return;
+       if (test_bit(GLF_DIRTY, &gl->gl_flags))
+               gfs2_inode_attr_in(ip);
+       gfs2_meta_cache_flush(ip);
 }
 
 /**
index decb0cf856912202b55dfc94dd8048434c11d198..1aaaaa1cc8c32d8e0006f166bb851958760e7114 100644 (file)
@@ -97,15 +97,15 @@ void gfs2_inode_attr_in(struct gfs2_inode *ip)
 void gfs2_inode_attr_out(struct gfs2_inode *ip)
 {
        struct inode *inode = &ip->i_inode;
-
+       struct gfs2_dinode *di = &ip->i_di;
        gfs2_assert_withdraw(GFS2_SB(inode),
-               (ip->i_di.di_mode & S_IFMT) == (inode->i_mode & S_IFMT));
-       ip->i_di.di_mode = inode->i_mode;
-       ip->i_di.di_uid = inode->i_uid;
-       ip->i_di.di_gid = inode->i_gid;
-       ip->i_di.di_atime = inode->i_atime.tv_sec;
-       ip->i_di.di_mtime = inode->i_mtime.tv_sec;
-       ip->i_di.di_ctime = inode->i_ctime.tv_sec;
+               (di->di_mode & S_IFMT) == (inode->i_mode & S_IFMT));
+       di->di_mode = inode->i_mode;
+       di->di_uid = inode->i_uid;
+       di->di_gid = inode->i_gid;
+       di->di_atime = inode->i_atime.tv_sec;
+       di->di_mtime = inode->i_mtime.tv_sec;
+       di->di_ctime = inode->i_ctime.tv_sec;
 }
 
 static int iget_test(struct inode *inode, void *opaque)
@@ -1213,31 +1213,26 @@ fail:
  *
  * Returns: 1 if A > B
  *         -1 if A < B
- *          0 if A = B
+ *          0 if A == B
  */
 
 static int glock_compare_atime(const void *arg_a, const void *arg_b)
 {
-       struct gfs2_holder *gh_a = *(struct gfs2_holder **)arg_a;
-       struct gfs2_holder *gh_b = *(struct gfs2_holder **)arg_b;
-       struct lm_lockname *a = &gh_a->gh_gl->gl_name;
-       struct lm_lockname *b = &gh_b->gh_gl->gl_name;
-       int ret = 0;
+       const struct gfs2_holder *gh_a = *(const struct gfs2_holder **)arg_a;
+       const struct gfs2_holder *gh_b = *(const struct gfs2_holder **)arg_b;
+       const struct lm_lockname *a = &gh_a->gh_gl->gl_name;
+       const struct lm_lockname *b = &gh_b->gh_gl->gl_name;
 
        if (a->ln_number > b->ln_number)
-               ret = 1;
-       else if (a->ln_number < b->ln_number)
-               ret = -1;
-       else {
-               if (gh_a->gh_state == LM_ST_SHARED &&
-                   gh_b->gh_state == LM_ST_EXCLUSIVE)
-                       ret = 1;
-               else if (gh_a->gh_state == LM_ST_SHARED &&
-                        (gh_b->gh_flags & GL_ATIME))
-                       ret = 1;
-       }
+               return 1;
+       if (a->ln_number < b->ln_number)
+               return -1;
+       if (gh_a->gh_state == LM_ST_SHARED && gh_b->gh_state == LM_ST_EXCLUSIVE)
+               return 1;
+       if (gh_a->gh_state == LM_ST_SHARED && (gh_b->gh_flags & GL_ATIME))
+               return 1;
 
-       return ret;
+       return 0;
 }
 
 /**
index 2cf2802fc92e1326f734786e8ab981cac6d8468e..e93066f930c1be2b0a3eeb0394ef96432fa43d35 100644 (file)
@@ -21,7 +21,6 @@
 #include "incore.h"
 #include "bmap.h"
 #include "dir.h"
-#include "format.h"
 #include "glock.h"
 #include "glops.h"
 #include "inode.h"
 #include "trans.h"
 #include "util.h"
 
+static const uint32_t gfs2_old_fs_formats[] = {
+        0
+};
+
+static const uint32_t gfs2_old_multihost_formats[] = {
+        0
+};
+
 /**
  * gfs2_tune_init - Fill a gfs2_tune structure with default values
  * @gt: tune