Author: mckusick
Date: Thu Apr  5 00:32:01 2018
New Revision: 332055
URL: https://svnweb.freebsd.org/changeset/base/332055

Log:
  Renumber soft-update types starting at 1 instead of 0 to avoid confusion
  of zero'ed memory appearing to have a valid soft-update type.
  
  Also correct some comments.
  
  Reviewed by: kib

Modified:
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ffs/softdep.h

Modified: head/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- head/sys/ufs/ffs/ffs_softdep.c      Thu Apr  5 00:03:38 2018        
(r332054)
+++ head/sys/ufs/ffs/ffs_softdep.c      Thu Apr  5 00:32:01 2018        
(r332055)
@@ -688,6 +688,7 @@ static MALLOC_DEFINE(M_MOUNTDATA, "softdep", "Softdep 
  * MUST match the defines above, such that memtype[D_XXX] == M_XXX
  */
 static struct malloc_type *memtype[] = {
+       NULL,
        M_PAGEDEP,
        M_INODEDEP,
        M_BMSAFEMAP,
@@ -724,7 +725,8 @@ static struct malloc_type *memtype[] = {
  * Names of malloc types.
  */
 #define TYPENAME(type)  \
-       ((unsigned)(type) <= D_LAST ? memtype[type]->ks_shortdesc : "???")
+       ((unsigned)(type) <= D_LAST && (unsigned)(type) >= D_FIRST ? \
+       memtype[type]->ks_shortdesc : "???")
 /*
  * End system adaptation definitions.
  */
@@ -12960,7 +12962,7 @@ flush_newblk_dep(vp, mp, lbn)
                        break;
                }
                if (newblk->nb_list.wk_type != D_ALLOCDIRECT)
-                       panic("flush_newblk_deps: Bad newblk %p", newblk);
+                       panic("flush_newblk_dep: Bad newblk %p", newblk);
                /*
                 * Flush the journal.
                 */

Modified: head/sys/ufs/ffs/softdep.h
==============================================================================
--- head/sys/ufs/ffs/softdep.h  Thu Apr  5 00:03:38 2018        (r332054)
+++ head/sys/ufs/ffs/softdep.h  Thu Apr  5 00:32:01 2018        (r332055)
@@ -146,37 +146,45 @@
 
 #define        ALLCOMPLETE     (ATTACHED | COMPLETE | DEPCOMPLETE)
 
+#define PRINT_SOFTDEP_FLAGS "\20\27writesucceeded\26unlinkonlist" \
+       "\25unlinkprev\24unlinknext\23unlinked\22ondeplist\21iowaiting" \
+       "\20onworklist\17extdata\16ufs1fmt\15inprogress\14newblock" \
+       "\13delayedfree\12iostarted\11goingaway\10dirchg\7rmdir\6mkdir_body" \
+       "\5mkdir_parent\4depcomplete\3complete\2undone\1attached"
+
 /*
  * Values for each of the soft dependency types.
  */
-#define        D_PAGEDEP       0
-#define        D_INODEDEP      1
-#define        D_BMSAFEMAP     2
-#define        D_NEWBLK        3
-#define        D_ALLOCDIRECT   4
-#define        D_INDIRDEP      5
-#define        D_ALLOCINDIR    6
-#define        D_FREEFRAG      7
-#define        D_FREEBLKS      8
-#define        D_FREEFILE      9
-#define        D_DIRADD        10
-#define        D_MKDIR         11
-#define        D_DIRREM        12
-#define        D_NEWDIRBLK     13
-#define        D_FREEWORK      14
-#define        D_FREEDEP       15
-#define        D_JADDREF       16
-#define        D_JREMREF       17
-#define        D_JMVREF        18
-#define        D_JNEWBLK       19
-#define        D_JFREEBLK      20
-#define        D_JFREEFRAG     21
-#define        D_JSEG          22
-#define        D_JSEGDEP       23
-#define        D_SBDEP         24
-#define        D_JTRUNC        25
-#define        D_JFSYNC        26
-#define        D_SENTINEL      27
+#define        D_UNUSED        0
+#define        D_FIRST         D_PAGEDEP
+#define        D_PAGEDEP       1
+#define        D_INODEDEP      2
+#define        D_BMSAFEMAP     3
+#define        D_NEWBLK        4
+#define        D_ALLOCDIRECT   5
+#define        D_INDIRDEP      6
+#define        D_ALLOCINDIR    7
+#define        D_FREEFRAG      8
+#define        D_FREEBLKS      9
+#define        D_FREEFILE      10
+#define        D_DIRADD        11
+#define        D_MKDIR         12
+#define        D_DIRREM        13
+#define        D_NEWDIRBLK     14
+#define        D_FREEWORK      15
+#define        D_FREEDEP       16
+#define        D_JADDREF       17
+#define        D_JREMREF       18
+#define        D_JMVREF        19
+#define        D_JNEWBLK       20
+#define        D_JFREEBLK      21
+#define        D_JFREEFRAG     22
+#define        D_JSEG          23
+#define        D_JSEGDEP       24
+#define        D_SBDEP         25
+#define        D_JTRUNC        26
+#define        D_JFSYNC        27
+#define        D_SENTINEL      28
 #define        D_LAST          D_SENTINEL
 
 /*
@@ -469,17 +477,17 @@ struct allocdirect {
  * A single "indirdep" structure manages all allocation dependencies for
  * pointers in an indirect block. The up-to-date state of the indirect
  * block is stored in ir_savedata. The set of pointers that may be safely
- * written to the disk is stored in ir_safecopy. The state field is used
+ * written to the disk is stored in ir_savebp. The state field is used
  * only to track whether the buffer is currently being written (in which
- * case it is not safe to update ir_safecopy). Ir_deplisthd contains the
+ * case it is not safe to update ir_savebp). Ir_deplisthd contains the
  * list of allocindir structures, one for each block that needs to be
  * written to disk. Once the block and its bitmap allocation have been
  * written the safecopy can be updated to reflect the allocation and the
  * allocindir structure freed. If ir_state indicates that an I/O on the
- * indirect block is in progress when ir_safecopy is to be updated, the
+ * indirect block is in progress when ir_savebp is to be updated, the
  * update is deferred by placing the allocindir on the ir_donehd list.
  * When the I/O on the indirect block completes, the entries on the
- * ir_donehd list are processed by updating their corresponding ir_safecopy
+ * ir_donehd list are processed by updating their corresponding ir_savebp
  * pointers and then freeing the allocindir structure.
  */
 struct indirdep {
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to