Author: chs
Date: Mon Nov 25 19:31:38 2019
New Revision: 355098
URL: https://svnweb.freebsd.org/changeset/base/355098

Log:
  In ffs_freefile(), use a separate variable to hold the inode number within
  the cg rather than reusuing "ino" for this purpose.  This reduces the diff
  for an upcoming change that improves handling of I/O errors.
  
  No functional change.
  
  Reviewed by:  mckusick
  Approved by:  mckusick (mentor)
  Sponsored by: Netflix

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

Modified: head/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- head/sys/ufs/ffs/ffs_alloc.c        Mon Nov 25 18:33:21 2019        
(r355097)
+++ head/sys/ufs/ffs/ffs_alloc.c        Mon Nov 25 19:31:38 2019        
(r355098)
@@ -2786,6 +2786,7 @@ ffs_freefile(ump, fs, devvp, ino, mode, wkhd)
        u_int cg;
        u_int8_t *inosused;
        struct cdev *dev;
+       ino_t cgino;
 
        cg = ino_to_cg(fs, ino);
        if (devvp->v_type == VREG) {
@@ -2805,16 +2806,16 @@ ffs_freefile(ump, fs, devvp, ino, mode, wkhd)
        if ((error = ffs_getcg(fs, devvp, cg, 0, &bp, &cgp)) != 0)
                return (error);
        inosused = cg_inosused(cgp);
-       ino %= fs->fs_ipg;
-       if (isclr(inosused, ino)) {
+       cgino = ino % fs->fs_ipg;
+       if (isclr(inosused, cgino)) {
                printf("dev = %s, ino = %ju, fs = %s\n", devtoname(dev),
-                   (uintmax_t)(ino + cg * fs->fs_ipg), fs->fs_fsmnt);
+                   (uintmax_t)ino, fs->fs_fsmnt);
                if (fs->fs_ronly == 0)
                        panic("ffs_freefile: freeing free inode");
        }
-       clrbit(inosused, ino);
-       if (ino < cgp->cg_irotor)
-               cgp->cg_irotor = ino;
+       clrbit(inosused, cgino);
+       if (cgino < cgp->cg_irotor)
+               cgp->cg_irotor = cgino;
        cgp->cg_cs.cs_nifree++;
        UFS_LOCK(ump);
        fs->fs_cstotal.cs_nifree++;
@@ -2828,8 +2829,7 @@ ffs_freefile(ump, fs, devvp, ino, mode, wkhd)
        ACTIVECLEAR(fs, cg);
        UFS_UNLOCK(ump);
        if (MOUNTEDSOFTDEP(UFSTOVFS(ump)) && devvp->v_type == VCHR)
-               softdep_setup_inofree(UFSTOVFS(ump), bp,
-                   ino + cg * fs->fs_ipg, wkhd);
+               softdep_setup_inofree(UFSTOVFS(ump), bp, ino, wkhd);
        bdwrite(bp);
        return (0);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to