aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c35
1 files changed, 21 insertions, 14 deletions
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