svn commit: r329746 - head/sys/ufs/ffs

Kirk McKusick mckusick at FreeBSD.org
Wed Feb 21 19:56:20 UTC 2018


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;


More information about the svn-src-head mailing list