xfs
[Top] [All Lists]

Small patch to open_by_handle function in fs/xfs/linux/xfs_ioctl.c

To: linux-xfs@xxxxxxxxxxx
Subject: Small patch to open_by_handle function in fs/xfs/linux/xfs_ioctl.c
From: William L Jones <jones@xxxxxxxxxxxxxxxxxx>
Date: Fri, 8 Sep 2000 10:51:47 -0500 (CDT)
Sender: owner-linux-xfs@xxxxxxxxxxx
By default linux does not free dcache entries.  They may be needed later.  It 
stick them 
on an unused queue list and will delete them if memory is  needed or reuse them.
The dentry craeted in open_by_handle  is a discounted, anonymous, dcache enties 
and will 
not be reused.  They will hang around until the memory is needed or an umount 
is is done 
casuing an unnecessary waist of memory.

The following patch forces dentry created by open_by_handle to be deleted when 
they are 
no longer neeed instead of being put on the unsed list.  This does not fix a 
bug but it 
does keep things nice and tidy.

Bill Jones

-------------------------------- xfs_ioctl.c.patch
*** xfs_ioctl.c.orig    Fri Sep  8 10:29:47 2000
--- xfs_ioctl.c Fri Sep  8 10:30:32 2000
***************
*** 286,291 ****
--- 286,303 ----
  }
  
  
+ /*
+  * We don't want to cluter up the dcache with non namei dentries.
+  */
+ static int open_by_inode_delete_dentry(struct dentry *dentry)
+ {
+         return 1;
+ }
+ 
+ static struct dentry_operations open_by_inode_dentry_operations = {
+         d_delete:       open_by_inode_delete_dentry,
+ };
+ 
  int
  xfs_open_by_handle(
        unsigned int    cmd,
***************
*** 453,458 ****
--- 465,475 ----
         * Keep nfsd happy.
         */
        dentry->d_flags |= DCACHE_NFSD_DISCONNECTED;
+ 
+       /*
+          * Don't fill dcache with useless entries.
+          */
+       dentry->d_op = &open_by_inode_dentry_operations;
  
        /*
         * Make sure dput can find this dcache entry.








<Prev in Thread] Current Thread [Next in Thread>
  • Small patch to open_by_handle function in fs/xfs/linux/xfs_ioctl.c, William L Jones <=