xfs
[Top] [All Lists]

put_inode patch

To: linux-xfs@xxxxxxxxxxx
Subject: put_inode patch
From: William L Jones <jones@xxxxxxxxxxxxxxxxxx>
Date: Sun, 17 Sep 2000 19:03:52 -0500 (CDT)
Cc: jones@xxxxxxxxxxxxxxxxxxx
Sender: owner-linux-xfs@xxxxxxxxxxx
The following is a share file that contains patchs to  xfs_ioctl.c,
xfs_iops.c, xfs_super.c and xfs_vnode.c in fs/xfs/linux.

The patchs removes the use of the dentry_operations d_iput and replaces it
with the super_operations put_inode.

Bill Jones


-------------------------------------------------------------------------------------
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2000-09-17 18:51 CDT by <root@xfs>.
# Source directory was `/usr/src/xfs/xfs/linux/fs/xfs/linux'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#    278 -rw-r--r-- xfs_ioctl.c.patch
#   2190 -rw-r--r-- xfs_iops.c.patch
#    704 -rw-r--r-- xfs_super.c.patch
#   1701 -rw-r--r-- xfs_vnode.c.patch
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
if mkdir _sh00752; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= xfs_ioctl.c.patch ==============
if test -f 'xfs_ioctl.c.patch' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'xfs_ioctl.c.patch' '(file already exists)'
else
  $echo 'x -' extracting 'xfs_ioctl.c.patch' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'xfs_ioctl.c.patch' &&
*** xfs_ioctl.c.orig    Sun Sep 17 00:10:08 2000
--- xfs_ioctl.c Sun Sep 17 00:10:25 2000
***************
*** 448,454 ****
X               put_unused_fd(new_fd);
X               return -XFS_ERROR(ENOMEM);
X       }
-         linvfs_set_dentry_ops(dentry);
X  
X       /*
X        * Keep nfsd happy.
--- 448,453 ----
SHAR_EOF
  chmod 0644 'xfs_ioctl.c.patch' ||
  $echo 'restore of' 'xfs_ioctl.c.patch' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'xfs_ioctl.c.patch:' 'MD5 check failed'
b6d9297a64ffacd36070d809b8a7f548  xfs_ioctl.c.patch
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'xfs_ioctl.c.patch'`"
    test 278 -eq "$shar_count" ||
    $echo 'xfs_ioctl.c.patch:' 'original size' '278,' 'current size' 
"$shar_count!"
  fi
fi
# ============= xfs_iops.c.patch ==============
if test -f 'xfs_iops.c.patch' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'xfs_iops.c.patch' '(file already exists)'
else
  $echo 'x -' extracting 'xfs_iops.c.patch' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'xfs_iops.c.patch' &&
*** xfs_iops.c.orig     Sun Sep 17 00:17:28 2000
--- xfs_iops.c  Sun Sep 17 13:06:59 2000
***************
*** 87,104 ****
X  
X  #include <asm/uaccess.h> /* For copy_from_user */
X  
- static struct dentry_operations linvfs_dops;
- 
- /*
-  * assign dentry ops to a dentry to prevent reference leak on dput
-  */
- 
- void
- linvfs_set_dentry_ops(struct dentry *dentry)
- {
-     ASSERT(dentry);
-     dentry->d_op = &linvfs_dops;
- }
X  
X  /*
X   * Pull the link count and size up from the xfs inode to the linux inode
--- 87,92 ----
***************
*** 175,181 ****
X               linvfs_set_inode_ops(ip);
X               error = linvfs_revalidate_core(ip);
X               validate_fields(dir);
-                 linvfs_set_dentry_ops(dentry);
X               d_instantiate(dentry, ip);
X       }
X  
--- 163,168 ----
***************
*** 222,228 ****
X                       VN_RELE(cvp);
X                       return ERR_PTR(-EACCES);
X               }
-                 linvfs_set_dentry_ops(dentry);
X               linvfs_set_inode_ops(ip);
X               error = linvfs_revalidate_core(ip);
X       }
--- 209,214 ----
***************
*** 254,260 ****
X               ip->i_ctime = CURRENT_TIME;
X               VN_HOLD(vp);
X               validate_fields(ip);
-                 linvfs_set_dentry_ops(dentry);
X               d_instantiate(dentry, ip);
X       }
X       return -error;
--- 240,245 ----
***************
*** 325,331 ****
X               } else {
X                       linvfs_set_inode_ops(ip);
X                       error = linvfs_revalidate_core(ip);
-                         linvfs_set_dentry_ops(dentry);
X                       d_instantiate(dentry, ip);
X               }
X       }
--- 310,315 ----
***************
*** 918,939 ****
X       }
X  }
X  
- /* This is used to wrap iput calls from above the vfs layer, we can
-  * add our own locking to kill races between xfs_iget and iput.
-  */
- 
- STATIC
- void linvfs_d_iput(struct dentry *dentry, struct inode *inode)
- {
-       vnode_t         *vp = LINVFS_GET_VP(inode);
- 
-       if (vp) {
-               vn_rele(vp);
-       } else {
-               iput(inode);
-       }
- }
- 
X  
X  struct address_space_operations linvfs_aops = {
X    readpage:          linvfs_read_full_page,
--- 902,907 ----
***************
*** 990,999 ****
X    attr_set:          linvfs_attr_set,
X    attr_remove:               linvfs_attr_remove,
X    attr_list:         linvfs_attr_list,
- };
- 
- static struct dentry_operations linvfs_dops =
- {
-   d_iput:             linvfs_d_iput,
X  };
X  
--- 958,962 ----
SHAR_EOF
  chmod 0644 'xfs_iops.c.patch' ||
  $echo 'restore of' 'xfs_iops.c.patch' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'xfs_iops.c.patch:' 'MD5 check failed'
