svn commit: r338117 - head/tools/diag/prtblknos

Kirk McKusick mckusick at FreeBSD.org
Mon Aug 20 20:44:12 UTC 2018


Author: mckusick
Date: Mon Aug 20 20:44:11 2018
New Revision: 338117
URL: https://svnweb.freebsd.org/changeset/base/338117

Log:
  Fix incorrect output when printing block lists for files small enough
  to fit in only direct blocks whose size is exactly a multiple of the
  filesystem block size.
  
  Reported by:  Peter Holm
  Tested by:    Peter Holm
  Sponsored by: Netflix

Modified:
  head/tools/diag/prtblknos/prtblknos.c

Modified: head/tools/diag/prtblknos/prtblknos.c
==============================================================================
--- head/tools/diag/prtblknos/prtblknos.c	Mon Aug 20 20:31:53 2018	(r338116)
+++ head/tools/diag/prtblknos/prtblknos.c	Mon Aug 20 20:44:11 2018	(r338117)
@@ -121,7 +121,7 @@ prtblknos(disk, dp)
 		if (i < lastlbn - 1)
 			frags = fs->fs_frag;
 		else
-			frags = howmany(size % fs->fs_bsize,
+			frags = howmany(size - (lastlbn - 1) * fs->fs_bsize,
 					  fs->fs_fsize);
 		if (fs->fs_magic == FS_UFS1_MAGIC)
 			blkno = dp->dp1.di_db[i];


More information about the svn-src-head mailing list