diff options
author | Dave Chinner <dchinner@redhat.com> | 2016-05-18 00:09:46 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-05-18 00:09:46 -0400 |
commit | 194293631d009254348f43710a7673bbb84a4172 (patch) | |
tree | b6793ca67c55e30b88c58792374cc0d39ce74f09 /fs/xfs/xfs_inode.c | |
parent | 5a90e53e8124d3ebe4b2a6309fa3c3225c23a62a (diff) |
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: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 6c746d79925e..54cc7b05708f 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -3162,16 +3162,16 @@ out_trans_cancel: | |||
3162 | 3162 | ||
3163 | STATIC int | 3163 | STATIC int |
3164 | xfs_iflush_cluster( | 3164 | xfs_iflush_cluster( |
3165 | xfs_inode_t *ip, | 3165 | struct xfs_inode *ip, |
3166 | xfs_buf_t *bp) | 3166 | struct xfs_buf *bp) |
3167 | { | 3167 | { |
3168 | xfs_mount_t *mp = ip->i_mount; | 3168 | struct xfs_mount *mp = ip->i_mount; |
3169 | struct xfs_perag *pag; | 3169 | struct xfs_perag *pag; |
3170 | unsigned long first_index, mask; | 3170 | unsigned long first_index, mask; |
3171 | unsigned long inodes_per_cluster; | 3171 | unsigned long inodes_per_cluster; |
3172 | int ilist_size; | 3172 | int cilist_size; |
3173 | xfs_inode_t **ilist; | 3173 | struct xfs_inode **cilist; |
3174 | xfs_inode_t *iq; | 3174 | struct xfs_inode *cip; |
3175 | int nr_found; | 3175 | int nr_found; |
3176 | int clcount = 0; | 3176 | int clcount = 0; |
3177 | int bufwasdelwri; | 3177 | int bufwasdelwri; |
@@ -3180,23 +3180,23 @@ xfs_iflush_cluster( | |||
3180 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); | 3180 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); |
3181 | 3181 | ||
3182 | inodes_per_cluster = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog; | 3182 | inodes_per_cluster = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog; |
3183 | ilist_size = inodes_per_cluster * sizeof(xfs_inode_t *); | 3183 | cilist_size = inodes_per_cluster * sizeof(xfs_inode_t *); |
3184 | ilist = kmem_alloc(ilist_size, KM_MAYFAIL|KM_NOFS); | 3184 | cilist = kmem_alloc(cilist_size, KM_MAYFAIL|KM_NOFS); |
3185 | if (!ilist) | 3185 | if (!cilist) |
3186 | goto out_put; | 3186 | goto out_put; |
3187 | 3187 | ||
3188 | mask = ~(((mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog)) - 1); | 3188 | mask = ~(((mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog)) - 1); |
3189 | first_index = XFS_INO_TO_AGINO(mp, ip->i_ino) & mask; | 3189 | first_index = XFS_INO_TO_AGINO(mp, ip->i_ino) & mask; |
3190 | rcu_read_lock(); | 3190 | rcu_read_lock(); |
3191 | /* really need a gang lookup range call here */ | 3191 | /* really need a gang lookup range call here */ |
3192 | nr_found = radix_tree_gang_lookup(&pag->pag_ici_root, (void**)ilist, | 3192 | nr_found = radix_tree_gang_lookup(&pag->pag_ici_root, (void**)cilist, |
3193 | first_index, inodes_per_cluster); | 3193 | first_index, inodes_per_cluster); |
3194 | if (nr_found == 0) | 3194 | if (nr_found == 0) |
3195 | goto out_free; | 3195 | goto out_free; |
3196 | 3196 | ||
3197 | for (i = 0; i < nr_found; i++) { | 3197 | for (i = 0; i < nr_found; i++) { |
3198 | iq = ilist[i]; | 3198 | cip = cilist[i]; |
3199 | if (iq == ip) | 3199 | if (cip == ip) |
3200 | continue; | 3200 | continue; |
3201 | 3201 | ||
3202 | /* | 3202 | /* |
@@ -3205,10 +3205,10 @@ xfs_iflush_cluster( | |||
3205 | * We need to check under the i_flags_lock for a valid inode | 3205 | * We need to check under the i_flags_lock for a valid inode |
3206 | * here. Skip it if it is not valid or the wrong inode. | 3206 | * here. Skip it if it is not valid or the wrong inode. |
3207 | */ | 3207 | */ |
3208 | spin_lock(&iq->i_flags_lock); | 3208 | spin_lock(&cip->i_flags_lock); |
3209 | if (!iq->i_ino || | 3209 | if (!cip->i_ino || |
3210 | __xfs_iflags_test(iq, XFS_ISTALE)) { | 3210 | __xfs_iflags_test(cip, XFS_ISTALE)) { |
3211 | spin_unlock(&iq->i_flags_lock); | 3211 | spin_unlock(&cip->i_flags_lock); |
3212 | continue; | 3212 | continue; |
3213 | } | 3213 | } |
3214 | 3214 | ||
@@ -3217,18 +3217,18 @@ xfs_iflush_cluster( | |||
3217 | * any more inodes in the list because they will also all be | 3217 | * any more inodes in the list because they will also all be |
3218 | * outside the cluster. | 3218 | * outside the cluster. |
3219 | */ | 3219 | */ |
3220 | if ((XFS_INO_TO_AGINO(mp, iq->i_ino) & mask) != first_index) { | 3220 | if ((XFS_INO_TO_AGINO(mp, cip->i_ino) & mask) != first_index) { |
3221 | spin_unlock(&iq->i_flags_lock); | 3221 | spin_unlock(&cip->i_flags_lock); |
3222 | break; | 3222 | break; |
3223 | } | 3223 | } |
3224 | spin_unlock(&iq->i_flags_lock); | 3224 | spin_unlock(&cip->i_flags_lock); |
3225 | 3225 | ||
3226 | /* | 3226 | /* |
3227 | * Do an un-protected check to see if the inode is dirty and | 3227 | * Do an un-protected check to see if the inode is dirty and |
3228 | * is a candidate for flushing. These checks will be repeated | 3228 | * is a candidate for flushing. These checks will be repeated |
3229 | * later after the appropriate locks are acquired. | 3229 | * later after the appropriate locks are acquired. |
3230 | */ | 3230 | */ |
3231 | if (xfs_inode_clean(iq) && xfs_ipincount(iq) == 0) | 3231 | if (xfs_inode_clean(cip) && xfs_ipincount(cip) == 0) |
3232 | continue; | 3232 | continue; |
3233 | 3233 | ||
3234 | /* | 3234 | /* |
@@ -3236,15 +3236,15 @@ xfs_iflush_cluster( | |||
3236 | * then this inode cannot be flushed and is skipped. | 3236 | * then this inode cannot be flushed and is skipped. |
3237 | */ | 3237 | */ |
3238 | 3238 | ||
3239 | if (!xfs_ilock_nowait(iq, XFS_ILOCK_SHARED)) | 3239 | if (!xfs_ilock_nowait(cip, XFS_ILOCK_SHARED)) |
3240 | continue; | 3240 | continue; |
3241 | if (!xfs_iflock_nowait(iq)) { | 3241 | if (!xfs_iflock_nowait(cip)) { |
3242 | xfs_iunlock(iq, XFS_ILOCK_SHARED); | 3242 | xfs_iunlock(cip, XFS_ILOCK_SHARED); |
3243 | continue; | 3243 | continue; |
3244 | } | 3244 | } |
3245 | if (xfs_ipincount(iq)) { | 3245 | if (xfs_ipincount(cip)) { |
3246 | xfs_ifunlock(iq); | 3246 | xfs_ifunlock(cip); |
3247 | xfs_iunlock(iq, XFS_ILOCK_SHARED); | 3247 | xfs_iunlock(cip, XFS_ILOCK_SHARED); |
3248 | continue; | 3248 | continue; |
3249 | } | 3249 | } |
3250 | 3250 | ||
@@ -3255,9 +3255,9 @@ xfs_iflush_cluster( | |||
3255 | * in that function for more information as to why the initial | 3255 | * in that function for more information as to why the initial |
3256 | * check is not sufficient. | 3256 | * check is not sufficient. |
3257 | */ | 3257 | */ |
3258 | if (!iq->i_ino) { | 3258 | if (!cip->i_ino) { |
3259 | xfs_ifunlock(iq); | 3259 | xfs_ifunlock(cip); |
3260 | xfs_iunlock(iq, XFS_ILOCK_SHARED); | 3260 | xfs_iunlock(cip, XFS_ILOCK_SHARED); |
3261 | continue; | 3261 | continue; |
3262 | } | 3262 | } |
3263 | 3263 | ||
@@ -3265,18 +3265,18 @@ xfs_iflush_cluster( | |||
3265 | * arriving here means that this inode can be flushed. First | 3265 | * arriving here means that this inode can be flushed. First |
3266 | * re-check that it's dirty before flushing. | 3266 | * re-check that it's dirty before flushing. |
3267 | */ | 3267 | */ |
3268 | if (!xfs_inode_clean(iq)) { | 3268 | if (!xfs_inode_clean(cip)) { |
3269 | int error; | 3269 | int error; |
3270 | error = xfs_iflush_int(iq, bp); | 3270 | error = xfs_iflush_int(cip, bp); |
3271 | if (error) { | 3271 | if (error) { |
3272 | xfs_iunlock(iq, XFS_ILOCK_SHARED); | 3272 | xfs_iunlock(cip, XFS_ILOCK_SHARED); |
3273 | goto cluster_corrupt_out; | 3273 | goto cluster_corrupt_out; |
3274 | } | 3274 | } |
3275 | clcount++; | 3275 | clcount++; |
3276 | } else { | 3276 | } else { |
3277 | xfs_ifunlock(iq); | 3277 | xfs_ifunlock(cip); |
3278 | } | 3278 | } |
3279 | xfs_iunlock(iq, XFS_ILOCK_SHARED); | 3279 | xfs_iunlock(cip, XFS_ILOCK_SHARED); |
3280 | } | 3280 | } |
3281 | 3281 | ||
3282 | if (clcount) { | 3282 | if (clcount) { |
@@ -3286,7 +3286,7 @@ xfs_iflush_cluster( | |||
3286 | 3286 | ||
3287 | out_free: | 3287 | out_free: |
3288 | rcu_read_unlock(); | 3288 | rcu_read_unlock(); |
3289 | kmem_free(ilist); | 3289 | kmem_free(cilist); |
3290 | out_put: | 3290 | out_put: |
3291 | xfs_perag_put(pag); | 3291 | xfs_perag_put(pag); |
3292 | return 0; | 3292 | return 0; |
@@ -3329,8 +3329,8 @@ cluster_corrupt_out: | |||
3329 | /* | 3329 | /* |
3330 | * Unlocks the flush lock | 3330 | * Unlocks the flush lock |
3331 | */ | 3331 | */ |
3332 | xfs_iflush_abort(iq, false); | 3332 | xfs_iflush_abort(cip, false); |
3333 | kmem_free(ilist); | 3333 | kmem_free(cilist); |
3334 | xfs_perag_put(pag); | 3334 | xfs_perag_put(pag); |
3335 | return -EFSCORRUPTED; | 3335 | return -EFSCORRUPTED; |
3336 | } | 3336 | } |