Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 148842
b: refs/heads/master
c: 1da8eec
h: refs/heads/master
v: v3
  • Loading branch information
Dave Chinner authored and Christoph Hellwig committed Jun 8, 2009
1 parent 39ff76c commit 488a66e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 23 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: 845b6d0cbbc2304e8a54ed4038272c55f85b2269
refs/heads/master: 1da8eecab5f866b4f5be43adbaadf18e259a8cc5
59 changes: 37 additions & 22 deletions trunk/fs/xfs/linux-2.6/xfs_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,39 @@
#include <linux/freezer.h>


/* must be called with pag_ici_lock held and releases it */
STATIC int
xfs_sync_inode_valid(
struct xfs_inode *ip,
struct xfs_perag *pag)
{
struct inode *inode = VFS_I(ip);

/* nothing to sync during shutdown */
if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
read_unlock(&pag->pag_ici_lock);
return EFSCORRUPTED;
}

/*
* If we can't get a reference on the inode, it must be in reclaim.
* Leave it for the reclaim code to flush. Also avoid inodes that
* haven't been fully initialised.
*/
if (!igrab(inode)) {
read_unlock(&pag->pag_ici_lock);
return ENOENT;
}
read_unlock(&pag->pag_ici_lock);

if (is_bad_inode(inode) || xfs_iflags_test(ip, XFS_INEW)) {
IRELE(ip);
return ENOENT;
}

return 0;
}

STATIC int
xfs_sync_inode_data(
struct xfs_inode *ip,
Expand Down Expand Up @@ -123,7 +156,6 @@ xfs_sync_inodes_ag(
int last_error = 0;

do {
struct inode *inode;
xfs_inode_t *ip = NULL;

/*
Expand Down Expand Up @@ -152,27 +184,10 @@ xfs_sync_inodes_ag(
break;
}

/* nothing to sync during shutdown */
if (XFS_FORCED_SHUTDOWN(mp)) {
read_unlock(&pag->pag_ici_lock);
return 0;
}

/*
* If we can't get a reference on the inode, it must be
* in reclaim. Leave it for the reclaim code to flush.
*/
inode = VFS_I(ip);
if (!igrab(inode)) {
read_unlock(&pag->pag_ici_lock);
continue;
}
read_unlock(&pag->pag_ici_lock);

/* avoid new or bad inodes */
if (is_bad_inode(inode) ||
xfs_iflags_test(ip, XFS_INEW)) {
IRELE(ip);
error = xfs_sync_inode_valid(ip, pag);
if (error) {
if (error == EFSCORRUPTED)
return 0;
continue;
}

Expand Down

0 comments on commit 488a66e

Please sign in to comment.