Diff for /xfs-linux/xfs_inode.c between versions 1.462 and 1.463

version 1.462, 2007/03/10 02:56:10 version 1.463, 2007/03/30 04:04:14
Line 442  xfs_iformat( Line 442  xfs_iformat(
                         return XFS_ERROR(EFSCORRUPTED);                          return XFS_ERROR(EFSCORRUPTED);
                 }                  }
                 ip->i_d.di_size = 0;                  ip->i_d.di_size = 0;
                   ip->i_size = 0;
                 ip->i_df.if_u2.if_rdev = INT_GET(dip->di_u.di_dev, ARCH_CONVERT);                  ip->i_df.if_u2.if_rdev = INT_GET(dip->di_u.di_dev, ARCH_CONVERT);
                 break;                  break;
   
Line 980  xfs_iread( Line 981  xfs_iread(
         }          }
   
         ip->i_delayed_blks = 0;          ip->i_delayed_blks = 0;
           ip->i_size = ip->i_d.di_size;
   
         /*          /*
          * Mark the buffer containing the inode as something to keep           * Mark the buffer containing the inode as something to keep
Line 1170  xfs_ialloc( Line 1172  xfs_ialloc(
         }          }
   
         ip->i_d.di_size = 0;          ip->i_d.di_size = 0;
           ip->i_size = 0;
         ip->i_d.di_nextents = 0;          ip->i_d.di_nextents = 0;
         ASSERT(ip->i_d.di_nblocks == 0);          ASSERT(ip->i_d.di_nblocks == 0);
         xfs_ichgtime(ip, XFS_ICHGTIME_CHG|XFS_ICHGTIME_ACC|XFS_ICHGTIME_MOD);          xfs_ichgtime(ip, XFS_ICHGTIME_CHG|XFS_ICHGTIME_ACC|XFS_ICHGTIME_MOD);
Line 1340  xfs_file_last_byte( Line 1343  xfs_file_last_byte(
         } else {          } else {
                 last_block = 0;                  last_block = 0;
         }          }
         size_last_block = XFS_B_TO_FSB(mp, (xfs_ufsize_t)ip->i_d.di_size);          size_last_block = XFS_B_TO_FSB(mp, (xfs_ufsize_t)ip->i_size);
         last_block = XFS_FILEOFF_MAX(last_block, size_last_block);          last_block = XFS_FILEOFF_MAX(last_block, size_last_block);
   
         last_byte = XFS_FSB_TO_B(mp, last_block);          last_byte = XFS_FSB_TO_B(mp, last_block);
Line 1434  xfs_itruncate_start( Line 1437  xfs_itruncate_start(
         int             error = 0;          int             error = 0;
   
         ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE) != 0);          ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE) != 0);
         ASSERT((new_size == 0) || (new_size <= ip->i_d.di_size));          ASSERT((new_size == 0) || (new_size <= ip->i_size));
         ASSERT((flags == XFS_ITRUNC_DEFINITE) ||          ASSERT((flags == XFS_ITRUNC_DEFINITE) ||
                (flags == XFS_ITRUNC_MAYBE));                 (flags == XFS_ITRUNC_MAYBE));
   
Line 1558  xfs_itruncate_finish( Line 1561  xfs_itruncate_finish(
   
         ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE) != 0);          ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE) != 0);
         ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE) != 0);          ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE) != 0);
         ASSERT((new_size == 0) || (new_size <= ip->i_d.di_size));          ASSERT((new_size == 0) || (new_size <= ip->i_size));
         ASSERT(*tp != NULL);          ASSERT(*tp != NULL);
         ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES);          ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES);
         ASSERT(ip->i_transp == *tp);          ASSERT(ip->i_transp == *tp);
Line 1632  xfs_itruncate_finish( Line 1635  xfs_itruncate_finish(
          */           */
         if (fork == XFS_DATA_FORK) {          if (fork == XFS_DATA_FORK) {
                 if (ip->i_d.di_nextents > 0) {                  if (ip->i_d.di_nextents > 0) {
                         ip->i_d.di_size = new_size;                          /*
                         xfs_trans_log_inode(ntp, ip, XFS_ILOG_CORE);                           * If we are not changing the file size then do
                            * not update the on-disk file size - we may be
                            * called from xfs_inactive_free_eofblocks().  If we
                            * update the on-disk file size and then the system
                            * crashes before the contents of the file are
                            * flushed to disk then the files may be full of
                            * holes (ie NULL files bug).
                            */
                           if (ip->i_size != new_size) {
                                   ip->i_d.di_size = new_size;
                                   ip->i_size = new_size;
                                   xfs_trans_log_inode(ntp, ip, XFS_ILOG_CORE);
                           }
                 }                  }
         } else if (sync) {          } else if (sync) {
                 ASSERT(!(mp->m_flags & XFS_MOUNT_WSYNC));                  ASSERT(!(mp->m_flags & XFS_MOUNT_WSYNC));
Line 1769  xfs_itruncate_finish( Line 1784  xfs_itruncate_finish(
          */           */
         if (fork == XFS_DATA_FORK) {          if (fork == XFS_DATA_FORK) {
                 xfs_isize_check(mp, ip, new_size);                  xfs_isize_check(mp, ip, new_size);
                 ip->i_d.di_size = new_size;                  /*
                    * If we are not changing the file size then do
                    * not update the on-disk file size - we may be
                    * called from xfs_inactive_free_eofblocks().  If we
                    * update the on-disk file size and then the system
                    * crashes before the contents of the file are
                    * flushed to disk then the files may be full of
                    * holes (ie NULL files bug).
                    */
                   if (ip->i_size != new_size) {
                           ip->i_d.di_size = new_size;
                           ip->i_size = new_size;
                   }
         }          }
         xfs_trans_log_inode(ntp, ip, XFS_ILOG_CORE);          xfs_trans_log_inode(ntp, ip, XFS_ILOG_CORE);
         ASSERT((new_size != 0) ||          ASSERT((new_size != 0) ||
Line 1802  xfs_igrow_start( Line 1829  xfs_igrow_start(
   
         ASSERT(ismrlocked(&(ip->i_lock), MR_UPDATE) != 0);          ASSERT(ismrlocked(&(ip->i_lock), MR_UPDATE) != 0);
         ASSERT(ismrlocked(&(ip->i_iolock), MR_UPDATE) != 0);          ASSERT(ismrlocked(&(ip->i_iolock), MR_UPDATE) != 0);
         ASSERT(new_size > ip->i_d.di_size);          ASSERT(new_size > ip->i_size);
   
         /*          /*
          * Zero any pages that may have been created by           * Zero any pages that may have been created by
Line 1810  xfs_igrow_start( Line 1837  xfs_igrow_start(
          * and any blocks between the old and new file sizes.           * and any blocks between the old and new file sizes.
          */           */
         error = xfs_zero_eof(XFS_ITOV(ip), &ip->i_iocore, new_size,          error = xfs_zero_eof(XFS_ITOV(ip), &ip->i_iocore, new_size,
                              ip->i_d.di_size);                               ip->i_size);
         return error;          return error;
 }  }
   
Line 1834  xfs_igrow_finish( Line 1861  xfs_igrow_finish(
         ASSERT(ismrlocked(&(ip->i_lock), MR_UPDATE) != 0);          ASSERT(ismrlocked(&(ip->i_lock), MR_UPDATE) != 0);
         ASSERT(ismrlocked(&(ip->i_iolock), MR_UPDATE) != 0);          ASSERT(ismrlocked(&(ip->i_iolock), MR_UPDATE) != 0);
         ASSERT(ip->i_transp == tp);          ASSERT(ip->i_transp == tp);
         ASSERT(new_size > ip->i_d.di_size);          ASSERT(new_size > ip->i_size);
   
         /*          /*
          * Update the file size.  Update the inode change timestamp           * Update the file size.  Update the inode change timestamp
          * if change_flag set.           * if change_flag set.
          */           */
         ip->i_d.di_size = new_size;          ip->i_d.di_size = new_size;
           ip->i_size = new_size;
         if (change_flag)          if (change_flag)
                 xfs_ichgtime(ip, XFS_ICHGTIME_CHG);                  xfs_ichgtime(ip, XFS_ICHGTIME_CHG);
         xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);          xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
Line 2323  xfs_ifree( Line 2351  xfs_ifree(
         ASSERT(ip->i_d.di_nlink == 0);          ASSERT(ip->i_d.di_nlink == 0);
         ASSERT(ip->i_d.di_nextents == 0);          ASSERT(ip->i_d.di_nextents == 0);
         ASSERT(ip->i_d.di_anextents == 0);          ASSERT(ip->i_d.di_anextents == 0);
         ASSERT((ip->i_d.di_size == 0) ||          ASSERT((ip->i_d.di_size == 0 && ip->i_size == 0) ||
                ((ip->i_d.di_mode & S_IFMT) != S_IFREG));                 ((ip->i_d.di_mode & S_IFMT) != S_IFREG));
         ASSERT(ip->i_d.di_nblocks == 0);          ASSERT(ip->i_d.di_nblocks == 0);
   

Removed from v.1.462  
changed lines
  Added in v.1.463


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>