linux: 2.6.38: New d_op handling
authorMarc Dionne <marc.c.dionne@gmail.com>
Tue, 25 Jan 2011 22:17:21 +0000 (17:17 -0500)
committerDerrick Brashear <shadow@dementia.org>
Thu, 27 Jan 2011 16:01:01 +0000 (08:01 -0800)
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).

Change-Id: I9d738bdd528577d0a7ccd307246b5e935379c84d
Reviewed-on: http://gerrit.openafs.org/3758
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

acinclude.m4
src/afs/LINUX/osi_vfsops.c
src/afs/LINUX/osi_vnodeops.c

index 94376aa..6ae09af 100644 (file)
@@ -776,6 +776,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],
index 22146d7..921efac 100644 (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;
        }
index dd330e2..40a06a2 100644 (file)
@@ -1029,7 +1029,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);
     }
@@ -1067,7 +1069,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();
 
@@ -1251,7 +1255,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);
     }