MFS: fix block estimation computation
This commit is contained in:
parent
9c7bae4e16
commit
2d20088881
1 changed files with 6 additions and 6 deletions
|
@ -18,25 +18,25 @@ static blkcnt_t estimate_blocks(struct inode *rip)
|
|||
* indirect blocks is too costly for a stat call, so we disregard holes and
|
||||
* return a conservative estimation.
|
||||
*/
|
||||
unsigned int zone_size, zones;
|
||||
blkcnt_t sindirs, dindirs, nr_indirs, sq_indirs;
|
||||
blkcnt_t zones, sindirs, dindirs, nr_indirs, sq_indirs;
|
||||
unsigned int zone_size;
|
||||
|
||||
/* Compute the number of zones used by the file. */
|
||||
zone_size = rip->i_sp->s_block_size << rip->i_sp->s_log_zone_size;
|
||||
|
||||
zones = (rip->i_size + zone_size - 1) / zone_size;
|
||||
zones = (blkcnt_t) ((rip->i_size + zone_size - 1) / zone_size);
|
||||
|
||||
/* Compute the number of indirect blocks needed for that zone count. */
|
||||
nr_indirs = (blkcnt_t) rip->i_nindirs;
|
||||
sq_indirs = nr_indirs * nr_indirs;
|
||||
|
||||
sindirs = (blkcnt_t) (zones - rip->i_ndzones + nr_indirs - 1) / nr_indirs;
|
||||
dindirs = (blkcnt_t) (sindirs - 1 + sq_indirs - 1) / sq_indirs;
|
||||
sindirs = (zones - (blkcnt_t) rip->i_ndzones + nr_indirs - 1) / nr_indirs;
|
||||
dindirs = (sindirs - 1 + sq_indirs - 1) / sq_indirs;
|
||||
|
||||
/* Return the number of 512-byte blocks corresponding to the number of data
|
||||
* zones and indirect blocks.
|
||||
*/
|
||||
return((blkcnt_t) (zones + sindirs + dindirs) * (zone_size / 512));
|
||||
return (zones + sindirs + dindirs) * (blkcnt_t) (zone_size / 512);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
|
Loading…
Reference in a new issue