linux-2625-update-20080322
[openafs.git] / src / afs / LINUX / osi_file.c
index ecf1934..f1fd634 100644 (file)
@@ -23,7 +23,9 @@ RCSID
 #if defined(AFS_LINUX26_ENV)
 #include "h/namei.h"
 #endif
-
+#if !defined(HAVE_IGET)
+#include "h/exportfs.h"
+#endif
 
 afs_lock_t afs_xosi;           /* lock is for tvattr */
 extern struct osi_dev cacheDev;
@@ -41,6 +43,9 @@ osi_UFSOpen(afs_int32 ainode)
     struct inode *tip = NULL;
     struct dentry *dp = NULL;
     struct file *filp = NULL;
+#if !defined(HAVE_IGET)
+    struct fid fid;
+#endif
     AFS_STATCNT(osi_UFSOpen);
     if (cacheDiskType != AFS_FCACHE_TYPE_UFS) {
        osi_Panic("UFSOpen called for non-UFS cache\n");
@@ -58,14 +63,17 @@ osi_UFSOpen(afs_int32 ainode)
                  sizeof(struct osi_file));
     }
     memset(afile, 0, sizeof(struct osi_file));
+#if defined(HAVE_IGET)
     tip = iget(afs_cacheSBp, (u_long) ainode);
-    if (!tip)
-       osi_Panic("Can't get inode %d\n", ainode);
-    tip->i_flags |= MS_NOATIME;        /* Disable updating access times. */
-
-    dp = d_alloc_anon(tip);
+#else
+    fid.i32.ino = ainode;
+    fid.i32.gen = 0;
+    dp = afs_cacheSBp->s_export_op->fh_to_dentry(afs_cacheSBp, &fid, sizeof(fid), FILEID_INO32_GEN);
     if (!dp) 
            osi_Panic("Can't get dentry for inode %d\n", ainode);          
+    tip = dp->d_inode;
+#endif
+    tip->i_flags |= MS_NOATIME;        /* Disable updating access times. */
 
     filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR);
     if (IS_ERR(filp))
@@ -138,9 +146,6 @@ afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
     AFS_STATCNT(osi_Stat);
     MObtainWriteLock(&afs_xosi, 320);
     astat->size = OSIFILE_INODE(afile)->i_size;
-#ifdef STRUCT_INODE_HAS_I_BLKSIZE
-    astat->blksize = OSIFILE_INODE(afile)->i_blksize;
-#endif
 #if defined(AFS_LINUX26_ENV)
     astat->mtime = OSIFILE_INODE(afile)->i_mtime.tv_sec;
     astat->atime = OSIFILE_INODE(afile)->i_atime.tv_sec;
@@ -352,8 +357,6 @@ afs_osi_MapStrategy(int (*aproc) (struct buf * bp), register struct buf *bp)
 void
 shutdown_osifile(void)
 {
-    extern int afs_cold_shutdown;
-
     AFS_STATCNT(shutdown_osifile);
     if (afs_cold_shutdown) {
        afs_osicred_initialized = 0;