aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-09-04 11:41:31 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-09-04 11:41:31 -0400
commit75d3b817a0b48425da921052955cc58f20bbab52 (patch)
tree7fb2e9bf18d794a590f43397ee56f3ce917a2233 /fs
parent31e77ac55f18db0ec1c724840927562ef3093ef6 (diff)
[GFS2] Tidy up bmap/inode code
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/bmap.c16
-rw-r--r--fs/gfs2/format.h21
-rw-r--r--fs/gfs2/glops.c12
-rw-r--r--fs/gfs2/inode.c47
-rw-r--r--fs/gfs2/super.c9
5 files changed, 41 insertions, 64 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 913c0e5490e9..b75a2f93dada 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -94,7 +94,7 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh,
94 map_bh(bh, inode->i_sb, block); 94 map_bh(bh, inode->i_sb, block);
95 95
96 set_buffer_uptodate(bh); 96 set_buffer_uptodate(bh);
97 if ((sdp->sd_args.ar_data == GFS2_DATA_ORDERED) || gfs2_is_jdata(ip)) 97 if (sdp->sd_args.ar_data == GFS2_DATA_ORDERED || gfs2_is_jdata(ip))
98 gfs2_trans_add_bh(ip->i_gl, bh, 0); 98 gfs2_trans_add_bh(ip->i_gl, bh, 0);
99 mark_buffer_dirty(bh); 99 mark_buffer_dirty(bh);
100 100
@@ -369,7 +369,7 @@ static inline u64 *metapointer(struct buffer_head *bh, int *boundary,
369 u64 *ptr; 369 u64 *ptr;
370 *boundary = 0; 370 *boundary = 0;
371 ptr = ((u64 *)(bh->b_data + head_size)) + mp->mp_list[height]; 371 ptr = ((u64 *)(bh->b_data + head_size)) + mp->mp_list[height];
372 if (ptr + 1 == (u64*)(bh->b_data + bh->b_size)) 372 if (ptr + 1 == (u64 *)(bh->b_data + bh->b_size))
373 *boundary = 1; 373 *boundary = 1;
374 return ptr; 374 return ptr;
375} 375}
@@ -456,7 +456,7 @@ static struct buffer_head *gfs2_block_pointers(struct inode *inode, u64 lblock,
456 if (gfs2_assert_warn(sdp, !gfs2_is_stuffed(ip))) 456 if (gfs2_assert_warn(sdp, !gfs2_is_stuffed(ip)))
457 goto out; 457 goto out;
458 458
459 bsize = (gfs2_is_dir(ip)) ? sdp->sd_jbsize : sdp->sd_sb.sb_bsize; 459 bsize = gfs2_is_dir(ip) ? sdp->sd_jbsize : sdp->sd_sb.sb_bsize;
460 460
461 height = calc_tree_height(ip, (lblock + 1) * bsize); 461 height = calc_tree_height(ip, (lblock + 1) * bsize);
462 if (ip->i_di.di_height < height) { 462 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
554 bh = gfs2_block_pointers(inode, lblock, new, dblock, &boundary, &mp); 554 bh = gfs2_block_pointers(inode, lblock, new, dblock, &boundary, &mp);
555 *extlen = 1; 555 *extlen = 1;
556 556
557 if (bh && !IS_ERR(bh) && *dblock && !*new) { 557 if (bh != NULL && !IS_ERR(bh) && *dblock != 0 && *new == 0) {
558 u64 tmp_dblock; 558 u64 tmp_dblock;
559 int tmp_new; 559 int tmp_new;
560 unsigned int nptrs; 560 unsigned int nptrs;
@@ -565,7 +565,7 @@ int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsi
565 lookup_block(ip, bh, end_of_metadata, &mp, 0, &tmp_new, &tmp_dblock); 565 lookup_block(ip, bh, end_of_metadata, &mp, 0, &tmp_new, &tmp_dblock);
566 if (*dblock + *extlen != tmp_dblock) 566 if (*dblock + *extlen != tmp_dblock)
567 break; 567 break;
568 (*extlen)++; 568 ++*extlen;
569 } 569 }
570 } 570 }
571 bmap_unlock(inode, create); 571 bmap_unlock(inode, create);
@@ -612,10 +612,8 @@ static int recursive_scan(struct gfs2_inode *ip, struct buffer_head *dibh,
612 return error; 612 return error;
613 dibh = bh; 613 dibh = bh;
614 614
615 top = (uint64_t *)(bh->b_data + sizeof(struct gfs2_dinode)) + 615 top = (u64 *)(bh->b_data + sizeof(struct gfs2_dinode)) + mp->mp_list[0];
616 mp->mp_list[0]; 616 bottom = (u64 *)(bh->b_data + sizeof(struct gfs2_dinode)) + sdp->sd_diptrs;
617 bottom = (uint64_t *)(bh->b_data + sizeof(struct gfs2_dinode)) +
618 sdp->sd_diptrs;
619 } else { 617 } else {
620 error = gfs2_meta_indirect_buffer(ip, height, block, 0, &bh); 618 error = gfs2_meta_indirect_buffer(ip, height, block, 0, &bh);
621 if (error) 619 if (error)
diff --git a/fs/gfs2/format.h b/fs/gfs2/format.h
deleted file mode 100644
index 9acbf457ee58..000000000000
--- a/fs/gfs2/format.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */
9
10#ifndef __FORMAT_DOT_H__
11#define __FORMAT_DOT_H__
12
13static const uint32_t gfs2_old_fs_formats[] = {
14 0
15};
16
17static const uint32_t gfs2_old_multihost_formats[] = {
18 0
19};
20
21#endif /* __FORMAT_DOT_H__ */
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 8e1d8ee68e2e..d3e7b082a918 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -234,7 +234,6 @@ static void inode_go_sync(struct gfs2_glock *gl, int flags)
234 if (flags & DIO_RELEASE) 234 if (flags & DIO_RELEASE)
235 gfs2_ail_empty_gl(gl); 235 gfs2_ail_empty_gl(gl);
236 } 236 }
237
238} 237}
239 238
240/** 239/**
@@ -324,12 +323,11 @@ static void inode_go_unlock(struct gfs2_holder *gh)
324 struct gfs2_glock *gl = gh->gh_gl; 323 struct gfs2_glock *gl = gh->gh_gl;
325 struct gfs2_inode *ip = gl->gl_object; 324 struct gfs2_inode *ip = gl->gl_object;
326 325
327 if (ip) { 326 if (ip == NULL)
328 if (test_bit(GLF_DIRTY, &gl->gl_flags)) 327 return;
329 gfs2_inode_attr_in(ip); 328 if (test_bit(GLF_DIRTY, &gl->gl_flags))
330 329 gfs2_inode_attr_in(ip);
331 gfs2_meta_cache_flush(ip); 330 gfs2_meta_cache_flush(ip);
332 }
333} 331}
334 332
335/** 333/**
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index decb0cf85691..1aaaaa1cc8c3 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -97,15 +97,15 @@ void gfs2_inode_attr_in(struct gfs2_inode *ip)
97void gfs2_inode_attr_out(struct gfs2_inode *ip) 97void gfs2_inode_attr_out(struct gfs2_inode *ip)
98{ 98{
99 struct inode *inode = &ip->i_inode; 99 struct inode *inode = &ip->i_inode;
100 100 struct gfs2_dinode *di = &ip->i_di;
101 gfs2_assert_withdraw(GFS2_SB(inode), 101 gfs2_assert_withdraw(GFS2_SB(inode),
102 (ip->i_di.di_mode & S_IFMT) == (inode->i_mode & S_IFMT)); 102 (di->di_mode & S_IFMT) == (inode->i_mode & S_IFMT));
103 ip->i_di.di_mode = inode->i_mode; 103 di->di_mode = inode->i_mode;
104 ip->i_di.di_uid = inode->i_uid; 104 di->di_uid = inode->i_uid;
105 ip->i_di.di_gid = inode->i_gid; 105 di->di_gid = inode->i_gid;
106 ip->i_di.di_atime = inode->i_atime.tv_sec; 106 di->di_atime = inode->i_atime.tv_sec;
107 ip->i_di.di_mtime = inode->i_mtime.tv_sec; 107 di->di_mtime = inode->i_mtime.tv_sec;
108 ip->i_di.di_ctime = inode->i_ctime.tv_sec; 108 di->di_ctime = inode->i_ctime.tv_sec;
109} 109}
110 110
111static int iget_test(struct inode *inode, void *opaque) 111static int iget_test(struct inode *inode, void *opaque)
@@ -1213,31 +1213,26 @@ fail:
1213 * 1213 *
1214 * Returns: 1 if A > B 1214 * Returns: 1 if A > B
1215 * -1 if A < B 1215 * -1 if A < B
1216 * 0 if A = B 1216 * 0 if A == B
1217 */ 1217 */
1218 1218
1219static int glock_compare_atime(const void *arg_a, const void *arg_b) 1219static int glock_compare_atime(const void *arg_a, const void *arg_b)
1220{ 1220{
1221 struct gfs2_holder *gh_a = *(struct gfs2_holder **)arg_a; 1221 const struct gfs2_holder *gh_a = *(const struct gfs2_holder **)arg_a;
1222 struct gfs2_holder *gh_b = *(struct gfs2_holder **)arg_b; 1222 const struct gfs2_holder *gh_b = *(const struct gfs2_holder **)arg_b;
1223 struct lm_lockname *a = &gh_a->gh_gl->gl_name; 1223 const struct lm_lockname *a = &gh_a->gh_gl->gl_name;
1224 struct lm_lockname *b = &gh_b->gh_gl->gl_name; 1224 const struct lm_lockname *b = &gh_b->gh_gl->gl_name;
1225 int ret = 0;
1226 1225
1227 if (a->ln_number > b->ln_number) 1226 if (a->ln_number > b->ln_number)
1228 ret = 1; 1227 return 1;
1229 else if (a->ln_number < b->ln_number) 1228 if (a->ln_number < b->ln_number)
1230 ret = -1; 1229 return -1;
1231 else { 1230 if (gh_a->gh_state == LM_ST_SHARED && gh_b->gh_state == LM_ST_EXCLUSIVE)
1232 if (gh_a->gh_state == LM_ST_SHARED && 1231 return 1;
1233 gh_b->gh_state == LM_ST_EXCLUSIVE) 1232 if (gh_a->gh_state == LM_ST_SHARED && (gh_b->gh_flags & GL_ATIME))
1234 ret = 1; 1233 return 1;
1235 else if (gh_a->gh_state == LM_ST_SHARED &&
1236 (gh_b->gh_flags & GL_ATIME))
1237 ret = 1;
1238 }
1239 1234
1240 return ret; 1235 return 0;
1241} 1236}
1242 1237
1243/** 1238/**
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 2cf2802fc92e..e93066f930c1 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -21,7 +21,6 @@
21#include "incore.h" 21#include "incore.h"
22#include "bmap.h" 22#include "bmap.h"
23#include "dir.h" 23#include "dir.h"
24#include "format.h"
25#include "glock.h" 24#include "glock.h"
26#include "glops.h" 25#include "glops.h"
27#include "inode.h" 26#include "inode.h"
@@ -34,6 +33,14 @@
34#include "trans.h" 33#include "trans.h"
35#include "util.h" 34#include "util.h"
36 35
36static const uint32_t gfs2_old_fs_formats[] = {
37 0
38};
39
40static const uint32_t gfs2_old_multihost_formats[] = {
41 0
42};
43
37/** 44/**
38 * gfs2_tune_init - Fill a gfs2_tune structure with default values 45 * gfs2_tune_init - Fill a gfs2_tune structure with default values
39 * @gt: tune 46 * @gt: tune