aboutsummaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorVlad Apostolov <vapo@sgi.com>2007-11-23 16:27:51 +1100
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-02-07 18:13:37 +1100
commitc319b58b13bb22f9a2478825b06c641c825f51ec (patch)
tree92d259656210a8bd698e02aac28b37c32d6a9e3e /fs/xfs/xfs_inode.c
parent98ce2b5b1bd6db9f8d510b4333757fa6b1efe131 (diff)
[XFS] Make xfs_bulkstat() to report unlinked but referenced inodes
We need xfs_bulkstat() to report inode stat for inodes with link count zero but reference count non zero. The fix here: http://oss.sgi.com/archives/xfs/2007-09/msg00266.html changed this behavior and made xfs_bulkstat() to filter all unlinked inodes including those that are not destroyed yet but held by reference. The attached patch returns back to the original behavior by marking the on-disk inode buffer "dirty" when di_mode is cleared (at that time both inode link and reference counter are zero). SGI-PV: 972004 SGI-Modid: xfs-linux-melb:xfs-kern:29914a Signed-off-by: Vlad Apostolov <vapo@sgi.com> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 6d5641ff08f..597e0ed4d2b 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1953,24 +1953,6 @@ 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
@@ -1978,6 +1960,10 @@ xfs_iunlink(
* 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];
@@ -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);
@@ -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);
}