Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 2019 13:53:59 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r344887 - in stable/11/sbin: fsck_ffs fsdb
Message-ID:  <201903071353.x27DrxCn036010@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Mar  7 13:53:59 2019
New Revision: 344887
URL: https://svnweb.freebsd.org/changeset/base/344887

Log:
  MFC r339941 (by mckusick):
  In preparation for adding inode check-hashes, change the fsck_ffs
  inodirty() function to have a pointer to the inode being dirtied.
  No functional change (as for now the parameter is ununsed).
  
  Also for stable/11 UFS_NDADDR was renamed to NDADDR.

Modified:
  stable/11/sbin/fsck_ffs/dir.c
  stable/11/sbin/fsck_ffs/fsck.h
  stable/11/sbin/fsck_ffs/inode.c
  stable/11/sbin/fsck_ffs/pass1.c
  stable/11/sbin/fsck_ffs/pass2.c
  stable/11/sbin/fsdb/fsdb.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/fsck_ffs/dir.c
==============================================================================
--- stable/11/sbin/fsck_ffs/dir.c	Thu Mar  7 13:52:20 2019	(r344886)
+++ stable/11/sbin/fsck_ffs/dir.c	Thu Mar  7 13:53:59 2019	(r344887)
@@ -321,7 +321,7 @@ adjust(struct inodesc *idesc, int lcnt)
 		if (preen || reply("ADJUST") == 1) {
 			if (bkgrdflag == 0) {
 				DIP_SET(dp, di_nlink, DIP(dp, di_nlink) - lcnt);
-				inodirty();
+				inodirty(dp);
 			} else {
 				cmd.value = idesc->id_number;
 				cmd.size = -lcnt;
@@ -446,7 +446,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
 			pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
 			return (0);
 		}
-		inodirty();
+		inodirty(dp);
 		idesc.id_type = ADDR;
 		idesc.id_func = pass4check;
 		idesc.id_number = oldlfdir;
@@ -471,7 +471,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
 			(void)makeentry(orphan, lfdir, "..");
 		dp = ginode(lfdir);
 		DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1);
-		inodirty();
+		inodirty(dp);
 		inoinfo(lfdir)->ino_linkcnt++;
 		pwarn("DIR I=%lu CONNECTED. ", (u_long)orphan);
 		if (parentdir != (ino_t)-1) {
@@ -532,7 +532,7 @@ makeentry(ino_t parent, ino_t ino, const char *name)
 	dp = ginode(parent);
 	if (DIP(dp, di_size) % DIRBLKSIZ) {
 		DIP_SET(dp, di_size, roundup(DIP(dp, di_size), DIRBLKSIZ));
-		inodirty();
+		inodirty(dp);
 	}
 	if ((ckinode(dp, &idesc) & ALTERED) != 0)
 		return (1);
@@ -588,7 +588,7 @@ expanddir(union dinode *dp, char *name)
 	else if (reply("EXPAND") == 0)
 		goto bad;
 	dirty(bp);
-	inodirty();
+	inodirty(dp);
 	return (1);
 bad:
 	DIP_SET(dp, di_db[lastbn], DIP(dp, di_db[lastbn + 1]));
@@ -629,7 +629,7 @@ allocdir(ino_t parent, ino_t request, int mode)
 		memmove(cp, &emptydir, sizeof emptydir);
 	dirty(bp);
 	DIP_SET(dp, di_nlink, 2);
-	inodirty();
+	inodirty(dp);
 	if (ino == ROOTINO) {
 		inoinfo(ino)->ino_linkcnt = DIP(dp, di_nlink);
 		cacheino(dp, ino);
@@ -650,7 +650,7 @@ allocdir(ino_t parent, ino_t request, int mode)
 	}
 	dp = ginode(parent);
 	DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1);
-	inodirty();
+	inodirty(dp);
 	return (ino);
 }
 
@@ -665,7 +665,7 @@ freedir(ino_t ino, ino_t parent)
 	if (ino != parent) {
 		dp = ginode(parent);
 		DIP_SET(dp, di_nlink, DIP(dp, di_nlink) - 1);
-		inodirty();
+		inodirty(dp);
 	}
 	freeino(ino);
 }

