aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@sgi.com>2005-09-02 02:46:51 -0400
committerNathan Scott <nathans@sgi.com>2005-09-02 02:46:51 -0400
commit0432dab2d2d3b35347a95c01c78a40781b6431fb (patch)
tree44fa8c13d6300c9c42b9f5a60aeb933131e24e67 /fs/xfs/linux-2.6
parent155ffd075caedcea5ad595c95403c71bfc391c4a (diff)
[XFS] remove struct vnode::v_type
SGI-PV: 936236 SGI-Modid: xfs-linux:xfs-kern:195878a Signed-off-by: Christoph Hellwig <hch@sgi.com> Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c16
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c6
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c35
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.c16
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h26
5 files changed, 42 insertions, 57 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 35cbd88e1a54..6a3326bcd8d0 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -141,13 +141,19 @@ xfs_find_handle(
141 return -XFS_ERROR(EINVAL); 141 return -XFS_ERROR(EINVAL);
142 } 142 }
143 143
144 /* we need the vnode */ 144 switch (inode->i_mode & S_IFMT) {
145 vp = LINVFS_GET_VP(inode); 145 case S_IFREG:
146 if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK) { 146 case S_IFDIR:
147 case S_IFLNK:
148 break;
149 default:
147 iput(inode); 150 iput(inode);
148 return -XFS_ERROR(EBADF); 151 return -XFS_ERROR(EBADF);
149 } 152 }
150 153
154 /* we need the vnode */
155 vp = LINVFS_GET_VP(inode);
156
151 /* now we can grab the fsid */ 157 /* now we can grab the fsid */
152 memcpy(&handle.ha_fsid, vp->v_vfsp->vfs_altfsid, sizeof(xfs_fsid_t)); 158 memcpy(&handle.ha_fsid, vp->v_vfsp->vfs_altfsid, sizeof(xfs_fsid_t));
153 hsize = sizeof(xfs_fsid_t); 159 hsize = sizeof(xfs_fsid_t);
@@ -386,7 +392,7 @@ xfs_readlink_by_handle(
386 return -error; 392 return -error;
387 393
388 /* Restrict this handle operation to symlinks only. */ 394 /* Restrict this handle operation to symlinks only. */
389 if (vp->v_type != VLNK) { 395 if (!S_ISLNK(inode->i_mode)) {
390 VN_RELE(vp); 396 VN_RELE(vp);
391 return -XFS_ERROR(EINVAL); 397 return -XFS_ERROR(EINVAL);
392 } 398 }
@@ -985,7 +991,7 @@ xfs_ioc_space(
985 if (!(filp->f_mode & FMODE_WRITE)) 991 if (!(filp->f_mode & FMODE_WRITE))
986 return -XFS_ERROR(EBADF); 992 return -XFS_ERROR(EBADF);
987 993
988 if (vp->v_type != VREG) 994 if (!VN_ISREG(vp))
989 return -XFS_ERROR(EINVAL); 995 return -XFS_ERROR(EINVAL);
990 996
991 if (copy_from_user(&bf, arg, sizeof(bf))) 997 if (copy_from_user(&bf, arg, sizeof(bf)))
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index f252605514eb..d237cc5be767 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -140,7 +140,6 @@ linvfs_mknod(
140 140
141 memset(&va, 0, sizeof(va)); 141 memset(&va, 0, sizeof(va));
142 va.va_mask = XFS_AT_TYPE|XFS_AT_MODE; 142 va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
143 va.va_type = IFTOVT(mode);
144 va.va_mode = mode; 143 va.va_mode = mode;
145 144
146 switch (mode & S_IFMT) { 145 switch (mode & S_IFMT) {
@@ -308,14 +307,13 @@ linvfs_symlink(
308 cvp = NULL; 307 cvp = NULL;
309 308
310 memset(&va, 0, sizeof(va)); 309 memset(&va, 0, sizeof(va));
311 va.va_type = VLNK; 310 va.va_mode = S_IFLNK |
312 va.va_mode = irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO; 311 (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO);
313 va.va_mask = XFS_AT_TYPE|XFS_AT_MODE; 312 va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
314 313
315 error = 0; 314 error = 0;
316 VOP_SYMLINK(dvp, dentry, &va, (char *)symname, &cvp, NULL, error); 315 VOP_SYMLINK(dvp, dentry, &va, (char *)symname, &cvp, NULL, error);
317 if (!error && cvp) { 316 if (!error && cvp) {
318 ASSERT(cvp->v_type == VLNK);
319 ip = LINVFS_GET_IP(cvp); 317 ip = LINVFS_GET_IP(cvp);
320 d_instantiate(dentry, ip); 318 d_instantiate(dentry, ip);
321 validate_fields(dir); 319 validate_fields(dir);
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index f6dd7de25927..d2c8a11e22b8 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -138,24 +138,25 @@ STATIC __inline__ void
138xfs_set_inodeops( 138xfs_set_inodeops(
139 struct inode *inode) 139 struct inode *inode)
140{ 140{
141 vnode_t *vp = LINVFS_GET_VP(inode); 141 switch (inode->i_mode & S_IFMT) {
142 142 case S_IFREG:
143 if (vp->v_type == VNON) {
144 vn_mark_bad(vp);
145 } else if (S_ISREG(inode->i_mode)) {
146 inode->i_op = &linvfs_file_inode_operations; 143 inode->i_op = &linvfs_file_inode_operations;
147 inode->i_fop = &linvfs_file_operations; 144 inode->i_fop = &linvfs_file_operations;
148 inode->i_mapping->a_ops = &linvfs_aops; 145 inode->i_mapping->a_ops = &linvfs_aops;
149 } else if (S_ISDIR(inode->i_mode)) { 146 break;
147 case S_IFDIR:
150 inode->i_op = &linvfs_dir_inode_operations; 148 inode->i_op = &linvfs_dir_inode_operations;
151 inode->i_fop = &linvfs_dir_operations; 149 inode->i_fop = &linvfs_dir_operations;
152 } else if (S_ISLNK(inode->i_mode)) { 150 break;
151 case S_IFLNK:
153 inode->i_op = &linvfs_symlink_inode_operations; 152 inode->i_op = &linvfs_symlink_inode_operations;
154 if (inode->i_blocks) 153 if (inode->i_blocks)
155 inode->i_mapping->a_ops = &linvfs_aops; 154 inode->i_mapping->a_ops = &linvfs_aops;
156 } else { 155 break;
156 default:
157 inode->i_op = &linvfs_file_inode_operations; 157 inode->i_op = &linvfs_file_inode_operations;
158 init_special_inode(inode, inode->i_mode, inode->i_rdev); 158 init_special_inode(inode, inode->i_mode, inode->i_rdev);
159 break;
159 } 160 }
160} 161}
161 162
@@ -167,16 +168,23 @@ xfs_revalidate_inode(
167{ 168{
168 struct inode *inode = LINVFS_GET_IP(vp); 169 struct inode *inode = LINVFS_GET_IP(vp);
169 170
170 inode->i_mode = (ip->i_d.di_mode & MODEMASK) | VTTOIF(vp->v_type); 171 inode->i_mode = ip->i_d.di_mode;
171 inode->i_nlink = ip->i_d.di_nlink; 172 inode->i_nlink = ip->i_d.di_nlink;
172 inode->i_uid = ip->i_d.di_uid; 173 inode->i_uid = ip->i_d.di_uid;
173 inode->i_gid = ip->i_d.di_gid; 174 inode->i_gid = ip->i_d.di_gid;
174 if (((1 << vp->v_type) & ((1<<VBLK) | (1<<VCHR))) == 0) { 175
176 switch (inode->i_mode & S_IFMT) {
177 case S_IFBLK:
178 case S_IFCHR:
179 inode->i_rdev =
180 MKDEV(sysv_major(ip->i_df.if_u2.if_rdev) & 0x1ff,
181 sysv_minor(ip->i_df.if_u2.if_rdev));
182 break;
183 default:
175 inode->i_rdev = 0; 184 inode->i_rdev = 0;
176 } else { 185 break;
177 xfs_dev_t dev = ip->i_df.if_u2.if_rdev;
178 inode->i_rdev = MKDEV(sysv_major(dev) & 0x1ff, sysv_minor(dev));
179 } 186 }
187
180 inode->i_blksize = PAGE_CACHE_SIZE; 188 inode->i_blksize = PAGE_CACHE_SIZE;
181 inode->i_generation = ip->i_d.di_gen; 189 inode->i_generation = ip->i_d.di_gen;
182 i_size_write(inode, ip->i_d.di_size); 190 i_size_write(inode, ip->i_d.di_size);
@@ -231,7 +239,6 @@ xfs_initialize_vnode(
231 * finish our work. 239 * finish our work.
232 */ 240 */
233 if (ip->i_d.di_mode != 0 && unlock && (inode->i_state & I_NEW)) { 241 if (ip->i_d.di_mode != 0 && unlock && (inode->i_state & I_NEW)) {
234 vp->v_type = IFTOVT(ip->i_d.di_mode);
235 xfs_revalidate_inode(XFS_BHVTOM(bdp), vp, ip); 242 xfs_revalidate_inode(XFS_BHVTOM(bdp), vp, ip);
236 xfs_set_inodeops(inode); 243 xfs_set_inodeops(inode);
237 244
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
index 353276bda344..ad16af38e965 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.c
+++ b/fs/xfs/linux-2.6/xfs_vnode.c
@@ -44,19 +44,6 @@ DEFINE_SPINLOCK(vnumber_lock);
44#define vptosync(v) (&vsync[((unsigned long)v) % NVSYNC]) 44#define vptosync(v) (&vsync[((unsigned long)v) % NVSYNC])
45sv_t vsync[NVSYNC]; 45sv_t vsync[NVSYNC];
46 46
47/*
48 * Translate stat(2) file types to vnode types and vice versa.
49 * Aware of numeric order of S_IFMT and vnode type values.
50 */
51enum vtype iftovt_tab[] = {
52 VNON, VFIFO, VCHR, VNON, VDIR, VNON, VBLK, VNON,
53 VREG, VNON, VLNK, VNON, VSOCK, VNON, VNON, VNON
54};
55
56u_short vttoif_tab[] = {
57 0, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, S_IFIFO, 0, S_IFSOCK
58};
59
60 47
61void 48void
62vn_init(void) 49vn_init(void)
@@ -95,7 +82,6 @@ vn_reclaim(
95 vp->v_flag &= (VRECLM|VWAIT); 82 vp->v_flag &= (VRECLM|VWAIT);
96 VN_UNLOCK(vp, 0); 83 VN_UNLOCK(vp, 0);
97 84
98 vp->v_type = VNON;
99 vp->v_fbhv = NULL; 85 vp->v_fbhv = NULL;
100 86
101#ifdef XFS_VNODE_TRACE 87#ifdef XFS_VNODE_TRACE
@@ -174,7 +160,7 @@ vn_revalidate_core(
174{ 160{
175 struct inode *inode = LINVFS_GET_IP(vp); 161 struct inode *inode = LINVFS_GET_IP(vp);
176 162
177 inode->i_mode = VTTOIF(vap->va_type) | vap->va_mode; 163 inode->i_mode = vap->va_mode;
178 inode->i_nlink = vap->va_nlink; 164 inode->i_nlink = vap->va_nlink;
179 inode->i_uid = vap->va_uid; 165 inode->i_uid = vap->va_uid;
180 inode->i_gid = vap->va_gid; 166 inode->i_gid = vap->va_gid;
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index 6cb0a01df25d..bc9ed722ba1e 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -65,10 +65,6 @@ struct vattr;
65struct xfs_iomap; 65struct xfs_iomap;
66struct attrlist_cursor_kern; 66struct attrlist_cursor_kern;
67 67
68/*
69 * Vnode types. VNON means no type.
70 */
71enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VFIFO, VBAD, VSOCK };
72 68
73typedef xfs_ino_t vnumber_t; 69typedef xfs_ino_t vnumber_t;
74typedef struct dentry vname_t; 70typedef struct dentry vname_t;
@@ -77,11 +73,9 @@ typedef bhv_head_t vn_bhv_head_t;
77/* 73/*
78 * MP locking protocols: 74 * MP locking protocols:
79 * v_flag, v_vfsp VN_LOCK/VN_UNLOCK 75 * v_flag, v_vfsp VN_LOCK/VN_UNLOCK
80 * v_type read-only or fs-dependent
81 */ 76 */
82typedef struct vnode { 77typedef struct vnode {
83 __u32 v_flag; /* vnode flags (see below) */ 78 __u32 v_flag; /* vnode flags (see below) */
84 enum vtype v_type; /* vnode type */
85 struct vfs *v_vfsp; /* ptr to containing VFS */ 79 struct vfs *v_vfsp; /* ptr to containing VFS */
86 vnumber_t v_number; /* in-core vnode number */ 80 vnumber_t v_number; /* in-core vnode number */
87 vn_bhv_head_t v_bh; /* behavior head */ 81 vn_bhv_head_t v_bh; /* behavior head */
@@ -93,6 +87,12 @@ typedef struct vnode {
93 /* inode MUST be last */ 87 /* inode MUST be last */
94} vnode_t; 88} vnode_t;
95 89
90#define VN_ISLNK(vp) S_ISLNK((vp)->v_inode.i_mode)
91#define VN_ISREG(vp) S_ISREG((vp)->v_inode.i_mode)
92#define VN_ISDIR(vp) S_ISDIR((vp)->v_inode.i_mode)
93#define VN_ISCHR(vp) S_ISCHR((vp)->v_inode.i_mode)
94#define VN_ISBLK(vp) S_ISBLK((vp)->v_inode.i_mode)
95
96#define v_fbhv v_bh.bh_first /* first behavior */ 96#define v_fbhv v_bh.bh_first /* first behavior */
97#define v_fops v_bh.bh_first->bd_ops /* first behavior ops */ 97#define v_fops v_bh.bh_first->bd_ops /* first behavior ops */
98 98
@@ -133,17 +133,6 @@ typedef enum {
133#define LINVFS_GET_IP(vp) (&(vp)->v_inode) 133#define LINVFS_GET_IP(vp) (&(vp)->v_inode)
134 134
135/* 135/*
136 * Convert between vnode types and inode formats (since POSIX.1
137 * defines mode word of stat structure in terms of inode formats).
138 */
139extern enum vtype iftovt_tab[];
140extern u_short vttoif_tab[];
141#define IFTOVT(mode) (iftovt_tab[((mode) & S_IFMT) >> 12])
142#define VTTOIF(indx) (vttoif_tab[(int)(indx)])
143#define MAKEIMODE(indx, mode) (int)(VTTOIF(indx) | (mode))
144
145
146/*
147 * Vnode flags. 136 * Vnode flags.
148 */ 137 */
149#define VINACT 0x1 /* vnode is being inactivated */ 138#define VINACT 0x1 /* vnode is being inactivated */
@@ -408,7 +397,6 @@ typedef struct vnodeops {
408 */ 397 */
409typedef struct vattr { 398typedef struct vattr {
410 int va_mask; /* bit-mask of attributes present */ 399 int va_mask; /* bit-mask of attributes present */
411 enum vtype va_type; /* vnode type (for create) */
412 mode_t va_mode; /* file access mode and type */ 400 mode_t va_mode; /* file access mode and type */
413 xfs_nlink_t va_nlink; /* number of references to file */ 401 xfs_nlink_t va_nlink; /* number of references to file */
414 uid_t va_uid; /* owner user id */ 402 uid_t va_uid; /* owner user id */
@@ -498,7 +486,7 @@ typedef struct vattr {
498 * Check whether mandatory file locking is enabled. 486 * Check whether mandatory file locking is enabled.
499 */ 487 */
500#define MANDLOCK(vp, mode) \ 488#define MANDLOCK(vp, mode) \
501 ((vp)->v_type == VREG && ((mode) & (VSGID|(VEXEC>>3))) == VSGID) 489 (VN_ISREG(vp) && ((mode) & (VSGID|(VEXEC>>3))) == VSGID)
502 490
503extern void vn_init(void); 491extern void vn_init(void);
504extern int vn_wait(struct vnode *); 492extern int vn_wait(struct vnode *);