From owner-svn-src-all@FreeBSD.ORG Tue Jan 4 10:25:55 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90BF4106566B; Tue, 4 Jan 2011 10:25:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FE708FC1C; Tue, 4 Jan 2011 10:25:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p04APtrj033074; Tue, 4 Jan 2011 10:25:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p04APtbu033072; Tue, 4 Jan 2011 10:25:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201101041025.p04APtbu033072@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 Jan 2011 10:25:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216951 - head/sys/ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jan 2011 10:25:55 -0000 Author: kib Date: Tue Jan 4 10:25:55 2011 New Revision: 216951 URL: http://svn.freebsd.org/changeset/base/216951 Log: Instead of incrementing freework reference counter in indir_trunc(), do it at the allocation time for journaled fs and indirect blocks, when the allocated object is not accessible outside. Requested and reviewed by: jeff Tested by: pho Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Tue Jan 4 05:35:44 2011 (r216950) +++ head/sys/ufs/ffs/ffs_softdep.c Tue Jan 4 10:25:55 2011 (r216951) @@ -876,8 +876,8 @@ static struct jfreeblk *newjfreeblk(stru ufs2_daddr_t, int); static struct jfreefrag *newjfreefrag(struct freefrag *, struct inode *, ufs2_daddr_t, long, ufs_lbn_t); -static struct freework *newfreework(struct freeblks *, struct freework *, - ufs_lbn_t, ufs2_daddr_t, int, int); +static struct freework *newfreework(struct ufsmount *, struct freeblks *, + struct freework *, ufs_lbn_t, ufs2_daddr_t, int, int); static void jwait(struct worklist *wk); static struct inodedep *inodedep_lookup_ip(struct inode *); static int bmsafemap_rollbacks(struct bmsafemap *); @@ -3367,7 +3367,8 @@ free_freedep(freedep) * is visible outside of softdep_setup_freeblocks(). */ static struct freework * -newfreework(freeblks, parent, lbn, nb, frags, journal) +newfreework(ump, freeblks, parent, lbn, nb, frags, journal) + struct ufsmount *ump; struct freeblks *freeblks; struct freework *parent; ufs_lbn_t lbn; @@ -3384,7 +3385,8 @@ newfreework(freeblks, parent, lbn, nb, f freework->fw_lbn = lbn; freework->fw_blkno = nb; freework->fw_frags = frags; - freework->fw_ref = 0; + freework->fw_ref = ((UFSTOVFS(ump)->mnt_kern_flag & MNTK_SUJ) == 0 || + lbn >= -NXADDR) ? 0 : NINDIR(ump->um_fs) + 1; freework->fw_off = 0; LIST_INIT(&freework->fw_jwork); @@ -5199,15 +5201,16 @@ softdep_setup_freeblocks(ip, length, fla continue; frags = sblksize(fs, oldsize, i); frags = numfrags(fs, frags); - newfreework(freeblks, NULL, i, blkno, frags, needj); + newfreework(ip->i_ump, freeblks, NULL, i, blkno, frags, + needj); } for (i = 0, tmpval = NINDIR(fs), lbn = NDADDR; i < NIADDR; i++, tmpval *= NINDIR(fs)) { blkno = DIP(ip, i_ib[i]); DIP_SET(ip, i_ib[i], 0); - if (blkno) - newfreework(freeblks, NULL, -lbn - i, blkno, - fs->fs_frag, needj); + if (blkno) + newfreework(ip->i_ump, freeblks, NULL, -lbn - i, + blkno, fs->fs_frag, needj); lbn += tmpval; } UFS_LOCK(ip->i_ump); @@ -5225,8 +5228,8 @@ softdep_setup_freeblocks(ip, length, fla continue; frags = sblksize(fs, oldextsize, i); frags = numfrags(fs, frags); - newfreework(freeblks, NULL, -1 - i, blkno, frags, - needj); + newfreework(ip->i_ump, freeblks, NULL, -1 - i, blkno, + frags, needj); } } if (LIST_EMPTY(&freeblks->fb_jfreeblkhd)) @@ -6141,9 +6144,6 @@ indir_trunc(freework, dbn, lbn) bap2 = (ufs2_daddr_t *)bp->b_data; } - if (needj) - freework->fw_ref += NINDIR(fs) + 1; - /* * Reclaim indirect blocks which never made it to disk. */ @@ -6178,7 +6178,7 @@ indir_trunc(freework, dbn, lbn) ufs_lbn_t nlbn; nlbn = (lbn + 1) - (i * lbnadd); - nfreework = newfreework(freeblks, freework, + nfreework = newfreework(ump, freeblks, freework, nlbn, nb, fs->fs_frag, 0); WORKLIST_INSERT_UNLOCKED(&nfreework->fw_jwork, wk); freedeps++; @@ -6225,7 +6225,7 @@ indir_trunc(freework, dbn, lbn) nlbn = (lbn + 1) - (i * lbnadd); if (needj != 0) { - nfreework = newfreework(freeblks, freework, + nfreework = newfreework(ump, freeblks, freework, nlbn, nb, fs->fs_frag, 0); freedeps++; }