patch for 2.1.56 pre-1 fs/dcache.c

Bill Hawes (whawes@star.net)
Sun, 14 Sep 1997 10:32:59 -0400


This is a multi-part message in MIME format.
--------------E717216A46D046C5622213AD
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The attached patch adds a d_sb super block field. I'm using this in the
new smbfs to avoid walking the parent chain for every dentry.

This will also allow an efficient shrink_dcache_sb(sb) implementation,
which would be preferable to shrink_dcache() when unmounting or
invalidating inodes for a device.

I have smbfs mostly working under 2.1.56, but am still trying to track
down a bug. Hopefully I'll have it ready by this evening.

Regards,
Bill
--------------E717216A46D046C5622213AD
Content-Type: text/plain; charset=us-ascii; name="dcache_56-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="dcache_56-patch"

--- linux-2.1.56/fs/dcache.c.old Sat Sep 13 21:36:53 1997
+++ linux-2.1.56/fs/dcache.c Sun Sep 14 08:37:14 1997
@@ -179,7 +179,12 @@
dentry->d_count = 1;
dentry->d_flags = 0;
dentry->d_inode = NULL;
- dentry->d_parent = dget(parent);
+ dentry->d_parent = NULL;
+ dentry->d_sb = NULL;
+ if (parent) {
+ dentry->d_parent = dget(parent);
+ dentry->d_sb = parent->d_sb;
+ }
dentry->d_mounts = dentry;
dentry->d_covers = dentry;
INIT_LIST_HEAD(&dentry->d_hash);
@@ -214,6 +219,7 @@
if (root_inode) {
res = d_alloc(NULL, &(const struct qstr) { "/", 1, 0 });
if (res) {
+ res->d_sb = root_inode->i_sb;
res->d_parent = res;
d_instantiate(res, root_inode);
}
--- linux-2.1.56/include/linux/dcache.h.old Sat Sep 13 21:36:54 1997
+++ linux-2.1.56/include/linux/dcache.h Sun Sep 14 08:03:38 1997
@@ -50,6 +50,7 @@
struct qstr d_name;
unsigned long d_time; /* used by d_revalidate */
struct dentry_operations *d_op;
+ struct super_block * d_sb; /* The root of the dentry tree */
};

struct dentry_operations {

--------------E717216A46D046C5622213AD--