Skip to content

Commit 18c6139

Browse files
mjguzikbrauner
authored andcommitted
xfs: use the new ->i_state accessors
Change generated with coccinelle and fixed up by hand as appropriate. Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent a18d430 commit 18c6139

10 files changed

Lines changed: 16 additions & 16 deletions

File tree

fs/xfs/scrub/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,7 @@ xchk_irele(
12491249
* hits do not clear DONTCACHE, so we must do it here.
12501250
*/
12511251
spin_lock(&VFS_I(ip)->i_lock);
1252-
VFS_I(ip)->i_state &= ~I_DONTCACHE;
1252+
inode_state_clear(VFS_I(ip), I_DONTCACHE);
12531253
spin_unlock(&VFS_I(ip)->i_lock);
12541254
}
12551255

fs/xfs/scrub/inode_repair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1933,7 +1933,7 @@ xrep_inode_pptr(
19331933
* Unlinked inodes that cannot be added to the directory tree will not
19341934
* have a parent pointer.
19351935
*/
1936-
if (inode->i_nlink == 0 && !(inode->i_state & I_LINKABLE))
1936+
if (inode->i_nlink == 0 && !(inode_state_read_once(inode) & I_LINKABLE))
19371937
return 0;
19381938

19391939
/* Children of the superblock do not have parent pointers. */

fs/xfs/scrub/parent.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ xchk_pptr_looks_zapped(
915915
* Temporary files that cannot be linked into the directory tree do not
916916
* have attr forks because they cannot ever have parents.
917917
*/
918-
if (inode->i_nlink == 0 && !(inode->i_state & I_LINKABLE))
918+
if (inode->i_nlink == 0 && !(inode_state_read_once(inode) & I_LINKABLE))
919919
return false;
920920

921921
/*

fs/xfs/xfs_bmap_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ xfs_can_free_eofblocks(
514514
* Caller must either hold the exclusive io lock; or be inactivating
515515
* the inode, which guarantees there are no other users of the inode.
516516
*/
517-
if (!(VFS_I(ip)->i_state & I_FREEING))
517+
if (!(inode_state_read_once(VFS_I(ip)) & I_FREEING))
518518
xfs_assert_ilocked(ip, XFS_IOLOCK_EXCL);
519519

520520
/* prealloc/delalloc exists only on regular files */

fs/xfs/xfs_health.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ xfs_inode_mark_sick(
285285
* is not the case here.
286286
*/
287287
spin_lock(&VFS_I(ip)->i_lock);
288-
VFS_I(ip)->i_state &= ~I_DONTCACHE;
288+
inode_state_clear(VFS_I(ip), I_DONTCACHE);
289289
spin_unlock(&VFS_I(ip)->i_lock);
290290
}
291291

@@ -309,7 +309,7 @@ xfs_inode_mark_corrupt(
309309
* is not the case here.
310310
*/
311311
spin_lock(&VFS_I(ip)->i_lock);
312-
VFS_I(ip)->i_state &= ~I_DONTCACHE;
312+
inode_state_clear(VFS_I(ip), I_DONTCACHE);
313313
spin_unlock(&VFS_I(ip)->i_lock);
314314
}
315315

fs/xfs/xfs_icache.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ xfs_reinit_inode(
334334
dev_t dev = inode->i_rdev;
335335
kuid_t uid = inode->i_uid;
336336
kgid_t gid = inode->i_gid;
337-
unsigned long state = inode->i_state;
337+
unsigned long state = inode_state_read_once(inode);
338338

339339
error = inode_init_always(mp->m_super, inode);
340340

@@ -345,7 +345,7 @@ xfs_reinit_inode(
345345
inode->i_rdev = dev;
346346
inode->i_uid = uid;
347347
inode->i_gid = gid;
348-
inode->i_state = state;
348+
inode_state_assign_raw(inode, state);
349349
mapping_set_folio_min_order(inode->i_mapping,
350350
M_IGEO(mp)->min_folio_order);
351351
return error;
@@ -411,7 +411,7 @@ xfs_iget_recycle(
411411
ip->i_flags |= XFS_INEW;
412412
xfs_perag_clear_inode_tag(pag, XFS_INO_TO_AGINO(mp, ip->i_ino),
413413
XFS_ICI_RECLAIM_TAG);
414-
inode->i_state = I_NEW;
414+
inode_state_assign_raw(inode, I_NEW);
415415
spin_unlock(&ip->i_flags_lock);
416416
spin_unlock(&pag->pag_ici_lock);
417417

fs/xfs/xfs_inode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ xfs_iunlink_reload_next(
15801580
next_ip->i_prev_unlinked = prev_agino;
15811581
trace_xfs_iunlink_reload_next(next_ip);
15821582
rele:
1583-
ASSERT(!(VFS_I(next_ip)->i_state & I_DONTCACHE));
1583+
ASSERT(!(inode_state_read_once(VFS_I(next_ip)) & I_DONTCACHE));
15841584
if (xfs_is_quotacheck_running(mp) && next_ip)
15851585
xfs_iflags_set(next_ip, XFS_IQUOTAUNCHECKED);
15861586
xfs_irele(next_ip);
@@ -2111,7 +2111,7 @@ xfs_rename_alloc_whiteout(
21112111
*/
21122112
xfs_setup_iops(tmpfile);
21132113
xfs_finish_inode_setup(tmpfile);
2114-
VFS_I(tmpfile)->i_state |= I_LINKABLE;
2114+
inode_state_set_raw(VFS_I(tmpfile), I_LINKABLE);
21152115

21162116
*wip = tmpfile;
21172117
return 0;
@@ -2330,7 +2330,7 @@ xfs_rename(
23302330
* flag from the inode so it doesn't accidentally get misused in
23312331
* future.
23322332
*/
2333-
VFS_I(du_wip.ip)->i_state &= ~I_LINKABLE;
2333+
inode_state_clear_raw(VFS_I(du_wip.ip), I_LINKABLE);
23342334
}
23352335

23362336
out_commit:

fs/xfs/xfs_inode_item.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ xfs_inode_item_precommit(
113113
* to log the timestamps, or will clear already cleared fields in the
114114
* worst case.
115115
*/
116-
if (inode->i_state & I_DIRTY_TIME) {
116+
if (inode_state_read_once(inode) & I_DIRTY_TIME) {
117117
spin_lock(&inode->i_lock);
118-
inode->i_state &= ~I_DIRTY_TIME;
118+
inode_state_clear(inode, I_DIRTY_TIME);
119119
spin_unlock(&inode->i_lock);
120120
}
121121

fs/xfs/xfs_iops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ xfs_setup_inode(
14201420
bool is_meta = xfs_is_internal_inode(ip);
14211421

14221422
inode->i_ino = ip->i_ino;
1423-
inode->i_state |= I_NEW;
1423+
inode_state_set_raw(inode, I_NEW);
14241424

14251425
inode_sb_list_add(inode);
14261426
/* make the inode look hashed for the writeback code */

fs/xfs/xfs_reflink.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ xfs_can_free_cowblocks(struct xfs_inode *ip)
1717
{
1818
struct inode *inode = VFS_I(ip);
1919

20-
if ((inode->i_state & I_DIRTY_PAGES) ||
20+
if ((inode_state_read_once(inode) & I_DIRTY_PAGES) ||
2121
mapping_tagged(inode->i_mapping, PAGECACHE_TAG_DIRTY) ||
2222
mapping_tagged(inode->i_mapping, PAGECACHE_TAG_WRITEBACK) ||
2323
atomic_read(&inode->i_dio_count))

0 commit comments

Comments
 (0)