Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Feb 2018 19:56:19 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329746 - head/sys/ufs/ffs
Message-ID:  <201802211956.w1LJuJQ2067851@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mckusick
Date: Wed Feb 21 19:56:19 2018
New Revision: 329746
URL: https://svnweb.freebsd.org/changeset/base/329746

Log:
  Refactor fix in r329600 to do its check once in readsuper() rather
  than in the two places that call readsuper().
  
  No semantic change intended.
  
  Reviewed by: kib

Modified:
  head/sys/ufs/ffs/ffs_subr.c

Modified: head/sys/ufs/ffs/ffs_subr.c
==============================================================================
--- head/sys/ufs/ffs/ffs_subr.c	Wed Feb 21 19:42:54 2018	(r329745)
+++ head/sys/ufs/ffs/ffs_subr.c	Wed Feb 21 19:56:19 2018	(r329746)
@@ -174,17 +174,12 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsuper
 
 	*fsp = NULL;
 	if (altsuperblock != -1) {
-		ret = readsuper(devfd, fsp, altsuperblock, readfunc);
-		if (*fsp != NULL)
-			(*fsp)->fs_csp = NULL;
-		if (ret != 0)
+		if ((ret = readsuper(devfd, fsp, altsuperblock, readfunc)) != 0)
 			return (ret);
 	} else {
 		for (i = 0; sblock_try[i] != -1; i++) {
-			ret = readsuper(devfd, fsp, sblock_try[i], readfunc);
-			if (*fsp != NULL)
-				(*fsp)->fs_csp = NULL;
-			if (ret == 0)
+			if ((ret = readsuper(devfd, fsp, sblock_try[i],
+			     readfunc)) == 0)
 				break;
 			if (ret == ENOENT)
 				continue;
@@ -193,13 +188,11 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsuper
 		if (sblock_try[i] == -1)
 			return (ENOENT);
 	}
-
 	/*
-	 * Not filling in summary information, return.
+	 * If not filling in summary information, return.
 	 */
 	if (filltype == NULL)
 		return (0);
-
 	/*
 	 * Read in the superblock summary information.
 	 */
@@ -252,6 +245,8 @@ readsuper(void *devfd, struct fs **fsp, off_t sblocklo
 	int error;
 
 	error = (*readfunc)(devfd, sblockloc, (void **)fsp, SBLOCKSIZE);
+	if (*fsp != NULL)
+		(*fsp)->fs_csp = NULL;	/* Not yet any summary information */
 	if (error != 0)
 		return (error);
 	fs = *fsp;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802211956.w1LJuJQ2067851>