Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84465
b: refs/heads/master
c: c319b58
h: refs/heads/master
i:
  84463: 4e218bf
v: v3
  • Loading branch information
Vlad Apostolov authored and Lachlan McIlroy committed Feb 7, 2008
1 parent f07a88c commit db258bf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 98ce2b5b1bd6db9f8d510b4333757fa6b1efe131
refs/heads/master: c319b58b13bb22f9a2478825b06c641c825f51ec
43 changes: 25 additions & 18 deletions trunk/fs/xfs/xfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1953,31 +1953,17 @@ xfs_iunlink(
ASSERT(agi->agi_unlinked[bucket_index]);
ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != agino);

error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0, 0);
if (error)
return error;

/*
* Clear the on-disk di_nlink. This is to prevent xfs_bulkstat
* from picking up this inode when it is reclaimed (its incore state
* initialzed but not flushed to disk yet). The in-core di_nlink is
* already cleared in xfs_droplink() and a corresponding transaction
* logged. The hack here just synchronizes the in-core to on-disk
* di_nlink value in advance before the actual inode sync to disk.
* This is OK because the inode is already unlinked and would never
* change its di_nlink again for this inode generation.
* This is a temporary hack that would require a proper fix
* in the future.
*/
dip->di_core.di_nlink = 0;

if (be32_to_cpu(agi->agi_unlinked[bucket_index]) != NULLAGINO) {
/*
* There is already another inode in the bucket we need
* to add ourselves to. Add us at the front of the list.
* Here we put the head pointer into our next pointer,
* and then we fall through to point the head at us.
*/
error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0, 0);
if (error)
return error;

ASSERT(be32_to_cpu(dip->di_next_unlinked) == NULLAGINO);
/* both on-disk, don't endian flip twice */
dip->di_next_unlinked = agi->agi_unlinked[bucket_index];
Expand Down Expand Up @@ -2367,6 +2353,8 @@ xfs_ifree(
int error;
int delete;
xfs_ino_t first_ino;
xfs_dinode_t *dip;
xfs_buf_t *ibp;

ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));
ASSERT(ip->i_transp == tp);
Expand Down Expand Up @@ -2402,8 +2390,27 @@ xfs_ifree(
* by reincarnations of this inode.
*/
ip->i_d.di_gen++;

xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);

error = xfs_itobp(ip->i_mount, tp, ip, &dip, &ibp, 0, 0);
if (error)
return error;

/*
* Clear the on-disk di_mode. This is to prevent xfs_bulkstat
* from picking up this inode when it is reclaimed (its incore state
* initialzed but not flushed to disk yet). The in-core di_mode is
* already cleared and a corresponding transaction logged.
* The hack here just synchronizes the in-core to on-disk
* di_mode value in advance before the actual inode sync to disk.
* This is OK because the inode is already unlinked and would never
* change its di_mode again for this inode generation.
* This is a temporary hack that would require a proper fix
* in the future.
*/
dip->di_core.di_mode = 0;

if (delete) {
xfs_ifree_cluster(ip, tp, first_ino);
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/xfs/xfs_itable.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,15 @@ xfs_bulkstat_use_dinode(
dip = (xfs_dinode_t *)
xfs_buf_offset(bp, clustidx << mp->m_sb.sb_inodelog);
/*
* Check the buffer containing the on-disk inode for di_nlink == 0.
* Check the buffer containing the on-disk inode for di_mode == 0.
* This is to prevent xfs_bulkstat from picking up just reclaimed
* inodes that have their in-core state initialized but not flushed
* to disk yet. This is a temporary hack that would require a proper
* fix in the future.
*/
if (be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC ||
!XFS_DINODE_GOOD_VERSION(dip->di_core.di_version) ||
!dip->di_core.di_nlink)
!dip->di_core.di_mode)
return 0;
if (flags & BULKSTAT_FG_QUICK) {
*dipp = dip;
Expand Down

0 comments on commit db258bf

Please sign in to comment.