Author: kib
Date: Sun May 15 06:42:32 2011
New Revision: 221943
URL: http://svn.freebsd.org/changeset/base/221943

Log:
  MFC r220985:
  Move some parts of ufs_reclaim() into helper function ufs_prepare_reclaim(),
  and call the helper from VOP_RECLAIM and ffs_valloc() to properly prepare
  the ufs vnode for reuse.

Modified:
  stable/8/sys/ufs/ffs/ffs_alloc.c
  stable/8/sys/ufs/ufs/ufs_extern.h
  stable/8/sys/ufs/ufs/ufs_inode.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- stable/8/sys/ufs/ffs/ffs_alloc.c    Sun May 15 04:03:11 2011        
(r221942)
+++ stable/8/sys/ufs/ffs/ffs_alloc.c    Sun May 15 06:42:32 2011        
(r221943)
@@ -1014,8 +1014,9 @@ dup_alloc:
                ip->i_din2->di_birthtime = ts.tv_sec;
                ip->i_din2->di_birthnsec = ts.tv_nsec;
        }
+       ufs_prepare_reclaim(*vpp);
        ip->i_flag = 0;
-       vnode_destroy_vobject(*vpp);
+       (*vpp)->v_vflag = 0;
        (*vpp)->v_type = VNON;
        if (fs->fs_magic == FS_UFS2_MAGIC)
                (*vpp)->v_op = &ffs_vnodeops2;

Modified: stable/8/sys/ufs/ufs/ufs_extern.h
==============================================================================
--- stable/8/sys/ufs/ufs/ufs_extern.h   Sun May 15 04:03:11 2011        
(r221942)
+++ stable/8/sys/ufs/ufs/ufs_extern.h   Sun May 15 06:42:32 2011        
(r221943)
@@ -76,6 +76,7 @@ int    ufs_inactive(struct vop_inactive_ar
 int     ufs_init(struct vfsconf *);
 void    ufs_itimes(struct vnode *vp);
 int     ufs_lookup(struct vop_cachedlookup_args *);
+void    ufs_prepare_reclaim(struct vnode *vp);
 int     ufs_readdir(struct vop_readdir_args *);
 int     ufs_reclaim(struct vop_reclaim_args *);
 void    ffs_snapgone(struct inode *);

Modified: stable/8/sys/ufs/ufs/ufs_inode.c
==============================================================================
--- stable/8/sys/ufs/ufs/ufs_inode.c    Sun May 15 04:03:11 2011        
(r221942)
+++ stable/8/sys/ufs/ufs/ufs_inode.c    Sun May 15 06:42:32 2011        
(r221943)
@@ -168,6 +168,31 @@ out:
        return (error);
 }
 
+void
+ufs_prepare_reclaim(struct vnode *vp)
+{
+       struct inode *ip;
+#ifdef QUOTA
+       int i;
+#endif
+
+       ip = VTOI(vp);
+
+       vnode_destroy_vobject(vp);
+#ifdef QUOTA
+       for (i = 0; i < MAXQUOTAS; i++) {
+               if (ip->i_dquot[i] != NODQUOT) {
+                       dqrele(vp, ip->i_dquot[i]);
+                       ip->i_dquot[i] = NODQUOT;
+               }
+       }
+#endif
+#ifdef UFS_DIRHASH
+       if (ip->i_dirhash != NULL)
+               ufsdirhash_free(ip);
+#endif
+}
+
 /*
  * Reclaim an inode so that it can be used for other purposes.
  */
@@ -181,14 +206,9 @@ ufs_reclaim(ap)
        struct vnode *vp = ap->a_vp;
        struct inode *ip = VTOI(vp);
        struct ufsmount *ump = ip->i_ump;
-#ifdef QUOTA
-       int i;
-#endif
 
-       /*
-        * Destroy the vm object and flush associated pages.
-        */
-       vnode_destroy_vobject(vp);
+       ufs_prepare_reclaim(vp);
+
        if (ip->i_flag & IN_LAZYMOD)
                ip->i_flag |= IN_MODIFIED;
        UFS_UPDATE(vp, 0);
@@ -196,21 +216,7 @@ ufs_reclaim(ap)
         * Remove the inode from its hash chain.
         */
        vfs_hash_remove(vp);
-       /*
-        * Purge old data structures associated with the inode.
-        */
-#ifdef QUOTA
-       for (i = 0; i < MAXQUOTAS; i++) {
-               if (ip->i_dquot[i] != NODQUOT) {
-                       dqrele(vp, ip->i_dquot[i]);
-                       ip->i_dquot[i] = NODQUOT;
-               }
-       }
-#endif
-#ifdef UFS_DIRHASH
-       if (ip->i_dirhash != NULL)
-               ufsdirhash_free(ip);
-#endif
+
        /*
         * Lock the clearing of v_data so ffs_lock() can inspect it
         * prior to obtaining the lock.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to