Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213262
b: refs/heads/master
c: e13de95
h: refs/heads/master
v: v3
  • Loading branch information
Dave Chinner authored and Alex Elder committed Oct 18, 2010
1 parent b70b3eb commit d3afa15
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 55 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: 65d0f20533c503b50bd5e7e86434512af7761eea
refs/heads/master: e13de955ca67b0bd1cec9a2f9352a3053065bf7f
79 changes: 34 additions & 45 deletions trunk/fs/xfs/linux-2.6/xfs_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,33 @@
#include <linux/kthread.h>
#include <linux/freezer.h>

STATIC int
xfs_inode_ag_walk_grab(
struct xfs_inode *ip)
{
struct inode *inode = VFS_I(ip);

/* nothing to sync during shutdown */
if (XFS_FORCED_SHUTDOWN(ip->i_mount))
return EFSCORRUPTED;

/* avoid new or reclaimable inodes. Leave for reclaim code to flush */
if (xfs_iflags_test(ip, XFS_INEW | XFS_IRECLAIMABLE | XFS_IRECLAIM))
return ENOENT;

/* If we can't grab the inode, it must on it's way to reclaim. */
if (!igrab(inode))
return ENOENT;

if (is_bad_inode(inode)) {
IRELE(ip);
return ENOENT;
}

/* inode is valid */
return 0;
}


STATIC int
xfs_inode_ag_walk(
Expand Down Expand Up @@ -80,8 +107,14 @@ xfs_inode_ag_walk(
if (first_index < XFS_INO_TO_AGINO(mp, ip->i_ino))
done = 1;

/* execute releases pag->pag_ici_lock */
if (xfs_inode_ag_walk_grab(ip)) {
read_unlock(&pag->pag_ici_lock);
continue;
}
read_unlock(&pag->pag_ici_lock);

error = execute(ip, pag, flags);
IRELE(ip);
if (error == EAGAIN) {
skipped++;
continue;
Expand Down Expand Up @@ -128,40 +161,6 @@ xfs_inode_ag_iterator(
return XFS_ERROR(last_error);
}

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

/* nothing to sync during shutdown */
if (XFS_FORCED_SHUTDOWN(ip->i_mount))
goto out_unlock;

/* avoid new or reclaimable inodes. Leave for reclaim code to flush */
error = ENOENT;
if (xfs_iflags_test(ip, XFS_INEW | XFS_IRECLAIMABLE | XFS_IRECLAIM))
goto out_unlock;

/* If we can't grab the inode, it must on it's way to reclaim. */
if (!igrab(inode))
goto out_unlock;

if (is_bad_inode(inode)) {
IRELE(ip);
goto out_unlock;
}

/* inode is valid */
error = 0;
out_unlock:
read_unlock(&pag->pag_ici_lock);
return error;
}

STATIC int
xfs_sync_inode_data(
struct xfs_inode *ip,
Expand All @@ -172,10 +171,6 @@ xfs_sync_inode_data(
struct address_space *mapping = inode->i_mapping;
int error = 0;

error = xfs_sync_inode_valid(ip, pag);
if (error)
return error;

if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
goto out_wait;

Expand All @@ -192,7 +187,6 @@ xfs_sync_inode_data(
out_wait:
if (flags & SYNC_WAIT)
xfs_ioend_wait(ip);
IRELE(ip);
return error;
}

Expand All @@ -204,10 +198,6 @@ xfs_sync_inode_attr(
{
int error = 0;

error = xfs_sync_inode_valid(ip, pag);
if (error)
return error;

xfs_ilock(ip, XFS_ILOCK_SHARED);
if (xfs_inode_clean(ip))
goto out_unlock;
Expand All @@ -226,7 +216,6 @@ xfs_sync_inode_attr(

out_unlock:
xfs_iunlock(ip, XFS_ILOCK_SHARED);
IRELE(ip);
return error;
}

Expand Down
9 changes: 0 additions & 9 deletions trunk/fs/xfs/quota/xfs_qm_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,21 +875,14 @@ xfs_dqrele_inode(
struct xfs_perag *pag,
int flags)
{
int error;

/* skip quota inodes */
if (ip == ip->i_mount->m_quotainfo->qi_uquotaip ||
ip == ip->i_mount->m_quotainfo->qi_gquotaip) {
ASSERT(ip->i_udquot == NULL);
ASSERT(ip->i_gdquot == NULL);
read_unlock(&pag->pag_ici_lock);
return 0;
}

error = xfs_sync_inode_valid(ip, pag);
if (error)
return error;

xfs_ilock(ip, XFS_ILOCK_EXCL);
if ((flags & XFS_UQUOTA_ACCT) && ip->i_udquot) {
xfs_qm_dqrele(ip->i_udquot);
Expand All @@ -900,8 +893,6 @@ xfs_dqrele_inode(
ip->i_gdquot = NULL;
}
xfs_iunlock(ip, XFS_ILOCK_EXCL);

IRELE(ip);
return 0;
}

Expand Down

0 comments on commit d3afa15

Please sign in to comment.