From: Marc Dionne Date: Tue, 25 Jan 2011 22:17:21 +0000 (-0500) Subject: linux: 2.6.38: New d_op handling X-Git-Tag: upstream/1.6.0.pre2^2~34 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=06b8a3d52b2d6a3c8c1512bb9a21689e0d1c8b34;p=packages%2Fo%2Fopenafs.git 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 Reviewed-by: Derrick Brashear (cherry picked from commit 08bb83d95027bb3ac68834d12b72bdc647fa24a9) Change-Id: Ia108e8c7c624521965bdbddd7a37ebf281eb7967 Reviewed-on: http://gerrit.openafs.org/3869 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/acinclude.m4 b/acinclude.m4 index b52627036..b51ba9ca9 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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], diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index 22146d750..921efac78 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -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; } diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index d4b8b8ff9..02aadd48f 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -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); }