- if (nb != 0)
- blocksreleased += indirtrunc(ip, nb, last, level - 1);
- }
- brelse(bp);
- return (blocksreleased);
-}
-
-/*
- * Remove any inodes in the inode cache belonging to dev.
- *
- * There should not be any active ones, return error if any are found
- * (nb: this is a user error, not a system err).
- */
-#ifdef QUOTA
-iflush(dev, iq)
- dev_t dev;
- struct inode *iq;
-#else
-iflush(dev)
- dev_t dev;
-#endif
-{
- register struct inode *ip;
-
- for (ip = inode; ip < inodeNINODE; ip++) {
-#ifdef QUOTA
- if (ip != iq && ip->i_dev == dev)
-#else
- if (ip->i_dev == dev)
-#endif
- if (ip->i_count)
- return (EBUSY);
- else {
- remque(ip);
- ip->i_forw = ip;
- ip->i_back = ip;
- /*
- * as i_count == 0, the inode was on the free
- * list already, just leave it there, it will
- * fall off the bottom eventually. We could
- * perhaps move it to the head of the free
- * list, but as umounts are done so
- * infrequently, we would gain very little,
- * while making the code bigger.
- */
-#ifdef QUOTA
- dqrele(ip->i_dquot);
- ip->i_dquot = NODQUOT;
-#endif
- }
+ if (nb != 0) {
+ error = indirtrunc(ip, nb, last, level - 1, &blkcount);
+ if (error)
+ allerror = error;
+ blocksreleased += blkcount;
+ }