Print this page
6660 ufs may read too many indirect blocks, flush a random block to disk

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/ufs/ufs_subr.c
          +++ new/usr/src/uts/common/fs/ufs/ufs_subr.c
↓ open down ↓ 594 lines elided ↑ open up ↑
 595  595          lbn = (daddr_t)lblkno(fs, ip->i_size - 1);
 596  596          if (lbn < NDADDR)
 597  597                  return (0);     /* No indirect blocks used */
 598  598          if (lbn < NDADDR + NINDIR(fs)) {
 599  599                  /* File has one indirect block. */
 600  600                  blkflush(ip->i_dev, (daddr_t)fsbtodb(fs, ip->i_ib[0]));
 601  601                  return (0);
 602  602          }
 603  603  
 604  604          /* Write out all the first level indirect blocks */
 605      -        for (i = 0; i <= NIADDR; i++) {
      605 +        for (i = 0; i < NIADDR; i++) {
 606  606                  if ((blkno = ip->i_ib[i]) == 0)
 607  607                          continue;
 608  608                  blkflush(ip->i_dev, (daddr_t)fsbtodb(fs, blkno));
 609  609          }
 610  610          /* Write out second level of indirect blocks */
 611  611          if ((blkno = ip->i_ib[1]) == 0)
 612  612                  return (0);
 613  613          bp = UFS_BREAD(ufsvfsp, ip->i_dev, (daddr_t)fsbtodb(fs, blkno), bsize);
 614  614          if (bp->b_flags & B_ERROR) {
 615  615                  brelse(bp);
↓ open down ↓ 1036 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX