[1835] | 1 | From a615bc198e3fd99378d248eeb5868c773b0a2ec5 Mon Sep 17 00:00:00 2001 |
---|
| 2 | From: Marc Dionne <marc.c.dionne@gmail.com> |
---|
| 3 | Date: Tue, 25 Jan 2011 17:17:21 -0500 |
---|
| 4 | Subject: [PATCH 5/8] linux: 2.6.38: New d_op handling |
---|
| 5 | |
---|
| 6 | In 2.6.38, the super block structure has a new field to hold the |
---|
| 7 | default dentry ops. The vfs will automatically set it for new |
---|
| 8 | dentries in most cases. |
---|
| 9 | |
---|
| 10 | Set s_d_op to our set of operations, and omit setting the dentry |
---|
| 11 | ops where the vfs will already do it (and where new locking rules |
---|
| 12 | prohibit it). |
---|
| 13 | |
---|
| 14 | Reviewed-on: http://gerrit.openafs.org/3758 |
---|
| 15 | Tested-by: BuildBot <buildbot@rampaginggeek.com> |
---|
| 16 | Reviewed-by: Derrick Brashear <shadow@dementia.org> |
---|
| 17 | (cherry picked from commit 08bb83d95027bb3ac68834d12b72bdc647fa24a9) |
---|
| 18 | |
---|
| 19 | Change-Id: Ia808d6bcd119f3999a1805b1d31678f5a3ba3d55 |
---|
| 20 | Signed-off-by: Anders Kaseorg <andersk@mit.edu> |
---|
| 21 | Reviewed-on: http://gerrit.openafs.org/3994 |
---|
| 22 | Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk> |
---|
| 23 | Tested-by: BuildBot <buildbot@rampaginggeek.com> |
---|
| 24 | Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com> |
---|
| 25 | Reviewed-by: Russ Allbery <rra@stanford.edu> |
---|
| 26 | Reviewed-on: http://gerrit.openafs.org/4041 |
---|
| 27 | Reviewed-by: Derrick Brashear <shadow@dementia.org> |
---|
| 28 | Tested-by: Derrick Brashear <shadow@dementia.org> |
---|
| 29 | --- |
---|
| 30 | acinclude.m4 | 1 + |
---|
| 31 | src/afs/LINUX/osi_vfsops.c | 8 ++++++++ |
---|
| 32 | src/afs/LINUX/osi_vnodeops.c | 6 ++++++ |
---|
| 33 | 3 files changed, 15 insertions(+), 0 deletions(-) |
---|
| 34 | |
---|
| 35 | diff --git a/acinclude.m4 b/acinclude.m4 |
---|
| 36 | index de82283..7904e20 100644 |
---|
| 37 | --- a/acinclude.m4 |
---|
| 38 | +++ b/acinclude.m4 |
---|
| 39 | @@ -749,6 +749,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) |
---|
| 40 | LINUX_FS_STRUCT_SUPER_HAS_ALLOC_INODE |
---|
| 41 | LINUX_FS_STRUCT_SUPER_HAS_EVICT_INODE |
---|
| 42 | LINUX_FS_STRUCT_SUPER_BLOCK_HAS_S_BDI |
---|
| 43 | + AC_CHECK_LINUX_STRUCT([super_block], [s_d_op], [fs.h]) |
---|
| 44 | LINUX_STRUCT_BDI_HAS_NAME |
---|
| 45 | LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK |
---|
| 46 | LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_GFP_MASK |
---|
| 47 | diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c |
---|
| 48 | index fb69d39..2a937e4 100644 |
---|
| 49 | --- a/src/afs/LINUX/osi_vfsops.c |
---|
| 50 | +++ b/src/afs/LINUX/osi_vfsops.c |
---|
| 51 | @@ -140,6 +140,12 @@ afs_read_super(struct super_block *sb, void *data, int silent) |
---|
| 52 | sb->s_blocksize_bits = 10; |
---|
| 53 | sb->s_magic = AFS_VFSMAGIC; |
---|
| 54 | sb->s_op = &afs_sops; /* Super block (vfs) ops */ |
---|
| 55 | + |
---|
| 56 | +#if defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP) |
---|
| 57 | + sb->s_d_op = &afs_dentry_operations; |
---|
| 58 | +#endif |
---|
| 59 | + |
---|
| 60 | +#if defined(AFS_LINUX26_ENV) |
---|
| 61 | /* used for inodes backing_dev_info field, also */ |
---|
| 62 | afs_backing_dev_info = osi_Alloc(sizeof(struct backing_dev_info)); |
---|
| 63 | #if defined(HAVE_BDI_INIT) |
---|
| 64 | @@ -227,7 +233,9 @@ afs_root(struct super_block *afsp) |
---|
| 65 | #else |
---|
| 66 | afsp->s_root = d_alloc_root(ip, NULL); |
---|
| 67 | #endif |
---|
| 68 | +#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP) |
---|
| 69 | afsp->s_root->d_op = &afs_dentry_operations; |
---|
| 70 | +#endif |
---|
| 71 | } else |
---|
| 72 | code = ENOENT; |
---|
| 73 | } |
---|
| 74 | diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c |
---|
| 75 | index 8352769..03294b2 100644 |
---|
| 76 | --- a/src/afs/LINUX/osi_vnodeops.c |
---|
| 77 | +++ b/src/afs/LINUX/osi_vnodeops.c |
---|
| 78 | @@ -1067,7 +1067,9 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode) |
---|
| 79 | afs_getattr(vcp, &vattr, credp); |
---|
| 80 | afs_fill_inode(ip, &vattr); |
---|
| 81 | insert_inode_hash(ip); |
---|
| 82 | +#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP) |
---|
| 83 | dp->d_op = &afs_dentry_operations; |
---|
| 84 | +#endif |
---|
| 85 | dp->d_time = hgetlo(VTOAFS(dip)->m.DataVersion); |
---|
| 86 | d_instantiate(dp, ip); |
---|
| 87 | } |
---|
| 88 | @@ -1123,7 +1125,9 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp) |
---|
| 89 | ) |
---|
| 90 | insert_inode_hash(ip); |
---|
| 91 | } |
---|
| 92 | +#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP) |
---|
| 93 | dp->d_op = &afs_dentry_operations; |
---|
| 94 | +#endif |
---|
| 95 | dp->d_time = hgetlo(VTOAFS(dip)->m.DataVersion); |
---|
| 96 | AFS_GUNLOCK(); |
---|
| 97 | |
---|
| 98 | @@ -1315,7 +1319,9 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode) |
---|
| 99 | afs_getattr(tvcp, &vattr, credp); |
---|
| 100 | afs_fill_inode(ip, &vattr); |
---|
| 101 | |
---|
| 102 | +#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP) |
---|
| 103 | dp->d_op = &afs_dentry_operations; |
---|
| 104 | +#endif |
---|
| 105 | dp->d_time = hgetlo(VTOAFS(dip)->m.DataVersion); |
---|
| 106 | d_instantiate(dp, ip); |
---|
| 107 | } |
---|
| 108 | -- |
---|
| 109 | 1.7.3.4 |
---|
| 110 | |
---|