Date: Thu, 18 Feb 2010 13:59:05 +0000 (GMT) From: Robert Watson <rwatson@FreeBSD.org> To: Jeff Roberson <jeff@FreeBSD.org> Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r203981 - projects/suj/head/sbin/tunefs Message-ID: <alpine.BSF.2.00.1002181358030.59664@fledge.watson.org> In-Reply-To: <201002170304.o1H34VWL014867@svn.freebsd.org> References: <201002170304.o1H34VWL014867@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 17 Feb 2010, Jeff Roberson wrote: > Author: jeff > Date: Wed Feb 17 03:04:31 2010 > New Revision: 203981 > URL: http://svn.freebsd.org/changeset/base/203981 > > Log: > - Fix clearing of the immutable journal flags so it may be more easily > removed by administrators. > - Set the NODUMP flag as suggested by rwatson. FYI, dump(8) will still back up files with NODUMP set by default when doing a level 0 dump, so it might also be desirable for dump to detect and ignore journal files while backing up. (Perhaps we already do this for snapshots...?) Robert N M Watson Computer Laboratory University of Cambridge > > Modified: > projects/suj/head/sbin/tunefs/tunefs.c > > Modified: projects/suj/head/sbin/tunefs/tunefs.c > ============================================================================== > --- projects/suj/head/sbin/tunefs/tunefs.c Wed Feb 17 01:14:28 2010 (r203980) > +++ projects/suj/head/sbin/tunefs/tunefs.c Wed Feb 17 03:04:31 2010 (r203981) > @@ -600,6 +600,7 @@ journal_findfile(void) > { > struct ufs1_dinode *dp1; > struct ufs2_dinode *dp2; > + ino_t ino; > int mode; > void *ip; > int i; > @@ -618,9 +619,9 @@ journal_findfile(void) > for (i = 0; i < NDADDR; i++) { > if (dp1->di_db[i] == 0) > break; > - if (dir_search(dp1->di_db[i], > - sblksize(&sblock, (off_t)dp1->di_size, i)) != 0) > - return (-1); > + if ((ino = dir_search(dp1->di_db[i], > + sblksize(&sblock, (off_t)dp1->di_size, i))) != 0) > + return (ino); > } > } else { > if ((off_t)dp1->di_size >= lblktosize(&sblock, NDADDR)) { > @@ -630,9 +631,9 @@ journal_findfile(void) > for (i = 0; i < NDADDR; i++) { > if (dp2->di_db[i] == 0) > break; > - if (dir_search(dp2->di_db[i], > - sblksize(&sblock, (off_t)dp2->di_size, i)) != 0) > - return (-1); > + if ((ino = dir_search(dp2->di_db[i], > + sblksize(&sblock, (off_t)dp2->di_size, i))) != 0) > + return (ino); > } > } > > @@ -831,10 +832,11 @@ journal_clear(void) > void *ip; > > ino = journal_findfile(); > - if (ino <= 0) { > + if (ino == (ino_t)-1 || ino == 0) { > warnx("Journal file does not exist"); > return; > } > + printf("Clearing journal flags from inode %d\n", ino); > if (getino(&disk, &ip, ino, &mode) != 0) { > warn("Failed to get journal inode"); > return; > @@ -872,11 +874,13 @@ journal_alloc(int64_t size) > * If the journal file exists we can't allocate it. > */ > ino = journal_findfile(); > - if (ino > 0) > + if (ino == (ino_t)-1) > + return (-1); > + if (ino > 0) { > warnx("Journal file %s already exists, please remove.", > SUJ_FILE); > - if (ino != 0) > return (-1); > + } > /* > * If the user didn't supply a size pick one based on the filesystem > * size constrained with hardcoded MIN and MAX values. We opt for > @@ -930,13 +934,13 @@ journal_alloc(int64_t size) > dp1->di_size = size; > dp1->di_mode = IFREG | IREAD; > dp1->di_nlink = 1; > - dp1->di_flags = SF_IMMUTABLE | SF_NOUNLINK; > + dp1->di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP; > } else { > bzero(dp2, sizeof(*dp2)); > dp2->di_size = size; > dp2->di_mode = IFREG | IREAD; > dp2->di_nlink = 1; > - dp2->di_flags = SF_IMMUTABLE | SF_NOUNLINK; > + dp2->di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP; > } > for (i = 0; i < NDADDR && resid; i++, resid--) { > blk = journal_balloc(); >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1002181358030.59664>