svn commit: r253324 - stable/9/sys/ufs/ffs
Kirk McKusick
mckusick at FreeBSD.org
Sat Jul 13 18:09:43 UTC 2013
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,
More information about the svn-src-stable-9
mailing list