Modified: stable/11/sbin/fsck_ffs/fsck.h
==============================================================================
--- stable/11/sbin/fsck_ffs/fsck.h	Thu Mar  7 13:52:20 2019	(r344886)
+++ stable/11/sbin/fsck_ffs/fsck.h	Thu Mar  7 13:53:59 2019	(r344887)
@@ -446,7 +446,7 @@ union dinode   *ginode(ino_t inumber);
 void		infohandler(int sig);
 void		alarmhandler(int sig);
 void		inocleanup(void);
-void		inodirty(void);
+void		inodirty(union dinode *);
 struct inostat *inoinfo(ino_t inum);
 void		IOstats(char *what);
 int		linkup(ino_t orphan, ino_t parentdir, char *name);

Modified: stable/11/sbin/fsck_ffs/inode.c
==============================================================================
--- stable/11/sbin/fsck_ffs/inode.c	Thu Mar  7 13:52:20 2019	(r344886)
+++ stable/11/sbin/fsck_ffs/inode.c	Thu Mar  7 13:53:59 2019	(r344887)
@@ -100,7 +100,7 @@ ckinode(union dinode *dp, struct inodesc *idesc)
 					printf(
 					    "YOU MUST RERUN FSCK AFTERWARDS\n");
 					rerun = 1;
-					inodirty();
+					inodirty(dp);
 
 				}
 			}
@@ -140,7 +140,7 @@ ckinode(union dinode *dp, struct inodesc *idesc)
 					printf(
 					    "YOU MUST RERUN FSCK AFTERWARDS\n");
 					rerun = 1;
-					inodirty();
+					inodirty(dp);
 					break;
 				}
 			}
@@ -219,7 +219,7 @@ iblock(struct inodesc *idesc, long ilevel, off_t isize
 					printf(
 					    "YOU MUST RERUN FSCK AFTERWARDS\n");
 					rerun = 1;
-					inodirty();
+					inodirty(dp);
 					bp->b_flags &= ~B_INUSE;
 					return(STOP);
 				}
@@ -517,7 +517,7 @@ inocleanup(void)
 }
 
 void
-inodirty(void)
+inodirty(union dinode *dp)
 {
 
 	dirty(pbp);
@@ -542,7 +542,7 @@ clri(struct inodesc *idesc, const char *type, int flag
 			(void)ckinode(dp, idesc);
 			inoinfo(idesc->id_number)->ino_state = USTATE;
 			clearinode(dp);
-			inodirty();
+			inodirty(dp);
 		} else {
 			cmd.value = idesc->id_number;
 			cmd.size = -DIP(dp, di_nlink);
@@ -709,7 +709,7 @@ allocino(ino_t request, int type)
 	DIP_SET(dp, di_size, sblock.fs_fsize);
 	DIP_SET(dp, di_blocks, btodb(sblock.fs_fsize));
 	n_files++;
-	inodirty();
+	inodirty(dp);
 	inoinfo(ino)->ino_type = IFTODT(type);
 	return (ino);
 }
@@ -730,7 +730,7 @@ freeino(ino_t ino)
 	dp = ginode(ino);
 	(void)ckinode(dp, &idesc);
 	clearinode(dp);
-	inodirty();
+	inodirty(dp);
 	inoinfo(ino)->ino_state = USTATE;
 	n_files--;
 }

Modified: stable/11/sbin/fsck_ffs/pass1.c
==============================================================================
--- stable/11/sbin/fsck_ffs/pass1.c	Thu Mar  7 13:52:20 2019	(r344886)
+++ stable/11/sbin/fsck_ffs/pass1.c	Thu Mar  7 13:53:59 2019	(r344887)
@@ -269,7 +269,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int r
 			if (reply("CLEAR") == 1) {
 				dp = ginode(inumber);
 				clearinode(dp);
-				inodirty();
+				inodirty(dp);
 			}
 		}
 		inoinfo(inumber)->ino_state = USTATE;
