|
|
| version 1.482, 2007/09/21 16:10:12 | version 1.483, 2007/09/25 04:01:22 |
|---|---|
| Line 1925 xfs_iunlink( | Line 1925 xfs_iunlink( |
| */ | */ |
| error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, agdaddr, | error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, agdaddr, |
| XFS_FSS_TO_BB(mp, 1), 0, &agibp); | XFS_FSS_TO_BB(mp, 1), 0, &agibp); |
| if (error) { | if (error) |
| return error; | return error; |
| } | |
| /* | /* |
| * Validate the magic number of the agi block. | * Validate the magic number of the agi block. |
| */ | */ |
| Line 1951 xfs_iunlink( | Line 1951 xfs_iunlink( |
| ASSERT(agi->agi_unlinked[bucket_index]); | ASSERT(agi->agi_unlinked[bucket_index]); |
| ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != agino); | 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) { | if (be32_to_cpu(agi->agi_unlinked[bucket_index]) != NULLAGINO) { |
| /* | /* |
| * There is already another inode in the bucket we need | * There is already another inode in the bucket we need |
| Line 1958 xfs_iunlink( | Line 1976 xfs_iunlink( |
| * Here we put the head pointer into our next pointer, | * Here we put the head pointer into our next pointer, |
| * and then we fall through to point the head at us. | * 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); | ASSERT(be32_to_cpu(dip->di_next_unlinked) == NULLAGINO); |
| /* both on-disk, don't endian flip twice */ | /* both on-disk, don't endian flip twice */ |
| dip->di_next_unlinked = agi->agi_unlinked[bucket_index]; | dip->di_next_unlinked = agi->agi_unlinked[bucket_index]; |