git: 25aac48d2ce3 - main - simplify journal_mount: move the out label after success block

Konstantin Belousov kib at FreeBSD.org
Fri Mar 12 11:32:15 UTC 2021


The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=25aac48d2ce322355e7890a1de0f045a15d1cc09

commit 25aac48d2ce322355e7890a1de0f045a15d1cc09
Author:     Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-03-04 18:55:33 +0000
Commit:     Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-03-12 11:30:37 +0000

    simplify journal_mount: move the out label after success block
    
    This removes the need to check for error == 0.
    
    Reviewed by:    mckusick
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    MFC after:      2 weeks
    Differential revision:  https://reviews.freebsd.org/D29178
---
 sys/ufs/ffs/ffs_softdep.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 786fb43c7d81..e60ac2f6868b 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -3016,26 +3016,26 @@ journal_mount(mp, fs, cred)
 	jblocks->jb_low = jblocks->jb_free / 3;	/* Reserve 33%. */
 	jblocks->jb_min = jblocks->jb_free / 10; /* Suspend at 10%. */
 	ump->softdep_jblocks = jblocks;
-out:
-	if (error == 0) {
-		MNT_ILOCK(mp);
-		mp->mnt_flag |= MNT_SUJ;
-		mp->mnt_flag &= ~MNT_SOFTDEP;
-		MNT_IUNLOCK(mp);
-		/*
-		 * Only validate the journal contents if the
-		 * filesystem is clean, otherwise we write the logs
-		 * but they'll never be used.  If the filesystem was
-		 * still dirty when we mounted it the journal is
-		 * invalid and a new journal can only be valid if it
-		 * starts from a clean mount.
-		 */
-		if (fs->fs_clean) {
-			DIP_SET(ip, i_modrev, fs->fs_mtime);
-			ip->i_flags |= IN_MODIFIED;
-			ffs_update(vp, 1);
-		}
+
+	MNT_ILOCK(mp);
+	mp->mnt_flag |= MNT_SUJ;
+	mp->mnt_flag &= ~MNT_SOFTDEP;
+	MNT_IUNLOCK(mp);
+
+	/*
+	 * Only validate the journal contents if the
+	 * filesystem is clean, otherwise we write the logs
+	 * but they'll never be used.  If the filesystem was
+	 * still dirty when we mounted it the journal is
+	 * invalid and a new journal can only be valid if it
+	 * starts from a clean mount.
+	 */
+	if (fs->fs_clean) {
+		DIP_SET(ip, i_modrev, fs->fs_mtime);
+		ip->i_flags |= IN_MODIFIED;
+		ffs_update(vp, 1);
 	}
+out:
 	vput(vp);
 	return (error);
 }


More information about the dev-commits-src-all mailing list