提交 19429363 编写于 作者: D Dave Chinner 提交者: Dave Chinner

xfs: rename variables in xfs_iflush_cluster for clarity

The cluster inode variable uses unconventional naming - iq - which
makes it hard to distinguish it between the inode passed into the
function - ip - and that is a vector for mistakes to be made.
Rename all the cluster inode variables to use a more conventional
prefixes to reduce potential future confusion (cilist, cilist_size,
cip).
Signed-off-by: NDave Chinner <dchinner@redhat.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NDave Chinner <david@fromorbit.com>
上级 5a90e53e
...@@ -3162,16 +3162,16 @@ xfs_rename( ...@@ -3162,16 +3162,16 @@ xfs_rename(
STATIC int STATIC int
xfs_iflush_cluster( xfs_iflush_cluster(
xfs_inode_t *ip, struct xfs_inode *ip,
xfs_buf_t *bp) struct xfs_buf *bp)
{ {
xfs_mount_t *mp = ip->i_mount; struct xfs_mount *mp = ip->i_mount;
struct xfs_perag *pag; struct xfs_perag *pag;
unsigned long first_index, mask; unsigned long first_index, mask;
unsigned long inodes_per_cluster; unsigned long inodes_per_cluster;
int ilist_size; int cilist_size;
xfs_inode_t **ilist; struct xfs_inode **cilist;
xfs_inode_t *iq; struct xfs_inode *cip;
int nr_found; int nr_found;
int clcount = 0; int clcount = 0;
int bufwasdelwri; int bufwasdelwri;
...@@ -3180,23 +3180,23 @@ xfs_iflush_cluster( ...@@ -3180,23 +3180,23 @@ xfs_iflush_cluster(
pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
inodes_per_cluster = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog; inodes_per_cluster = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog;
ilist_size = inodes_per_cluster * sizeof(xfs_inode_t *); cilist_size = inodes_per_cluster * sizeof(xfs_inode_t *);
ilist = kmem_alloc(ilist_size, KM_MAYFAIL|KM_NOFS); cilist = kmem_alloc(cilist_size, KM_MAYFAIL|KM_NOFS);
if (!ilist) if (!cilist)
goto out_put; goto out_put;
mask = ~(((mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog)) - 1); mask = ~(((mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog)) - 1);
first_index = XFS_INO_TO_AGINO(mp, ip->i_ino) & mask; first_index = XFS_INO_TO_AGINO(mp, ip->i_ino) & mask;
rcu_read_lock(); rcu_read_lock();
/* really need a gang lookup range call here */ /* really need a gang lookup range call here */
nr_found = radix_tree_gang_lookup(&pag->pag_ici_root, (void**)ilist, nr_found = radix_tree_gang_lookup(&pag->pag_ici_root, (void**)cilist,
first_index, inodes_per_cluster); first_index, inodes_per_cluster);
if (nr_found == 0) if (nr_found == 0)
goto out_free; goto out_free;
for (i = 0; i < nr_found; i++) { for (i = 0; i < nr_found; i++) {
iq = ilist[i]; cip = cilist[i];
if (iq == ip) if (cip == ip)
continue; continue;
/* /*
...@@ -3205,10 +3205,10 @@ xfs_iflush_cluster( ...@@ -3205,10 +3205,10 @@ xfs_iflush_cluster(
* We need to check under the i_flags_lock for a valid inode * We need to check under the i_flags_lock for a valid inode
* here. Skip it if it is not valid or the wrong inode. * here. Skip it if it is not valid or the wrong inode.
*/ */
spin_lock(&iq->i_flags_lock); spin_lock(&cip->i_flags_lock);
if (!iq->i_ino || if (!cip->i_ino ||
__xfs_iflags_test(iq, XFS_ISTALE)) { __xfs_iflags_test(cip, XFS_ISTALE)) {
spin_unlock(&iq->i_flags_lock); spin_unlock(&cip->i_flags_lock);
continue; continue;
} }
...@@ -3217,18 +3217,18 @@ xfs_iflush_cluster( ...@@ -3217,18 +3217,18 @@ xfs_iflush_cluster(
* any more inodes in the list because they will also all be * any more inodes in the list because they will also all be
* outside the cluster. * outside the cluster.
*/ */
if ((XFS_INO_TO_AGINO(mp, iq->i_ino) & mask) != first_index) { if ((XFS_INO_TO_AGINO(mp, cip->i_ino) & mask) != first_index) {
spin_unlock(&iq->i_flags_lock); spin_unlock(&cip->i_flags_lock);
break; break;
} }
spin_unlock(&iq->i_flags_lock); spin_unlock(&cip->i_flags_lock);
/* /*
* Do an un-protected check to see if the inode is dirty and * Do an un-protected check to see if the inode is dirty and
* is a candidate for flushing. These checks will be repeated * is a candidate for flushing. These checks will be repeated
* later after the appropriate locks are acquired. * later after the appropriate locks are acquired.
*/ */
if (xfs_inode_clean(iq) && xfs_ipincount(iq) == 0) if (xfs_inode_clean(cip) && xfs_ipincount(cip) == 0)
continue; continue;
/* /*
...@@ -3236,15 +3236,15 @@ xfs_iflush_cluster( ...@@ -3236,15 +3236,15 @@ xfs_iflush_cluster(
* then this inode cannot be flushed and is skipped. * then this inode cannot be flushed and is skipped.
*/ */
if (!xfs_ilock_nowait(iq, XFS_ILOCK_SHARED)) if (!xfs_ilock_nowait(cip, XFS_ILOCK_SHARED))
continue; continue;
if (!xfs_iflock_nowait(iq)) { if (!xfs_iflock_nowait(cip)) {
xfs_iunlock(iq, XFS_ILOCK_SHARED); xfs_iunlock(cip, XFS_ILOCK_SHARED);
continue; continue;
} }
if (xfs_ipincount(iq)) { if (xfs_ipincount(cip)) {
xfs_ifunlock(iq); xfs_ifunlock(cip);
xfs_iunlock(iq, XFS_ILOCK_SHARED); xfs_iunlock(cip, XFS_ILOCK_SHARED);
continue; continue;
} }
...@@ -3255,9 +3255,9 @@ xfs_iflush_cluster( ...@@ -3255,9 +3255,9 @@ xfs_iflush_cluster(
* in that function for more information as to why the initial * in that function for more information as to why the initial
* check is not sufficient. * check is not sufficient.
*/ */
if (!iq->i_ino) { if (!cip->i_ino) {
xfs_ifunlock(iq); xfs_ifunlock(cip);
xfs_iunlock(iq, XFS_ILOCK_SHARED); xfs_iunlock(cip, XFS_ILOCK_SHARED);
continue; continue;
} }
...@@ -3265,18 +3265,18 @@ xfs_iflush_cluster( ...@@ -3265,18 +3265,18 @@ xfs_iflush_cluster(
* arriving here means that this inode can be flushed. First * arriving here means that this inode can be flushed. First
* re-check that it's dirty before flushing. * re-check that it's dirty before flushing.
*/ */
if (!xfs_inode_clean(iq)) { if (!xfs_inode_clean(cip)) {
int error; int error;
error = xfs_iflush_int(iq, bp); error = xfs_iflush_int(cip, bp);
if (error) { if (error) {
xfs_iunlock(iq, XFS_ILOCK_SHARED); xfs_iunlock(cip, XFS_ILOCK_SHARED);
goto cluster_corrupt_out; goto cluster_corrupt_out;
} }
clcount++; clcount++;
} else { } else {
xfs_ifunlock(iq); xfs_ifunlock(cip);
} }
xfs_iunlock(iq, XFS_ILOCK_SHARED); xfs_iunlock(cip, XFS_ILOCK_SHARED);
} }
if (clcount) { if (clcount) {
...@@ -3286,7 +3286,7 @@ xfs_iflush_cluster( ...@@ -3286,7 +3286,7 @@ xfs_iflush_cluster(
out_free: out_free:
rcu_read_unlock(); rcu_read_unlock();
kmem_free(ilist); kmem_free(cilist);
out_put: out_put:
xfs_perag_put(pag); xfs_perag_put(pag);
return 0; return 0;
...@@ -3329,8 +3329,8 @@ xfs_iflush_cluster( ...@@ -3329,8 +3329,8 @@ xfs_iflush_cluster(
/* /*
* Unlocks the flush lock * Unlocks the flush lock
*/ */
xfs_iflush_abort(iq, false); xfs_iflush_abort(cip, false);
kmem_free(ilist); kmem_free(cilist);
xfs_perag_put(pag); xfs_perag_put(pag);
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册