0d5e2b5e78d82eb60968e7d91022f28a  xfs_iops.c.patch
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'xfs_iops.c.patch'`"
    test 2190 -eq "$shar_count" ||
    $echo 'xfs_iops.c.patch:' 'original size' '2190,' 'current size' 
"$shar_count!"
  fi
fi
# ============= xfs_super.c.patch ==============
if test -f 'xfs_super.c.patch' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'xfs_super.c.patch' '(file already exists)'
else
  $echo 'x -' extracting 'xfs_super.c.patch' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'xfs_super.c.patch' &&
*** xfs_super.c.orig    Sun Sep 17 00:16:16 2000
--- xfs_super.c Sun Sep 17 15:38:41 2000
***************
*** 426,431 ****
--- 426,438 ----
X       }
X  }
X  
+ void 
+ linvfs_put_inode(struct inode *inode)
+ {
+       void vn_put_inode(struct inode *); /* fix me put me in a header */
+ 
+       vn_put_inode(inode);
+ }
X  
X  void
X  linvfs_put_super(
***************
*** 598,608 ****
--- 604,616 ----
X  
X  
X  
+ 
X  static struct super_operations linvfs_sops = {
X       read_inode:             linvfs_read_inode,
X  #ifdef       CONFIG_XFS_VNODE_TRACING
X       write_inode:            linvfs_write_inode,
X  #endif
+       put_inode:              linvfs_put_inode,
X       delete_inode:           linvfs_delete_inode,
X       clear_inode:            linvfs_clear_inode,
X       put_super:              linvfs_put_super,
SHAR_EOF
  chmod 0644 'xfs_super.c.patch' ||
  $echo 'restore of' 'xfs_super.c.patch' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'xfs_super.c.patch:' 'MD5 check failed'
2ab9e8ecc3e86494b6005875bf3acdf5  xfs_super.c.patch
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'xfs_super.c.patch'`"
    test 704 -eq "$shar_count" ||
    $echo 'xfs_super.c.patch:' 'original size' '704,' 'current size' 
"$shar_count!"
  fi
fi
# ============= xfs_vnode.c.patch ==============
if test -f 'xfs_vnode.c.patch' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'xfs_vnode.c.patch' '(file already exists)'
else
  $echo 'x -' extracting 'xfs_vnode.c.patch' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'xfs_vnode.c.patch' &&
*** xfs_vnode.c.orig    Sun Sep 17 00:15:31 2000
--- xfs_vnode.c Sun Sep 17 15:39:06 2000
***************
*** 583,600 ****
X       return vp;
X  }
X  
- 
X  /*
!  * Release a vnode.  Decrements reference count and calls
!  * VOP_INACTIVE on last reference.
X   */
X  void
X  vn_rele(struct vnode *vp)
X  {
X       int     s;
X       int     vcnt;
X       /* REFERENCED */
X       int cache;
X  
X       XFS_STATS_INC(vn_rele);
X  
--- 583,617 ----
X       return vp;
X  }
X  
X  /*
!  * Release a vnode. 
X   */
X  void
X  vn_rele(struct vnode *vp)
X  {
+       iput(LINVFS_GET_IP(vp));
+ 
+ }
+ 
+ /*
+  *  Call VOP_INACTIVE on last reference.
+  */
+ void
+ vn_put_inode(struct inode *inode)
+ {
X       int     s;
X       int     vcnt;
X       /* REFERENCED */
X       int cache;
+         struct vnode *vp;
+ 
+       vp =  vn_address(inode);
+ 
+       /*
+        * If we were given a bum vnode just return.
+        * (This will happen on an umount.)
+        */
+       if(vp == NULL) return;
X  
X       XFS_STATS_INC(vn_rele);
X  
***************
*** 607,615 ****
X       ASSERT(vcnt > 0);
X  
X       /*
!        * Note that we are allowing for the fact that the
!        * i_count won't be decremented until we do the
!        * 'iput' below.
X        */
X       if (vcnt == 1) {
X               /*
--- 624,632 ----
X       ASSERT(vcnt > 0);
X  
X       /*
!        * Since we always get called from put_inode we know 
!        * that i_count won't be decremented after we
!        * return. 
X        */
X       if (vcnt == 1) {
X               /*
***************
*** 638,655 ****
X  
X               vp->v_flag &= ~(VINACT|VWAIT|VRECLM|VGONE);
X  
-               vn_trace_exit(vp, "vn_rele", (inst_t *)__return_address);
- 
-               VN_UNLOCK(vp, s);
- 
-               iput(LINVFS_GET_IP(vp));
- 
-               return;
X       }
X  
X       VN_UNLOCK(vp, s);
- 
-       iput(LINVFS_GET_IP(vp));
X  
X       vn_trace_exit(vp, "vn_rele", (inst_t *)__return_address);
X  }
--- 655,663 ----
SHAR_EOF
  chmod 0644 'xfs_vnode.c.patch' ||
  $echo 'restore of' 'xfs_vnode.c.patch' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'xfs_vnode.c.patch:' 'MD5 check failed'
30a63d1de11fd54646f3c87c67ef695a  xfs_vnode.c.patch
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'xfs_vnode.c.patch'`"
    test 1701 -eq "$shar_count" ||
    $echo 'xfs_vnode.c.patch:' 'original size' '1701,' 'current size' 
"$shar_count!"
  fi
fi
rm -fr _sh00752
exit 0




<Prev in Thread] Current Thread [Next in Thread>
  • put_inode patch, William L Jones <=