From owner-svn-src-projects@FreeBSD.ORG Fri Apr 23 08:46:03 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57BF3106566C; Fri, 23 Apr 2010 08:46:03 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4708B8FC08; Fri, 23 Apr 2010 08:46:03 +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 o3N8k3KX047725; Fri, 23 Apr 2010 08:46:03 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N8k3K2047723; Fri, 23 Apr 2010 08:46:03 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201004230846.o3N8k3K2047723@svn.freebsd.org> From: Jeff Roberson Date: Fri, 23 Apr 2010 08:46:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207102 - projects/suj/head/sbin/tunefs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2010 08:46:03 -0000 Author: jeff Date: Fri Apr 23 08:46:03 2010 New Revision: 207102 URL: http://svn.freebsd.org/changeset/base/207102 Log: - Don't fail to create the journal if we can't find enough contig space. Instead, we make two passes, one looking for contig space, and another that takes what it can get while warning the user. Modified: projects/suj/head/sbin/tunefs/tunefs.c Modified: projects/suj/head/sbin/tunefs/tunefs.c ============================================================================== --- projects/suj/head/sbin/tunefs/tunefs.c Fri Apr 23 08:44:41 2010 (r207101) +++ projects/suj/head/sbin/tunefs/tunefs.c Fri Apr 23 08:46:03 2010 (r207102) @@ -526,6 +526,7 @@ journal_balloc(void) ufs2_daddr_t blk; struct cg *cgp; int valid; + static int contig = 1; cgp = &disk.d_cg; for (;;) { @@ -547,9 +548,21 @@ journal_balloc(void) */ if (cgp->cg_cs.cs_nbfree > blocks / 8) break; + if (contig == 0 && cgp->cg_cs.cs_nbfree) + break; } if (valid) continue; + /* + * Try once through looking only for large contiguous regions + * and again taking any space we can find. + */ + if (contig) { + contig = 0; + disk.d_ccg = 0; + warnx("Journal file fragmented."); + continue; + } warnx("Failed to find sufficient free blocks for the journal"); return -1; } @@ -906,12 +919,6 @@ journal_alloc(int64_t size) while (cgread(&disk) == 1) { if (cgp->cg_cs.cs_nifree == 0) continue; - /* - * Try to minimize fragmentation by requiring at least a - * 1/16th of the blocks be present in each cg we use. - */ - if (cgp->cg_cs.cs_nbfree < blocks / 16) - continue; ino = cgialloc(&disk); if (ino <= 0) break; @@ -992,7 +999,7 @@ journal_alloc(int64_t size) sblock.fs_sujfree = 0; return (0); } - warnx("Insufficient contiguous free space for the journal."); + warnx("Insufficient free space for the journal."); out: return (-1); }