mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 06:50:12 +00:00
INODE-rollback-dentry-open-20050718
and roll back the cache inode finding with dentry_open
This commit is contained in:
parent
4ea5ccbf18
commit
5ded32558d
@ -31,30 +31,13 @@ extern struct vfsmount *afs_cacheMnt;
|
||||
#endif
|
||||
extern struct super_block *afs_cacheSBp;
|
||||
|
||||
/*#if defined(AFS_LINUX26_ENV) && (defined(CONFIG_EXPORTFS) || defined(CONFIG_EXPORTFS_MODULE))
|
||||
#define HAS_UFSOPEN
|
||||
extern struct export_operations export_op_default;
|
||||
|
||||
#define CALL(ops,fun) ((ops->fun)?(ops->fun):export_op_default.fun)
|
||||
|
||||
XXX something based on encode_fh / find_exported_dentry
|
||||
This would require us to store an inode -> fh mapping (acquired by
|
||||
afs_InitCacheFile or lookupname), but probably solves the resiserfs issue.
|
||||
#elif... */
|
||||
|
||||
#if defined(AFS_LINUX24_ENV) && !defined(HAS_UFSOPEN)
|
||||
#define HAS_UFSOPEN
|
||||
#if defined(AFS_LINUX26_ENV)
|
||||
void *
|
||||
osi_UFSOpen(afs_int32 ainode)
|
||||
{
|
||||
register struct osi_file *afile = NULL;
|
||||
extern int cacheDiskType;
|
||||
struct inode *tip = NULL;
|
||||
#ifndef AFS_LINUX26_ENV
|
||||
afs_int32 code = 0;
|
||||
struct list_head *lp = NULL;
|
||||
struct dentry *tdp = NULL;
|
||||
#endif
|
||||
struct dentry *dp = NULL;
|
||||
struct file *filp = NULL;
|
||||
AFS_STATCNT(osi_UFSOpen);
|
||||
@ -79,33 +62,11 @@ osi_UFSOpen(afs_int32 ainode)
|
||||
osi_Panic("Can't get inode %d\n", ainode);
|
||||
tip->i_flags |= MS_NOATIME; /* Disable updating access times. */
|
||||
|
||||
#ifdef AFS_LINUX26_ENV
|
||||
dp = d_alloc_anon(tip);
|
||||
#else
|
||||
spin_lock(&dcache_lock);
|
||||
for (lp = tip->i_dentry.next; lp != &tip->i_dentry; lp = lp->next) {
|
||||
tdp = list_entry(lp, struct dentry, d_alias);
|
||||
if ( !(tdp->d_flags & DCACHE_NFSD_DISCONNECTED)) {
|
||||
dget_locked(tdp);
|
||||
dp=tdp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tdp && !dp) {
|
||||
dget_locked(tdp);
|
||||
dp=tdp;
|
||||
}
|
||||
tdp = NULL;
|
||||
spin_unlock(&dcache_lock);
|
||||
if (!dp)
|
||||
dp = d_alloc_root(tip);
|
||||
iput(tip);
|
||||
#endif
|
||||
if (!dp)
|
||||
osi_Panic("Can't get dentry for inode %d\n", ainode);
|
||||
|
||||
filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR);
|
||||
|
||||
if (IS_ERR(filp))
|
||||
osi_Panic("Can't open inode %d\n", ainode);
|
||||
afile->filp = filp;
|
||||
@ -116,9 +77,7 @@ osi_UFSOpen(afs_int32 ainode)
|
||||
afile->inum = ainode; /* for hint validity checking */
|
||||
return (void *)afile;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(HAS_UFSOPEN)
|
||||
#else
|
||||
void *
|
||||
osi_UFSOpen(afs_int32 ainode)
|
||||
{
|
||||
@ -194,14 +153,14 @@ afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
|
||||
return code;
|
||||
}
|
||||
|
||||
#ifdef AFS_LINUX24_ENV
|
||||
#ifdef AFS_LINUX26_ENV
|
||||
int
|
||||
osi_UFSClose(register struct osi_file *afile)
|
||||
{
|
||||
AFS_STATCNT(osi_Close);
|
||||
if (afile) {
|
||||
if (OSIFILE_INODE(afile)) {
|
||||
filp_close(afile->filp, NULL);
|
||||
filp_close(afile->filp, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ typedef struct uio {
|
||||
/* Get/set the inode in the osifile struct. */
|
||||
#define FILE_INODE(F) (F)->f_dentry->d_inode
|
||||
|
||||
#ifdef AFS_LINUX24_ENV
|
||||
#ifdef AFS_LINUX26_ENV
|
||||
#define OSIFILE_INODE(a) FILE_INODE((a)->filp)
|
||||
#else
|
||||
#define OSIFILE_INODE(a) FILE_INODE(&(a)->file)
|
||||
|
@ -141,7 +141,7 @@ osi_InitCacheInfo(char *aname)
|
||||
int
|
||||
osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw)
|
||||
{
|
||||
#ifdef AFS_LINUX24_ENV
|
||||
#ifdef AFS_LINUX26_ENV
|
||||
struct file *filp = osifile->filp;
|
||||
#else
|
||||
struct file *filp = &osifile->file;
|
||||
|
@ -48,7 +48,7 @@ struct osi_stat {
|
||||
|
||||
struct osi_file {
|
||||
afs_int32 size; /* file size in bytes XXX Must be first field XXX */
|
||||
#ifdef AFS_LINUX24_ENV
|
||||
#ifdef AFS_LINUX26_ENV
|
||||
struct file *filp; /* May need this if we really open the file. */
|
||||
#else
|
||||
#ifdef AFS_LINUX22_ENV
|
||||
|
Loading…
Reference in New Issue
Block a user