Correct the estimated block count calculated by dump to account

for the minimal amount of space used by a snapshot.

Sponsored by:   DARPA & NAI Labs.
This commit is contained in:
Kirk McKusick 2002-12-03 05:12:53 +00:00
parent 69becf4a5e
commit 6bfd0bdc80
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107542
2 changed files with 4 additions and 2 deletions

View File

@ -103,7 +103,6 @@ time_t unctime(char *str);
/* mapping rouintes */ /* mapping rouintes */
union dinode; union dinode;
long blockest(union dinode *dp);
int mapfiles(ino_t maxino, long *tapesize); int mapfiles(ino_t maxino, long *tapesize);
int mapdirs(ino_t maxino, long *tapesize); int mapdirs(ino_t maxino, long *tapesize);

View File

@ -76,6 +76,7 @@ static int dirindir(ino_t ino, ufs2_daddr_t blkno, int level, long *size,
static void dmpindir(ino_t ino, ufs2_daddr_t blk, int level, off_t *size); static void dmpindir(ino_t ino, ufs2_daddr_t blk, int level, off_t *size);
static int searchdir(ino_t ino, ufs2_daddr_t blkno, long size, long filesize, static int searchdir(ino_t ino, ufs2_daddr_t blkno, long size, long filesize,
long *tapesize, int nodump); long *tapesize, int nodump);
static long blockest(union dinode *dp);
/* /*
* This is an estimation of the number of TP_BSIZE blocks in the file. * This is an estimation of the number of TP_BSIZE blocks in the file.
@ -84,7 +85,7 @@ static int searchdir(ino_t ino, ufs2_daddr_t blkno, long size, long filesize,
* (when some of the blocks are usually used for indirect pointers); * (when some of the blocks are usually used for indirect pointers);
* hence the estimate may be high. * hence the estimate may be high.
*/ */
long static long
blockest(union dinode *dp) blockest(union dinode *dp)
{ {
long blkest, sizeest; long blkest, sizeest;
@ -103,6 +104,8 @@ blockest(union dinode *dp)
* dump blocks (sizeest vs. blkest in the indirect block * dump blocks (sizeest vs. blkest in the indirect block
* calculation). * calculation).
*/ */
if ((DIP(dp, di_flags) & SF_SNAPSHOT) != 0)
return (1);
blkest = howmany(dbtob(DIP(dp, di_blocks)), TP_BSIZE); blkest = howmany(dbtob(DIP(dp, di_blocks)), TP_BSIZE);
sizeest = howmany(DIP(dp, di_size), TP_BSIZE); sizeest = howmany(DIP(dp, di_size), TP_BSIZE);
if (blkest > sizeest) if (blkest > sizeest)