aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-02-27 17:23:27 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-02-27 17:23:27 -0500
commit5c676f6d359b0404d53f542f02e1359583cb2895 (patch)
tree8741011990ec0a3d0d41fee9f0d7abf6a16834cc /fs/gfs2/inode.c
parentf3b270a47882b958e9e3c5bd86894e3a7072899a (diff)
[GFS2] Macros removal in gfs2.h
As suggested by Pekka Enberg <penberg@cs.helsinki.fi>. The DIV_RU macro is renamed DIV_ROUND_UP and and moved to kernel.h The other macros are gone from gfs2.h as (although not requested by Pekka Enberg) are a number of included header file which are now included individually. The inode number comparison function is now an inline function. The DT2IF and IF2DT may be addressed in a future patch. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 51ecdb8503b0..ea9e996f3673 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -14,9 +14,12 @@
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/posix_acl.h> 15#include <linux/posix_acl.h>
16#include <linux/sort.h> 16#include <linux/sort.h>
17#include <linux/gfs2_ondisk.h>
17#include <asm/semaphore.h> 18#include <asm/semaphore.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
21#include "lm_interface.h"
22#include "incore.h"
20#include "acl.h" 23#include "acl.h"
21#include "bmap.h" 24#include "bmap.h"
22#include "dir.h" 25#include "dir.h"
@@ -33,6 +36,7 @@
33#include "rgrp.h" 36#include "rgrp.h"
34#include "trans.h" 37#include "trans.h"
35#include "unlinked.h" 38#include "unlinked.h"
39#include "util.h"
36 40
37/** 41/**
38 * inode_attr_in - Copy attributes from the dinode into the VFS inode 42 * inode_attr_in - Copy attributes from the dinode into the VFS inode
@@ -176,7 +180,7 @@ struct inode *gfs2_ip2v(struct gfs2_inode *ip)
176 init_special_inode(tmp, tmp->i_mode, tmp->i_rdev); 180 init_special_inode(tmp, tmp->i_mode, tmp->i_rdev);
177 } 181 }
178 182
179 set_v2ip(tmp, NULL); 183 tmp->u.generic_ip = NULL;
180 184
181 for (;;) { 185 for (;;) {
182 spin_lock(&ip->i_spin); 186 spin_lock(&ip->i_spin);
@@ -196,7 +200,7 @@ struct inode *gfs2_ip2v(struct gfs2_inode *ip)
196 200
197 gfs2_inode_hold(ip); 201 gfs2_inode_hold(ip);
198 ip->i_vnode = inode; 202 ip->i_vnode = inode;
199 set_v2ip(inode, ip); 203 inode->u.generic_ip = ip;
200 204
201 spin_unlock(&ip->i_spin); 205 spin_unlock(&ip->i_spin);
202 206
@@ -207,7 +211,7 @@ struct inode *gfs2_ip2v(struct gfs2_inode *ip)
207 211
208static int iget_test(struct inode *inode, void *opaque) 212static int iget_test(struct inode *inode, void *opaque)
209{ 213{
210 struct gfs2_inode *ip = get_v2ip(inode); 214 struct gfs2_inode *ip = inode->u.generic_ip;
211 struct gfs2_inum *inum = (struct gfs2_inum *)opaque; 215 struct gfs2_inum *inum = (struct gfs2_inum *)opaque;
212 216
213 if (ip && ip->i_num.no_addr == inum->no_addr) 217 if (ip && ip->i_num.no_addr == inum->no_addr)
@@ -320,11 +324,11 @@ static int inode_create(struct gfs2_glock *i_gl, struct gfs2_inum *inum,
320 324
321 spin_lock(&io_gl->gl_spin); 325 spin_lock(&io_gl->gl_spin);
322 gfs2_glock_hold(i_gl); 326 gfs2_glock_hold(i_gl);
323 set_gl2gl(io_gl, i_gl); 327 io_gl->gl_object = i_gl;
324 spin_unlock(&io_gl->gl_spin); 328 spin_unlock(&io_gl->gl_spin);
325 329
326 gfs2_glock_hold(i_gl); 330 gfs2_glock_hold(i_gl);
327 set_gl2ip(i_gl, ip); 331 i_gl->gl_object = ip;
328 332
329 atomic_inc(&sdp->sd_inode_count); 333 atomic_inc(&sdp->sd_inode_count);
330 334
@@ -359,7 +363,7 @@ int gfs2_inode_get(struct gfs2_glock *i_gl, struct gfs2_inum *inum, int create,
359 363
360 gfs2_glmutex_lock(i_gl); 364 gfs2_glmutex_lock(i_gl);
361 365
362 *ipp = get_gl2ip(i_gl); 366 *ipp = i_gl->gl_object;
363 if (*ipp) { 367 if (*ipp) {
364 error = -ESTALE; 368 error = -ESTALE;
365 if ((*ipp)->i_num.no_formal_ino != inum->no_formal_ino) 369 if ((*ipp)->i_num.no_formal_ino != inum->no_formal_ino)
@@ -404,10 +408,10 @@ void gfs2_inode_destroy(struct gfs2_inode *ip)
404 struct gfs2_glock *i_gl = ip->i_gl; 408 struct gfs2_glock *i_gl = ip->i_gl;
405 409
406 gfs2_assert_warn(sdp, !atomic_read(&ip->i_count)); 410 gfs2_assert_warn(sdp, !atomic_read(&ip->i_count));
407 gfs2_assert(sdp, get_gl2gl(io_gl) == i_gl); 411 gfs2_assert(sdp, io_gl->gl_object == i_gl);
408 412
409 spin_lock(&io_gl->gl_spin); 413 spin_lock(&io_gl->gl_spin);
410 set_gl2gl(io_gl, NULL); 414 io_gl->gl_object = NULL;
411 gfs2_glock_put(i_gl); 415 gfs2_glock_put(i_gl);
412 spin_unlock(&io_gl->gl_spin); 416 spin_unlock(&io_gl->gl_spin);
413 417
@@ -416,7 +420,7 @@ void gfs2_inode_destroy(struct gfs2_inode *ip)
416 gfs2_meta_cache_flush(ip); 420 gfs2_meta_cache_flush(ip);
417 kmem_cache_free(gfs2_inode_cachep, ip); 421 kmem_cache_free(gfs2_inode_cachep, ip);
418 422
419 set_gl2ip(i_gl, NULL); 423 i_gl->gl_object = NULL;
420 gfs2_glock_put(i_gl); 424 gfs2_glock_put(i_gl);
421 425
422 atomic_dec(&sdp->sd_inode_count); 426 atomic_dec(&sdp->sd_inode_count);
@@ -524,7 +528,7 @@ static int inode_dealloc(struct gfs2_sbd *sdp, struct gfs2_unlinked *ul,
524 goto out; 528 goto out;
525 } 529 }
526 530
527 gfs2_assert_warn(sdp, !get_gl2ip(i_gh.gh_gl)); 531 gfs2_assert_warn(sdp, !i_gh.gh_gl->gl_object);
528 error = inode_create(i_gh.gh_gl, &ul->ul_ut.ut_inum, io_gh->gh_gl, 532 error = inode_create(i_gh.gh_gl, &ul->ul_ut.ut_inum, io_gh->gh_gl,
529 LM_ST_EXCLUSIVE, &ip); 533 LM_ST_EXCLUSIVE, &ip);
530 534
@@ -715,7 +719,7 @@ int gfs2_lookupi(struct inode *dir, struct qstr *name, int is_root,
715 struct inode **inodep) 719 struct inode **inodep)
716{ 720{
717 struct gfs2_inode *ipp; 721 struct gfs2_inode *ipp;
718 struct gfs2_inode *dip = get_v2ip(dir); 722 struct gfs2_inode *dip = dir->u.generic_ip;
719 struct gfs2_sbd *sdp = dip->i_sbd; 723 struct gfs2_sbd *sdp = dip->i_sbd;
720 struct gfs2_holder d_gh; 724 struct gfs2_holder d_gh;
721 struct gfs2_inum inum; 725 struct gfs2_inum inum;
@@ -774,7 +778,7 @@ done:
774 778
775static int pick_formal_ino_1(struct gfs2_sbd *sdp, uint64_t *formal_ino) 779static int pick_formal_ino_1(struct gfs2_sbd *sdp, uint64_t *formal_ino)
776{ 780{
777 struct gfs2_inode *ip = get_v2ip(sdp->sd_ir_inode); 781 struct gfs2_inode *ip = sdp->sd_ir_inode->u.generic_ip;
778 struct buffer_head *bh; 782 struct buffer_head *bh;
779 struct gfs2_inum_range ir; 783 struct gfs2_inum_range ir;
780 int error; 784 int error;
@@ -815,8 +819,8 @@ static int pick_formal_ino_1(struct gfs2_sbd *sdp, uint64_t *formal_ino)
815 819
816static int pick_formal_ino_2(struct gfs2_sbd *sdp, uint64_t *formal_ino) 820static int pick_formal_ino_2(struct gfs2_sbd *sdp, uint64_t *formal_ino)
817{ 821{
818 struct gfs2_inode *ip = get_v2ip(sdp->sd_ir_inode); 822 struct gfs2_inode *ip = sdp->sd_ir_inode->u.generic_ip;
819 struct gfs2_inode *m_ip = get_v2ip(sdp->sd_inum_inode); 823 struct gfs2_inode *m_ip = sdp->sd_inum_inode->u.generic_ip;
820 struct gfs2_holder gh; 824 struct gfs2_holder gh;
821 struct buffer_head *bh; 825 struct buffer_head *bh;
822 struct gfs2_inum_range ir; 826 struct gfs2_inum_range ir;
@@ -1194,7 +1198,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name,
1194 unsigned int mode) 1198 unsigned int mode)
1195{ 1199{
1196 struct inode *inode; 1200 struct inode *inode;
1197 struct gfs2_inode *dip = get_gl2ip(ghs->gh_gl); 1201 struct gfs2_inode *dip = ghs->gh_gl->gl_object;
1198 struct gfs2_sbd *sdp = dip->i_sbd; 1202 struct gfs2_sbd *sdp = dip->i_sbd;
1199 struct gfs2_unlinked *ul; 1203 struct gfs2_unlinked *ul;
1200 struct gfs2_inode *ip; 1204 struct gfs2_inode *ip;
@@ -1570,7 +1574,7 @@ int gfs2_glock_nq_atime(struct gfs2_holder *gh)
1570{ 1574{
1571 struct gfs2_glock *gl = gh->gh_gl; 1575 struct gfs2_glock *gl = gh->gh_gl;
1572 struct gfs2_sbd *sdp = gl->gl_sbd; 1576 struct gfs2_sbd *sdp = gl->gl_sbd;
1573 struct gfs2_inode *ip = get_gl2ip(gl); 1577 struct gfs2_inode *ip = gl->gl_object;
1574 int64_t curtime, quantum = gfs2_tune_get(sdp, gt_atime_quantum); 1578 int64_t curtime, quantum = gfs2_tune_get(sdp, gt_atime_quantum);
1575 unsigned int state; 1579 unsigned int state;
1576 int flags; 1580 int flags;
@@ -1817,7 +1821,7 @@ int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
1817{ 1821{
1818 int error; 1822 int error;
1819 1823
1820 if (get_transaction) 1824 if (current->journal_info)
1821 return __gfs2_setattr_simple(ip, attr); 1825 return __gfs2_setattr_simple(ip, attr);
1822 1826
1823 error = gfs2_trans_begin(ip->i_sbd, RES_DINODE, 0); 1827 error = gfs2_trans_begin(ip->i_sbd, RES_DINODE, 0);