From owner-svn-src-stable@FreeBSD.ORG Sat Jul 13 18:09:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B21985F9; Sat, 13 Jul 2013 18:09:43 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 944781B67; Sat, 13 Jul 2013 18:09:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6DI9h92099887; Sat, 13 Jul 2013 18:09:43 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6DI9hsk099878; Sat, 13 Jul 2013 18:09:43 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201307131809.r6DI9hsk099878@svn.freebsd.org> From: Kirk McKusick Date: Sat, 13 Jul 2013 18:09:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r253324 - stable/9/sys/ufs/ffs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2013 18:09:43 -0000 Author: mckusick Date: Sat Jul 13 18:09:42 2013 New Revision: 253324 URL: http://svnweb.freebsd.org/changeset/base/253324 Log: MFC of 252527: Make better use of metadata area by avoiding using it for data blocks that no should no longer immediately follow their indirect blocks. Reviewed by: Bruce Evans Approved by: re (marius@) Modified: stable/9/sys/ufs/ffs/ffs_alloc.c stable/9/sys/ufs/ffs/ffs_balloc.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_alloc.c Sat Jul 13 15:34:37 2013 (r253323) +++ stable/9/sys/ufs/ffs/ffs_alloc.c Sat Jul 13 18:09:42 2013 (r253324) @@ -1709,7 +1709,7 @@ ffs_alloccgblk(ip, bp, bpref, size) cgp = (struct cg *)bp->b_data; blksfree = cg_blksfree(cgp); if (bpref == 0) { - bpref = cgp->cg_rotor; + bpref = cgbase(fs, cgp->cg_cgx) + cgp->cg_rotor + fs->fs_frag; } else if ((cgbpref = dtog(fs, bpref)) != cgp->cg_cgx) { /* map bpref to correct zone in this cg */ if (bpref < cgdata(fs, cgbpref)) Modified: stable/9/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_balloc.c Sat Jul 13 15:34:37 2013 (r253323) +++ stable/9/sys/ufs/ffs/ffs_balloc.c Sat Jul 13 18:09:42 2013 (r253324) @@ -299,6 +299,10 @@ retry: continue; } UFS_LOCK(ump); + /* + * If parent indirect has just been allocated, try to cluster + * immediately following it. + */ if (pref == 0) pref = ffs_blkpref_ufs1(ip, lbn, i - num - 1, (ufs1_daddr_t *)0); @@ -368,7 +372,14 @@ retry: */ if (nb == 0) { UFS_LOCK(ump); - if (pref == 0) + /* + * If allocating metadata at the front of the cylinder + * group and parent indirect block has just been allocated, + * then cluster next to it if it is the first indirect in + * the file. Otherwise it has been allocated in the metadata + * area, so we want to find our own place out in the data area. + */ + if (pref == 0 || (lbn > NDADDR && fs->fs_metaspace != 0)) pref = ffs_blkpref_ufs1(ip, lbn, indirs[i].in_off, &bap[0]); error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, @@ -850,6 +861,10 @@ retry: continue; } UFS_LOCK(ump); + /* + * If parent indirect has just been allocated, try to cluster + * immediately following it. + */ if (pref == 0) pref = ffs_blkpref_ufs2(ip, lbn, i - num - 1, (ufs2_daddr_t *)0); @@ -920,7 +935,14 @@ retry: */ if (nb == 0) { UFS_LOCK(ump); - if (pref == 0) + /* + * If allocating metadata at the front of the cylinder + * group and parent indirect block has just been allocated, + * then cluster next to it if it is the first indirect in + * the file. Otherwise it has been allocated in the metadata + * area, so we want to find our own place out in the data area. + */ + if (pref == 0 || (lbn > NDADDR && fs->fs_metaspace != 0)) pref = ffs_blkpref_ufs2(ip, lbn, indirs[i].in_off, &bap[0]); error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,