aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_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/ops_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/ops_inode.c')
-rw-r--r--fs/gfs2/ops_inode.c62
1 files changed, 33 insertions, 29 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 9971a30eb78e..7633a8584b0d 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -17,10 +17,13 @@
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/xattr.h> 18#include <linux/xattr.h>
19#include <linux/posix_acl.h> 19#include <linux/posix_acl.h>
20#include <linux/gfs2_ondisk.h>
20#include <asm/semaphore.h> 21#include <asm/semaphore.h>
21#include <asm/uaccess.h> 22#include <asm/uaccess.h>
22 23
23#include "gfs2.h" 24#include "gfs2.h"
25#include "lm_interface.h"
26#include "incore.h"
24#include "acl.h" 27#include "acl.h"
25#include "bmap.h" 28#include "bmap.h"
26#include "dir.h" 29#include "dir.h"
@@ -36,6 +39,7 @@
36#include "rgrp.h" 39#include "rgrp.h"
37#include "trans.h" 40#include "trans.h"
38#include "unlinked.h" 41#include "unlinked.h"
42#include "util.h"
39 43
40/** 44/**
41 * gfs2_create - Create a file 45 * gfs2_create - Create a file
@@ -49,7 +53,7 @@
49static int gfs2_create(struct inode *dir, struct dentry *dentry, 53static int gfs2_create(struct inode *dir, struct dentry *dentry,
50 int mode, struct nameidata *nd) 54 int mode, struct nameidata *nd)
51{ 55{
52 struct gfs2_inode *dip = get_v2ip(dir); 56 struct gfs2_inode *dip = dir->u.generic_ip;
53 struct gfs2_sbd *sdp = dip->i_sbd; 57 struct gfs2_sbd *sdp = dip->i_sbd;
54 struct gfs2_holder ghs[2]; 58 struct gfs2_holder ghs[2];
55 struct inode *inode; 59 struct inode *inode;
@@ -106,7 +110,7 @@ static int gfs2_create(struct inode *dir, struct dentry *dentry,
106static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry, 110static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry,
107 struct nameidata *nd) 111 struct nameidata *nd)
108{ 112{
109 struct gfs2_inode *dip = get_v2ip(dir); 113 struct gfs2_inode *dip = dir->u.generic_ip;
110 struct gfs2_sbd *sdp = dip->i_sbd; 114 struct gfs2_sbd *sdp = dip->i_sbd;
111 struct inode *inode = NULL; 115 struct inode *inode = NULL;
112 int error; 116 int error;
@@ -140,10 +144,10 @@ static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry,
140static int gfs2_link(struct dentry *old_dentry, struct inode *dir, 144static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
141 struct dentry *dentry) 145 struct dentry *dentry)
142{ 146{
143 struct gfs2_inode *dip = get_v2ip(dir); 147 struct gfs2_inode *dip = dir->u.generic_ip;
144 struct gfs2_sbd *sdp = dip->i_sbd; 148 struct gfs2_sbd *sdp = dip->i_sbd;
145 struct inode *inode = old_dentry->d_inode; 149 struct inode *inode = old_dentry->d_inode;
146 struct gfs2_inode *ip = get_v2ip(inode); 150 struct gfs2_inode *ip = inode->u.generic_ip;
147 struct gfs2_holder ghs[2]; 151 struct gfs2_holder ghs[2];
148 int alloc_required; 152 int alloc_required;
149 int error; 153 int error;
@@ -274,9 +278,9 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
274 278
275static int gfs2_unlink(struct inode *dir, struct dentry *dentry) 279static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
276{ 280{
277 struct gfs2_inode *dip = get_v2ip(dir); 281 struct gfs2_inode *dip = dir->u.generic_ip;
278 struct gfs2_sbd *sdp = dip->i_sbd; 282 struct gfs2_sbd *sdp = dip->i_sbd;
279 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 283 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
280 struct gfs2_unlinked *ul; 284 struct gfs2_unlinked *ul;
281 struct gfs2_holder ghs[2]; 285 struct gfs2_holder ghs[2];
282 int error; 286 int error;
@@ -329,7 +333,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
329static int gfs2_symlink(struct inode *dir, struct dentry *dentry, 333static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
330 const char *symname) 334 const char *symname)
331{ 335{
332 struct gfs2_inode *dip = get_v2ip(dir), *ip; 336 struct gfs2_inode *dip = dir->u.generic_ip, *ip;
333 struct gfs2_sbd *sdp = dip->i_sbd; 337 struct gfs2_sbd *sdp = dip->i_sbd;
334 struct gfs2_holder ghs[2]; 338 struct gfs2_holder ghs[2];
335 struct inode *inode; 339 struct inode *inode;
@@ -350,7 +354,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
350 return PTR_ERR(inode); 354 return PTR_ERR(inode);
351 } 355 }
352 356
353 ip = get_gl2ip(ghs[1].gh_gl); 357 ip = ghs[1].gh_gl->gl_object;
354 358
355 ip->i_di.di_size = size; 359 ip->i_di.di_size = size;
356 360
@@ -388,7 +392,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
388 392
389static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) 393static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
390{ 394{
391 struct gfs2_inode *dip = get_v2ip(dir), *ip; 395 struct gfs2_inode *dip = dir->u.generic_ip, *ip;
392 struct gfs2_sbd *sdp = dip->i_sbd; 396 struct gfs2_sbd *sdp = dip->i_sbd;
393 struct gfs2_holder ghs[2]; 397 struct gfs2_holder ghs[2];
394 struct inode *inode; 398 struct inode *inode;
@@ -403,7 +407,7 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
403 return PTR_ERR(inode); 407 return PTR_ERR(inode);
404 } 408 }
405 409
406 ip = get_gl2ip(ghs[1].gh_gl); 410 ip = ghs[1].gh_gl->gl_object;
407 411
408 ip->i_di.di_nlink = 2; 412 ip->i_di.di_nlink = 2;
409 ip->i_di.di_size = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode); 413 ip->i_di.di_size = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode);
@@ -468,9 +472,9 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
468 472
469static int gfs2_rmdir(struct inode *dir, struct dentry *dentry) 473static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)
470{ 474{
471 struct gfs2_inode *dip = get_v2ip(dir); 475 struct gfs2_inode *dip = dir->u.generic_ip;
472 struct gfs2_sbd *sdp = dip->i_sbd; 476 struct gfs2_sbd *sdp = dip->i_sbd;
473 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 477 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
474 struct gfs2_unlinked *ul; 478 struct gfs2_unlinked *ul;
475 struct gfs2_holder ghs[2]; 479 struct gfs2_holder ghs[2];
476 int error; 480 int error;
@@ -534,7 +538,7 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)
534static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode, 538static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
535 dev_t dev) 539 dev_t dev)
536{ 540{
537 struct gfs2_inode *dip = get_v2ip(dir), *ip; 541 struct gfs2_inode *dip = dir->u.generic_ip, *ip;
538 struct gfs2_sbd *sdp = dip->i_sbd; 542 struct gfs2_sbd *sdp = dip->i_sbd;
539 struct gfs2_holder ghs[2]; 543 struct gfs2_holder ghs[2];
540 struct inode *inode; 544 struct inode *inode;
@@ -563,7 +567,7 @@ static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
563 return PTR_ERR(inode); 567 return PTR_ERR(inode);
564 } 568 }
565 569
566 ip = get_gl2ip(ghs[1].gh_gl); 570 ip = ghs[1].gh_gl->gl_object;
567 571
568 ip->i_di.di_major = major; 572 ip->i_di.di_major = major;
569 ip->i_di.di_minor = minor; 573 ip->i_di.di_minor = minor;
@@ -602,9 +606,9 @@ static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
602static int gfs2_rename(struct inode *odir, struct dentry *odentry, 606static int gfs2_rename(struct inode *odir, struct dentry *odentry,
603 struct inode *ndir, struct dentry *ndentry) 607 struct inode *ndir, struct dentry *ndentry)
604{ 608{
605 struct gfs2_inode *odip = get_v2ip(odir); 609 struct gfs2_inode *odip = odir->u.generic_ip;
606 struct gfs2_inode *ndip = get_v2ip(ndir); 610 struct gfs2_inode *ndip = ndir->u.generic_ip;
607 struct gfs2_inode *ip = get_v2ip(odentry->d_inode); 611 struct gfs2_inode *ip = odentry->d_inode->u.generic_ip;
608 struct gfs2_inode *nip = NULL; 612 struct gfs2_inode *nip = NULL;
609 struct gfs2_sbd *sdp = odip->i_sbd; 613 struct gfs2_sbd *sdp = odip->i_sbd;
610 struct gfs2_unlinked *ul; 614 struct gfs2_unlinked *ul;
@@ -616,7 +620,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
616 int error; 620 int error;
617 621
618 if (ndentry->d_inode) { 622 if (ndentry->d_inode) {
619 nip = get_v2ip(ndentry->d_inode); 623 nip = ndentry->d_inode->u.generic_ip;
620 if (ip == nip) 624 if (ip == nip)
621 return 0; 625 return 0;
622 } 626 }
@@ -848,7 +852,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
848static int gfs2_readlink(struct dentry *dentry, char __user *user_buf, 852static int gfs2_readlink(struct dentry *dentry, char __user *user_buf,
849 int user_size) 853 int user_size)
850{ 854{
851 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 855 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
852 char array[GFS2_FAST_NAME_SIZE], *buf = array; 856 char array[GFS2_FAST_NAME_SIZE], *buf = array;
853 unsigned int len = GFS2_FAST_NAME_SIZE; 857 unsigned int len = GFS2_FAST_NAME_SIZE;
854 int error; 858 int error;
@@ -884,7 +888,7 @@ static int gfs2_readlink(struct dentry *dentry, char __user *user_buf,
884 888
885static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd) 889static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
886{ 890{
887 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 891 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
888 char array[GFS2_FAST_NAME_SIZE], *buf = array; 892 char array[GFS2_FAST_NAME_SIZE], *buf = array;
889 unsigned int len = GFS2_FAST_NAME_SIZE; 893 unsigned int len = GFS2_FAST_NAME_SIZE;
890 int error; 894 int error;
@@ -910,7 +914,7 @@ static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
910 914
911static int gfs2_permission(struct inode *inode, int mask, struct nameidata *nd) 915static int gfs2_permission(struct inode *inode, int mask, struct nameidata *nd)
912{ 916{
913 struct gfs2_inode *ip = get_v2ip(inode); 917 struct gfs2_inode *ip = inode->u.generic_ip;
914 struct gfs2_holder i_gh; 918 struct gfs2_holder i_gh;
915 int error; 919 int error;
916 920
@@ -930,7 +934,7 @@ static int gfs2_permission(struct inode *inode, int mask, struct nameidata *nd)
930 934
931static int setattr_size(struct inode *inode, struct iattr *attr) 935static int setattr_size(struct inode *inode, struct iattr *attr)
932{ 936{
933 struct gfs2_inode *ip = get_v2ip(inode); 937 struct gfs2_inode *ip = inode->u.generic_ip;
934 int error; 938 int error;
935 939
936 if (attr->ia_size != ip->i_di.di_size) { 940 if (attr->ia_size != ip->i_di.di_size) {
@@ -948,7 +952,7 @@ static int setattr_size(struct inode *inode, struct iattr *attr)
948 952
949static int setattr_chown(struct inode *inode, struct iattr *attr) 953static int setattr_chown(struct inode *inode, struct iattr *attr)
950{ 954{
951 struct gfs2_inode *ip = get_v2ip(inode); 955 struct gfs2_inode *ip = inode->u.generic_ip;
952 struct gfs2_sbd *sdp = ip->i_sbd; 956 struct gfs2_sbd *sdp = ip->i_sbd;
953 struct buffer_head *dibh; 957 struct buffer_head *dibh;
954 uint32_t ouid, ogid, nuid, ngid; 958 uint32_t ouid, ogid, nuid, ngid;
@@ -1025,7 +1029,7 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
1025static int gfs2_setattr(struct dentry *dentry, struct iattr *attr) 1029static int gfs2_setattr(struct dentry *dentry, struct iattr *attr)
1026{ 1030{
1027 struct inode *inode = dentry->d_inode; 1031 struct inode *inode = dentry->d_inode;
1028 struct gfs2_inode *ip = get_v2ip(inode); 1032 struct gfs2_inode *ip = inode->u.generic_ip;
1029 struct gfs2_holder i_gh; 1033 struct gfs2_holder i_gh;
1030 int error; 1034 int error;
1031 1035
@@ -1072,7 +1076,7 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
1072 struct kstat *stat) 1076 struct kstat *stat)
1073{ 1077{
1074 struct inode *inode = dentry->d_inode; 1078 struct inode *inode = dentry->d_inode;
1075 struct gfs2_inode *ip = get_v2ip(inode); 1079 struct gfs2_inode *ip = inode->u.generic_ip;
1076 struct gfs2_holder gh; 1080 struct gfs2_holder gh;
1077 int error; 1081 int error;
1078 1082
@@ -1088,7 +1092,7 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
1088static int gfs2_setxattr(struct dentry *dentry, const char *name, 1092static int gfs2_setxattr(struct dentry *dentry, const char *name,
1089 const void *data, size_t size, int flags) 1093 const void *data, size_t size, int flags)
1090{ 1094{
1091 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 1095 struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
1092 struct gfs2_ea_request er; 1096 struct gfs2_ea_request er;
1093 1097
1094 memset(&er, 0, sizeof(struct gfs2_ea_request)); 1098 memset(&er, 0, sizeof(struct gfs2_ea_request));
@@ -1118,7 +1122,7 @@ static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name,
1118 er.er_name_len = strlen(er.er_name); 1122 er.er_name_len = strlen(er.er_name);
1119 er.er_data_len = size; 1123 er.er_data_len = size;
1120 1124
1121 return gfs2_ea_get(get_v2ip(dentry->d_inode), &er); 1125 return gfs2_ea_get(dentry->d_inode->u.generic_ip, &er);
1122} 1126}
1123 1127
1124static ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size) 1128static ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
@@ -1129,7 +1133,7 @@ static ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
1129 er.er_data = (size) ? buffer : NULL; 1133 er.er_data = (size) ? buffer : NULL;
1130 er.er_data_len = size; 1134 er.er_data_len = size;
1131 1135
1132 return gfs2_ea_list(get_v2ip(dentry->d_inode), &er); 1136 return gfs2_ea_list(dentry->d_inode->u.generic_ip, &er);
1133} 1137}
1134 1138
1135static int gfs2_removexattr(struct dentry *dentry, const char *name) 1139static int gfs2_removexattr(struct dentry *dentry, const char *name)
@@ -1142,7 +1146,7 @@ static int gfs2_removexattr(struct dentry *dentry, const char *name)
1142 return -EOPNOTSUPP; 1146 return -EOPNOTSUPP;
1143 er.er_name_len = strlen(er.er_name); 1147 er.er_name_len = strlen(er.er_name);
1144 1148
1145 return gfs2_ea_remove(get_v2ip(dentry->d_inode), &er); 1149 return gfs2_ea_remove(dentry->d_inode->u.generic_ip, &er);
1146} 1150}
1147 1151
1148struct inode_operations gfs2_file_iops = { 1152struct inode_operations gfs2_file_iops = {