xfs: refactor xfs_iget calls from log intent recovery
[sfrench/cifs-2.6.git] / fs / xfs / xfs_log_recover.c
index 1d324c8bac6bf7c3565346a81266f61cc5e86705..1d4213302078797a1d111d842ec344b05c639369 100644 (file)
@@ -26,6 +26,8 @@
 #include "xfs_error.h"
 #include "xfs_buf_item.h"
 #include "xfs_ag.h"
+#include "xfs_quota.h"
+
 
 #define BLK_AVG(blk1, blk2)    ((blk1+blk2) >> 1)
 
@@ -1754,6 +1756,30 @@ xlog_recover_release_intent(
        spin_unlock(&ailp->ail_lock);
 }
 
+int
+xlog_recover_iget(
+       struct xfs_mount        *mp,
+       xfs_ino_t               ino,
+       struct xfs_inode        **ipp)
+{
+       int                     error;
+
+       error = xfs_iget(mp, NULL, ino, 0, 0, ipp);
+       if (error)
+               return error;
+
+       error = xfs_qm_dqattach(*ipp);
+       if (error) {
+               xfs_irele(*ipp);
+               return error;
+       }
+
+       if (VFS_I(*ipp)->i_nlink == 0)
+               xfs_iflags_set(*ipp, XFS_IRECOVERY);
+
+       return 0;
+}
+
 /******************************************************************************
  *
  *             Log recover routines