@@ -292,7 +292,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int r
 		dp = ginode(inumber);
 		DIP_SET(dp, di_size, sblock.fs_fsize);
 		DIP_SET(dp, di_mode, IFREG|0600);
-		inodirty();
+		inodirty(dp);
 	}
 	if ((mode == IFBLK || mode == IFCHR || mode == IFIFO ||
 	     mode == IFSOCK) && DIP(dp, di_size) != 0) {
@@ -410,7 +410,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int r
 		if (bkgrdflag == 0) {
 			dp = ginode(inumber);
 			DIP_SET(dp, di_blocks, idesc->id_entryno);
-			inodirty();
+			inodirty(dp);
 		} else {
 			cmd.value = idesc->id_number;
 			cmd.size = idesc->id_entryno - DIP(dp, di_blocks);
@@ -436,7 +436,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int r
 	 * the last allocated block to avoid having it reference a hole
 	 * at its end.
 	 */
-	if (DIP(dp, di_size) > UFS_NDADDR * sblock.fs_bsize &&
+	if (DIP(dp, di_size) > NDADDR * sblock.fs_bsize &&
 	    idesc->id_lballoc < lblkno(&sblock, DIP(dp, di_size) - 1)) {
 		fixsize = lblktosize(&sblock, idesc->id_lballoc + 1);
 		pwarn("INODE %lu: FILE SIZE %ju BEYOND END OF ALLOCATED FILE, "
@@ -470,7 +470,7 @@ unknown:
 		inoinfo(inumber)->ino_state = USTATE;
 		dp = ginode(inumber);
 		clearinode(dp);
-		inodirty();
+		inodirty(dp);
 	}
 	return (1);
 }

Modified: stable/11/sbin/fsck_ffs/pass2.c
==============================================================================
--- stable/11/sbin/fsck_ffs/pass2.c	Thu Mar  7 13:52:20 2019	(r344886)
+++ stable/11/sbin/fsck_ffs/pass2.c	Thu Mar  7 13:53:59 2019	(r344887)
@@ -110,7 +110,7 @@ pass2(void)
 		dp = ginode(ROOTINO);
 		DIP_SET(dp, di_mode, DIP(dp, di_mode) & ~IFMT);
 		DIP_SET(dp, di_mode, DIP(dp, di_mode) | IFDIR);
-		inodirty();
+		inodirty(dp);
 		break;
 
 	case DSTATE:
@@ -156,7 +156,7 @@ pass2(void)
 			if (reply("FIX") == 1) {
 				dp = ginode(inp->i_number);
 				DIP_SET(dp, di_size, inp->i_isize);
-				inodirty();
+				inodirty(dp);
 			}
 		} else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) {
 			getpathname(pathbuf, inp->i_number, inp->i_number);
@@ -175,7 +175,7 @@ pass2(void)
 				dp = ginode(inp->i_number);
 				DIP_SET(dp, di_size,
 				    roundup(inp->i_isize, DIRBLKSIZ));
-				inodirty();
+				inodirty(dp);
 			}
 		}
 		dp = &dino;

Modified: stable/11/sbin/fsdb/fsdb.c
==============================================================================
--- stable/11/sbin/fsdb/fsdb.c	Thu Mar  7 13:52:20 2019	(r344886)
+++ stable/11/sbin/fsdb/fsdb.c	Thu Mar  7 13:53:59 2019	(r344887)
@@ -342,7 +342,7 @@ CMDFUNCSTART(zapi)
     GETINUM(1,inum);
     dp = ginode(inum);
     clearinode(dp);
-    inodirty();
+    inodirty(dp);
     if (curinode)			/* re-set after potential change */
 	curinode = ginode(curinum);
     return 0;
@@ -372,7 +372,7 @@ CMDFUNCSTART(uplink)
     DIP_SET(curinode, di_nlink, DIP(curinode, di_nlink) + 1);
     printf("inode %ju link count now %d\n",
 	(uintmax_t)curinum, DIP(curinode, di_nlink));
