linux: 2.6.38: New d_op handling

In 2.6.38, the super block structure has a new field to hold the
default dentry ops.  The vfs will automatically set it for new
dentries in most cases.

Set s_d_op to our set of operations, and omit setting the dentry
ops where the vfs will already do it (and where new locking rules
prohibit it).

Reviewed-on: http://gerrit.openafs.org/3758
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 08bb83d95027bb3ac68834d12b72bdc647fa24a9)

Change-Id: Ia108e8c7c624521965bdbddd7a37ebf281eb7967
Reviewed-on: http://gerrit.openafs.org/3869
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Marc Dionne 2011-01-25 17:17:21 -05:00 committed by Derrick Brashear
parent 23d6287f7f
commit 06b8a3d52b
3 changed files with 14 additions and 0 deletions

View File

@ -774,6 +774,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h])
AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h])
AC_CHECK_LINUX_STRUCT([super_block], [s_bdi], [fs.h])
AC_CHECK_LINUX_STRUCT([super_block], [s_d_op], [fs.h])
AC_CHECK_LINUX_STRUCT([super_operations], [alloc_inode],
[fs.h])
AC_CHECK_LINUX_STRUCT([super_operations], [evict_inode],

View File

@ -108,6 +108,11 @@ afs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_blocksize_bits = 10;
sb->s_magic = AFS_VFSMAGIC;
sb->s_op = &afs_sops; /* Super block (vfs) ops */
#if defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP)
sb->s_d_op = &afs_dentry_operations;
#endif
/* used for inodes backing_dev_info field, also */
afs_backing_dev_info = osi_Alloc(sizeof(struct backing_dev_info));
#if defined(HAVE_LINUX_BDI_INIT)
@ -182,7 +187,9 @@ afs_root(struct super_block *afsp)
/* setup super_block and mount point inode. */
afs_globalVp = tvp;
afsp->s_root = d_alloc_root(ip);
#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP)
afsp->s_root->d_op = &afs_dentry_operations;
#endif
} else
code = ENOENT;
}

View File

@ -1015,7 +1015,9 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode)
afs_getattr(vcp, &vattr, credp);
afs_fill_inode(ip, &vattr);
insert_inode_hash(ip);
#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP)
dp->d_op = &afs_dentry_operations;
#endif
dp->d_time = hgetlo(VTOAFS(dip)->f.m.DataVersion);
d_instantiate(dp, ip);
}
@ -1053,7 +1055,9 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp)
if (hlist_unhashed(&ip->i_hash))
insert_inode_hash(ip);
}
#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP)
dp->d_op = &afs_dentry_operations;
#endif
dp->d_time = hgetlo(VTOAFS(dip)->f.m.DataVersion);
AFS_GUNLOCK();
@ -1237,7 +1241,9 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode)
afs_getattr(tvcp, &vattr, credp);
afs_fill_inode(ip, &vattr);
#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP)
dp->d_op = &afs_dentry_operations;
#endif
dp->d_time = hgetlo(VTOAFS(dip)->f.m.DataVersion);
d_instantiate(dp, ip);
}