-    inodirty();
+    inodirty(curinode);
     return 0;
 }
 
@@ -383,7 +383,7 @@ CMDFUNCSTART(downlink)
     DIP_SET(curinode, di_nlink, DIP(curinode, di_nlink) - 1);
     printf("inode %ju link count now %d\n",
 	(uintmax_t)curinum, DIP(curinode, di_nlink));
-    inodirty();
+    inodirty(curinode);
     return 0;
 }
 
@@ -917,7 +917,7 @@ CMDFUNCSTART(newtype)
     }
     DIP_SET(curinode, di_mode, DIP(curinode, di_mode) & ~IFMT);
     DIP_SET(curinode, di_mode, DIP(curinode, di_mode) | type);
-    inodirty();
+    inodirty(curinode);
     printactive(0);
     return 0;
 }
@@ -938,7 +938,7 @@ CMDFUNCSTART(chlen)
     }
     
     DIP_SET(curinode, di_size, len);
-    inodirty();
+    inodirty(curinode);
     printactive(0);
     return rval;
 }
@@ -960,7 +960,7 @@ CMDFUNCSTART(chmode)
     
     DIP_SET(curinode, di_mode, DIP(curinode, di_mode) & ~07777);
     DIP_SET(curinode, di_mode, DIP(curinode, di_mode) | modebits);
-    inodirty();
+    inodirty(curinode);
     printactive(0);
     return rval;
 }
@@ -985,7 +985,7 @@ CMDFUNCSTART(chaflags)
 	return(1);
     }
     DIP_SET(curinode, di_flags, flags);
-    inodirty();
+    inodirty(curinode);
     printactive(0);
     return rval;
 }
@@ -1010,7 +1010,7 @@ CMDFUNCSTART(chgen)
 	return(1);
     }
     DIP_SET(curinode, di_gen, gen);
-    inodirty();
+    inodirty(curinode);
     printactive(0);
     return rval;
 }
@@ -1060,7 +1060,7 @@ CMDFUNCSTART(linkcount)
     }
     
     DIP_SET(curinode, di_nlink, lcnt);
-    inodirty();
+    inodirty(curinode);
     printactive(0);
     return rval;
 }
@@ -1087,7 +1087,7 @@ CMDFUNCSTART(chowner)
     }
     
     DIP_SET(curinode, di_uid, uid);
-    inodirty();
+    inodirty(curinode);
     printactive(0);
     return rval;
 }
@@ -1113,7 +1113,7 @@ CMDFUNCSTART(chgroup)
     }
     
     DIP_SET(curinode, di_gid, gid);
-    inodirty();
+    inodirty(curinode);
     printactive(0);
     return rval;
 }
@@ -1182,7 +1182,7 @@ CMDFUNCSTART(chbtime)
 	return 1;
     curinode->dp2.di_birthtime = _time_to_time64(secs);
     curinode->dp2.di_birthnsec = nsecs;
-    inodirty();
+    inodirty(curinode);
     printactive(0);
     return 0;
 }
@@ -1199,7 +1199,7 @@ CMDFUNCSTART(chmtime)
     else
 	curinode->dp2.di_mtime = _time_to_time64(secs);
     DIP_SET(curinode, di_mtimensec, nsecs);
-    inodirty();
+    inodirty(curinode);
     printactive(0);
     return 0;
 }
@@ -1216,7 +1216,7 @@ CMDFUNCSTART(chatime)
     else
 	curinode->dp2.di_atime = _time_to_time64(secs);
     DIP_SET(curinode, di_atimensec, nsecs);
-    inodirty();
+    inodirty(curinode);
     printactive(0);
     return 0;
 }
@@ -1233,7 +1233,7 @@ CMDFUNCSTART(chctime)
     else
 	curinode->dp2.di_ctime = _time_to_time64(secs);
     DIP_SET(curinode, di_ctimensec, nsecs);
-    inodirty();
+    inodirty(curinode);
     printactive(0);
     return 0;
 }



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