From nobody Thu Oct 2 14:24:03 2025 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B306321456 for ; Tue, 16 Sep 2025 13:59:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758031187; cv=none; b=rVlMsoG1qAsczzYJ5epiTMA6keinlANWOraTXwxlI/jj+MWpI4SOi35ruW2ESo2BjZ6qawHvEYDLMn9u6mucsyRSRGEyt2x/Rl6zWX1hhltcousdeL9Sd7Z8e8KYuf8aUbIEgwxSYZGj8YmrMllexTsu5fEfj3bvWGNpXWLkqwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758031187; c=relaxed/simple; bh=qt/YFUMkKt8IA45+qE2taOxYKW10Ub+uwNHV94/ZlR4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LBkNmQzj1EUiZnlfjdK8rrQNpABYtTki6i8gs5BHfKqHdLqw3o8R2A6659XusZgcFqAM6LquYn7BDD5i+ICr7hjEzkCMSyz9sJppegV4mp9JMdmEQggJ8BIvHC1ZhWigUNW2l54sD+qqi0Ues4lgCDDBjQAqs1H8u5uTkAaW+Xk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Dec1Bfed; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Dec1Bfed" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-460e01ee031so614475e9.2 for ; Tue, 16 Sep 2025 06:59:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758031178; x=1758635978; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LdH6hYb9zcGIjyPlmmt41hP/wfdaqw8hE+DlLYlc4Lc=; b=Dec1BfedZ7duES8P8UN3ol+rCuoTJ+Judx2NMwgLpyigROxjNd4iheQaDyUnbFhl8j sgERUZHx3b4arHs1DqoHbtjw+HONnzf8HpFBRWDpiC9j/GA/clsfgruN5K/u/GEAhRp+ szW0Y7vRa22iT/dx+G5vesE8VRYb9lwIv3TYTXLOBqEubXIDmw9Vk6APGCTxKWXbRd3J zmS/Et+QDtbgqRLZ88WTPK3aFXJ8Ha4MaTsjHoq+MmgL98XkZTLxhQsX5CKkCSzUQ8Ou 74YlLFhxjmH0C0g0ggTEaDJh4nUkJm8fVbIh5vycHyYDKazBLGCvPPoTclz+egZsC+Yt ryHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758031178; x=1758635978; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LdH6hYb9zcGIjyPlmmt41hP/wfdaqw8hE+DlLYlc4Lc=; b=bEbnkowRoZezkrgx/zjr10110U65JZW2RoGRyIBMcd4BvyKYQwetnk79N2g8+HIGP5 zsD9U6u4732REyy0ez9xKuT54x802Eed0PtqcHYZ3weDjfbheKes4bSWvc3+e3A7ocnx fxJNqKHn7oBLTp7PW/EupA5TsW3XDd8aE6Vd1d1eukSUvdFtdPPTZt94yvMNMQhsIr0t 6ZnE8Opm5CpBQ6Uru33Kh9aKverrjQ1uzWECYq+gJUseSoWP/G5B/eY5OMRJ7Vuq3ctw vhXGJeuDVQZPRxNceIsuAUtcTJ/pJfwJnDo3OWccdf+ulLQqFXcAtlTn9g8Ua7RVrRkd Sl5Q== X-Forwarded-Encrypted: i=1; AJvYcCUL2hpIMRotLmB0pAk7Su9cNXjoSX/UnVgVlWDovcdtn89Q6E6ncBgf03I9e/qkNvw/aWErf34vNy5I3UQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw61mwuA1fzcK23ASv15kmPmAv1mPdihH05dKfOLe6rNQ801TRI +mF5CUQUcdGy+3pH1Oz0EBctD0uZD3h/yKYXbcV3rvGL5QtL25pEKqOb X-Gm-Gg: ASbGnctirOe1xZAaU7mBzFGg9X0divJbUM348KcxuT+BMd8Ka43w38kb/PqxBRWqY/M 6li4mCiFPp65yrlQFLrHOEcDG+8DJGJfPwXJyhHADXHOuOewE5vEFC/WWwyUIw9pFeaPf8ms7mo GbGWrLIGd59vgS9ZinSRsksRm0p7FPAWiFTi2gFp36paxp0HbYjrN8YQPcGZfGfR8VbafoPFKs+ a+9pIRx+V5P+BCxmN6XTsdUYSDzCnyR+SXRE4U0thqgTJYF4XZL/fFLHhtrPmous/+MoEmzdmbv t300HbjwBkVE02/xvf/ra6IqAVJxcpEdjFyll1a1xyBmzYnEuEzXaJBvgZYi4/KH57dcwQkPI9m /czr3KmQqIcvmoZ89ylmlR1T7qsHnIAiTtV4McHXfMPJQ+f70hr8QYLx+C6cx2E+bgrGb5PNN X-Google-Smtp-Source: AGHT+IFjSe0p9uGvCdqarbYDqX67a8jlLsyS6XVRIE5LQEMQR8Zjxl6EiH+L2syMsSzuRb+I8kSsjQ== X-Received: by 2002:a05:6000:144c:b0:3eb:f90a:f6cd with SMTP id ffacd0b85a97d-3ebf90af732mr4593567f8f.60.1758031178093; Tue, 16 Sep 2025 06:59:38 -0700 (PDT) Received: from f.. (cst-prg-88-146.cust.vodafone.cz. [46.135.88.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3e7cde81491sm16557991f8f.42.2025.09.16.06.59.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Sep 2025 06:59:37 -0700 (PDT) From: Mateusz Guzik To: brauner@kernel.org Cc: viro@zeniv.linux.org.uk, jack@suse.cz, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, josef@toxicpanda.com, kernel-team@fb.com, amir73il@gmail.com, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, ceph-devel@vger.kernel.org, linux-unionfs@vger.kernel.org, Mateusz Guzik Subject: [PATCH v4 03/12] fs: mechanically convert most filesystems to use ->i_state accessors Date: Tue, 16 Sep 2025 15:58:51 +0200 Message-ID: <20250916135900.2170346-4-mjguzik@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250916135900.2170346-1-mjguzik@gmail.com> References: <20250916135900.2170346-1-mjguzik@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Change generated with coccinelle and fixed up by hand as appropriate. Signed-off-by: Mateusz Guzik --- cheat sheet: Suppose flags I_A and I_B are to be handled, then if ->i_lock is held: state =3D inode->i_state =3D> state =3D inode_state_read(inode) inode->i_state |=3D (I_A | I_B) =3D> inode_state_add(inode, I_A | I_B) inode->i_state &=3D ~(I_A | I_B) =3D> inode_state_del(inode, I_A | I_B) inode->i_state =3D I_A | I_B =3D> inode_state_set(inode, I_A | I_B) If ->i_lock is not held or only held conditionally, add "_once" suffix for the read routine or "_raw" for the rest: state =3D inode->i_state =3D> state =3D inode_state_read_once(inod= e) inode->i_state |=3D (I_A | I_B) =3D> inode_state_add_raw(inode, I_A | I_B) inode->i_state &=3D ~(I_A | I_B) =3D> inode_state_del_raw(inode, I_A | I_B) inode->i_state =3D I_A | I_B =3D> inode_state_set_raw(inode, I_A | I_B) fs/9p/vfs_inode.c | 2 +- fs/9p/vfs_inode_dotl.c | 2 +- fs/affs/inode.c | 2 +- fs/afs/dynroot.c | 6 +++--- fs/afs/inode.c | 8 ++++---- fs/bcachefs/fs.c | 7 +++---- fs/befs/linuxvfs.c | 2 +- fs/bfs/inode.c | 2 +- fs/coda/cnode.c | 4 ++-- fs/cramfs/inode.c | 2 +- fs/ecryptfs/inode.c | 6 +++--- fs/efs/inode.c | 2 +- fs/erofs/inode.c | 2 +- fs/ext2/inode.c | 2 +- fs/freevxfs/vxfs_inode.c | 2 +- fs/fuse/inode.c | 4 ++-- fs/gfs2/file.c | 2 +- fs/gfs2/glops.c | 2 +- fs/gfs2/inode.c | 4 ++-- fs/gfs2/ops_fstype.c | 2 +- fs/hfs/btree.c | 2 +- fs/hfs/inode.c | 2 +- fs/hfsplus/super.c | 2 +- fs/hostfs/hostfs_kern.c | 2 +- fs/hpfs/dir.c | 2 +- fs/hpfs/inode.c | 2 +- fs/isofs/inode.c | 2 +- fs/jffs2/fs.c | 4 ++-- fs/jfs/file.c | 4 ++-- fs/jfs/inode.c | 2 +- fs/jfs/jfs_txnmgr.c | 2 +- fs/kernfs/inode.c | 2 +- fs/minix/inode.c | 2 +- fs/nfs/inode.c | 2 +- fs/nfs/pnfs.c | 2 +- fs/nfsd/vfs.c | 2 +- fs/ntfs3/inode.c | 2 +- fs/ocfs2/dlmglue.c | 2 +- fs/ocfs2/inode.c | 10 +++++----- fs/omfs/inode.c | 2 +- fs/openpromfs/inode.c | 2 +- fs/orangefs/inode.c | 2 +- fs/orangefs/orangefs-utils.c | 6 +++--- fs/qnx4/inode.c | 2 +- fs/qnx6/inode.c | 2 +- fs/romfs/super.c | 2 +- fs/smb/client/cifsfs.c | 2 +- fs/smb/client/inode.c | 14 +++++++------- fs/squashfs/inode.c | 2 +- fs/ubifs/file.c | 2 +- fs/ubifs/super.c | 2 +- fs/udf/inode.c | 2 +- fs/ufs/inode.c | 2 +- fs/zonefs/super.c | 4 ++-- 54 files changed, 81 insertions(+), 82 deletions(-) diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 399d455d50d6..a257833d4d15 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -422,7 +422,7 @@ static struct inode *v9fs_qid_iget(struct super_block *= sb, inode =3D iget5_locked(sb, QID2INO(qid), test, v9fs_set_inode, st); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; /* * initialize the inode with the stat info diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 5b5fda617b80..f99ecf002d34 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -112,7 +112,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_bl= ock *sb, inode =3D iget5_locked(sb, QID2INO(qid), test, v9fs_set_inode_dotl, st); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; /* * initialize the inode with the stat info diff --git a/fs/affs/inode.c b/fs/affs/inode.c index 0210df8d3500..0bfc7d151dcd 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c @@ -29,7 +29,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned = long ino) inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 pr_debug("affs_iget(%lu)\n", inode->i_ino); diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c index 8c6130789fde..475012555100 100644 --- a/fs/afs/dynroot.c +++ b/fs/afs/dynroot.c @@ -64,7 +64,7 @@ static struct inode *afs_iget_pseudo_dir(struct super_blo= ck *sb, ino_t ino) =20 vnode =3D AFS_FS_I(inode); =20 - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { netfs_inode_init(&vnode->netfs, NULL, false); simple_inode_init_ts(inode); set_nlink(inode, 2); @@ -258,7 +258,7 @@ static struct dentry *afs_lookup_atcell(struct inode *d= ir, struct dentry *dentry =20 vnode =3D AFS_FS_I(inode); =20 - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { netfs_inode_init(&vnode->netfs, NULL, false); simple_inode_init_ts(inode); set_nlink(inode, 1); @@ -383,7 +383,7 @@ struct inode *afs_dynroot_iget_root(struct super_block = *sb) vnode =3D AFS_FS_I(inode); =20 /* there shouldn't be an existing inode */ - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { netfs_inode_init(&vnode->netfs, NULL, false); simple_inode_init_ts(inode); set_nlink(inode, 2); diff --git a/fs/afs/inode.c b/fs/afs/inode.c index e9538e91f848..92becefc3bbf 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c @@ -427,7 +427,7 @@ static void afs_fetch_status_success(struct afs_operati= on *op) struct afs_vnode *vnode =3D vp->vnode; int ret; =20 - if (vnode->netfs.inode.i_state & I_NEW) { + if (inode_state_read_once(&vnode->netfs.inode) & I_NEW) { ret =3D afs_inode_init_from_status(op, vp, vnode); afs_op_set_error(op, ret); if (ret =3D=3D 0) @@ -579,7 +579,7 @@ struct inode *afs_iget(struct afs_operation *op, struct= afs_vnode_param *vp) inode, vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique); =20 /* deal with an existing inode */ - if (!(inode->i_state & I_NEW)) { + if (!(inode_state_read_once(inode) & I_NEW)) { _leave(" =3D %p", inode); return inode; } @@ -639,7 +639,7 @@ struct inode *afs_root_iget(struct super_block *sb, str= uct key *key) =20 _debug("GOT ROOT INODE %p { vl=3D%llx }", inode, as->volume->vid); =20 - BUG_ON(!(inode->i_state & I_NEW)); + BUG_ON(!(inode_state_read_once(inode) & I_NEW)); =20 vnode =3D AFS_FS_I(inode); vnode->cb_v_check =3D atomic_read(&as->volume->cb_v_break); @@ -748,7 +748,7 @@ void afs_evict_inode(struct inode *inode) =20 if ((S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) && - (inode->i_state & I_DIRTY) && + (inode_state_read_once(inode) & I_DIRTY) && !sbi->dyn_root) { struct writeback_control wbc =3D { .sync_mode =3D WB_SYNC_ALL, diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index 687af0eea0c2..f03b02ff3e76 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -347,7 +347,7 @@ static struct bch_inode_info *bch2_inode_hash_find(stru= ct bch_fs *c, struct btre spin_unlock(&inode->v.i_lock); return NULL; } - if ((inode->v.i_state & (I_FREEING|I_WILL_FREE))) { + if ((inode_state_read(&inode->v) & (I_FREEING|I_WILL_FREE))) { if (!trans) { __wait_on_freeing_inode(c, inode, inum); } else { @@ -411,7 +411,7 @@ static struct bch_inode_info *bch2_inode_hash_insert(st= ruct bch_fs *c, * only insert fully created inodes in the inode hash table. But * discard_new_inode() expects it to be set... */ - inode->v.i_state |=3D I_NEW; + inode_state_add_raw(&inode->v, I_NEW); /* * We don't want bch2_evict_inode() to delete the inode on disk, * we just raced and had another inode in cache. Normally new @@ -2224,8 +2224,7 @@ void bch2_evict_subvolume_inodes(struct bch_fs *c, sn= apshot_id_list *s) if (!snapshot_list_has_id(s, inode->ei_inum.subvol)) continue; =20 - if (!(inode->v.i_state & I_DONTCACHE) && - !(inode->v.i_state & I_FREEING) && + if (!(inode_state_read_once(&inode->v) & (I_DONTCACHE | I_FREEING)) && igrab(&inode->v)) { this_pass_clean =3D false; =20 diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 8f430ff8e445..9fcfdd6b8189 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -307,7 +307,7 @@ static struct inode *befs_iget(struct super_block *sb, = unsigned long ino) inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 befs_ino =3D BEFS_I(inode); diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 1d41ce477df5..cb406a6ee811 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c @@ -42,7 +42,7 @@ struct inode *bfs_iget(struct super_block *sb, unsigned l= ong ino) inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 if ((ino < BFS_ROOT_INO) || (ino > BFS_SB(inode->i_sb)->si_lasti)) { diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c index 62a3d2565c26..70bb0579b40c 100644 --- a/fs/coda/cnode.c +++ b/fs/coda/cnode.c @@ -70,7 +70,7 @@ struct inode * coda_iget(struct super_block * sb, struct = CodaFid * fid, if (!inode) return ERR_PTR(-ENOMEM); =20 - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { cii =3D ITOC(inode); /* we still need to set i_ino for things like stat(2) */ inode->i_ino =3D hash; @@ -148,7 +148,7 @@ struct inode *coda_fid_to_inode(struct CodaFid *fid, st= ruct super_block *sb) =20 /* we should never see newly created inodes because we intentionally * fail in the initialization callback */ - BUG_ON(inode->i_state & I_NEW); + BUG_ON(inode_state_read_once(inode) & I_NEW); =20 return inode; } diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index b002e9b734f9..b11e92a7406d 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -95,7 +95,7 @@ static struct inode *get_cramfs_inode(struct super_block = *sb, inode =3D iget_locked(sb, cramino(cramfs_inode, offset)); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 switch (cramfs_inode->mode & S_IFMT) { diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 72fbe1316ab8..cd75f5d85258 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c @@ -95,7 +95,7 @@ static struct inode *__ecryptfs_get_inode(struct inode *l= ower_inode, iput(lower_inode); return ERR_PTR(-EACCES); } - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) iput(lower_inode); =20 return inode; @@ -106,7 +106,7 @@ struct inode *ecryptfs_get_inode(struct inode *lower_in= ode, { struct inode *inode =3D __ecryptfs_get_inode(lower_inode, sb); =20 - if (!IS_ERR(inode) && (inode->i_state & I_NEW)) + if (!IS_ERR(inode) && (inode_state_read_once(inode) & I_NEW)) unlock_new_inode(inode); =20 return inode; @@ -373,7 +373,7 @@ static struct dentry *ecryptfs_lookup_interpose(struct = dentry *dentry, } } =20 - if (inode->i_state & I_NEW) + if (inode_state_read_once(inode) & I_NEW) unlock_new_inode(inode); return d_splice_alias(inode, dentry); } diff --git a/fs/efs/inode.c b/fs/efs/inode.c index 462619e59766..28407578f83a 100644 --- a/fs/efs/inode.c +++ b/fs/efs/inode.c @@ -62,7 +62,7 @@ struct inode *efs_iget(struct super_block *super, unsigne= d long ino) inode =3D iget_locked(super, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 in =3D INODE_INFO(inode); diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index 9a2f59721522..d06286191c90 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -297,7 +297,7 @@ struct inode *erofs_iget(struct super_block *sb, erofs_= nid_t nid) if (!inode) return ERR_PTR(-ENOMEM); =20 - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { int err =3D erofs_fill_inode(inode); =20 if (err) { diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index e10c376843d7..dbfe9098a124 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -1398,7 +1398,7 @@ struct inode *ext2_iget (struct super_block *sb, unsi= gned long ino) inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 ei =3D EXT2_I(inode); diff --git a/fs/freevxfs/vxfs_inode.c b/fs/freevxfs/vxfs_inode.c index 20600e9ea202..21fc94b98209 100644 --- a/fs/freevxfs/vxfs_inode.c +++ b/fs/freevxfs/vxfs_inode.c @@ -258,7 +258,7 @@ vxfs_iget(struct super_block *sbp, ino_t ino) ip =3D iget_locked(sbp, ino); if (!ip) return ERR_PTR(-ENOMEM); - if (!(ip->i_state & I_NEW)) + if (!(inode_state_read_once(ip) & I_NEW)) return ip; =20 vip =3D VXFS_INO(ip); diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index ecb869e895ab..1bf3ddebf860 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -161,7 +161,7 @@ static void fuse_evict_inode(struct inode *inode) struct fuse_inode *fi =3D get_fuse_inode(inode); =20 /* Will write inode on close/munmap and in all other dirtiers */ - WARN_ON(inode->i_state & I_DIRTY_INODE); + WARN_ON(inode_state_read_once(inode) & I_DIRTY_INODE); =20 if (FUSE_IS_DAX(inode)) dax_break_layout_final(inode); @@ -506,7 +506,7 @@ struct inode *fuse_iget(struct super_block *sb, u64 nod= eid, if (!inode) return NULL; =20 - if ((inode->i_state & I_NEW)) { + if ((inode_state_read_once(inode) & I_NEW)) { inode->i_flags |=3D S_NOATIME; if (!fc->writeback_cache || !S_ISREG(attr->mode)) inode->i_flags |=3D S_NOCMTIME; diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 72d95185a39f..49c456f966cc 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -744,7 +744,7 @@ static int gfs2_fsync(struct file *file, loff_t start, = loff_t end, { struct address_space *mapping =3D file->f_mapping; struct inode *inode =3D mapping->host; - int sync_state =3D inode->i_state & I_DIRTY; + int sync_state =3D inode_state_read_once(inode) & I_DIRTY; struct gfs2_inode *ip =3D GFS2_I(inode); int ret =3D 0, ret1 =3D 0; =20 diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index fe0faad4892f..984bae7c1460 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -394,7 +394,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const = void *buf) u16 height, depth; umode_t mode =3D be32_to_cpu(str->di_mode); struct inode *inode =3D &ip->i_inode; - bool is_new =3D inode->i_state & I_NEW; + bool is_new =3D inode_state_read_once(inode) & I_NEW; =20 if (unlikely(ip->i_no_addr !=3D be64_to_cpu(str->di_num.no_addr))) { gfs2_consist_inode(ip); diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 8760e7e20c9d..7e0ceccf2691 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -127,7 +127,7 @@ struct inode *gfs2_inode_lookup(struct super_block *sb,= unsigned int type, =20 ip =3D GFS2_I(inode); =20 - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { struct gfs2_sbd *sdp =3D GFS2_SB(inode); struct gfs2_glock *io_gl; int extra_flags =3D 0; @@ -924,7 +924,7 @@ static int gfs2_create_inode(struct inode *dir, struct = dentry *dentry, gfs2_dir_no_add(&da); gfs2_glock_dq_uninit(&d_gh); if (!IS_ERR_OR_NULL(inode)) { - if (inode->i_state & I_NEW) + if (inode_state_read_once(inode) & I_NEW) iget_failed(inode); else iput(inode); diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index c770006f8889..2572ff9753b8 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -1749,7 +1749,7 @@ static void gfs2_evict_inodes(struct super_block *sb) spin_lock(&sb->s_inode_list_lock); list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { spin_lock(&inode->i_lock); - if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) && + if ((inode_state_read(inode) & (I_FREEING | I_WILL_FREE | I_NEW)) && !need_resched()) { spin_unlock(&inode->i_lock); continue; diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c index e86e1e235658..4076904ac1cd 100644 --- a/fs/hfs/btree.c +++ b/fs/hfs/btree.c @@ -42,7 +42,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, = u32 id, btree_keycmp ke tree->inode =3D iget_locked(sb, id); if (!tree->inode) goto free_tree; - BUG_ON(!(tree->inode->i_state & I_NEW)); + BUG_ON(!(inode_state_read_once(tree->inode) & I_NEW)); { struct hfs_mdb *mdb =3D HFS_SB(sb)->mdb; HFS_I(tree->inode)->flags =3D 0; diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index bf4cb7e78396..5fda94e20a93 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -401,7 +401,7 @@ struct inode *hfs_iget(struct super_block *sb, struct h= fs_cat_key *key, hfs_cat_ return NULL; } inode =3D iget5_locked(sb, cnid, hfs_test_inode, hfs_read_inode, &data); - if (inode && (inode->i_state & I_NEW)) + if (inode && (inode_state_read_once(inode) & I_NEW)) unlock_new_inode(inode); return inode; } diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 86351bdc8985..b63406d4be2b 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c @@ -65,7 +65,7 @@ struct inode *hfsplus_iget(struct super_block *sb, unsign= ed long ino) inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 INIT_LIST_HEAD(&HFSPLUS_I(inode)->open_dir_list); diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 01e516175bcd..1ff5b9d1b1a5 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -581,7 +581,7 @@ static struct inode *hostfs_iget(struct super_block *sb= , char *name) if (!inode) return ERR_PTR(-ENOMEM); =20 - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { unlock_new_inode(inode); } else { spin_lock(&inode->i_lock); diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index 49dd585c2b17..ceb50b2dc91a 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c @@ -247,7 +247,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct de= ntry *dentry, unsigned in result =3D ERR_PTR(-ENOMEM); goto bail1; } - if (result->i_state & I_NEW) { + if (inode_state_read_once(result) & I_NEW) { hpfs_init_inode(result); if (de->directory) hpfs_read_inode(result); diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c index 34008442ee26..93d528f4f4f2 100644 --- a/fs/hpfs/inode.c +++ b/fs/hpfs/inode.c @@ -196,7 +196,7 @@ void hpfs_write_inode(struct inode *i) parent =3D iget_locked(i->i_sb, hpfs_inode->i_parent_dir); if (parent) { hpfs_inode->i_dirty =3D 0; - if (parent->i_state & I_NEW) { + if (inode_state_read_once(parent) & I_NEW) { hpfs_init_inode(parent); hpfs_read_inode(parent); unlock_new_inode(parent); diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 6f0e6b19383c..0d51f57f7ad7 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -1515,7 +1515,7 @@ struct inode *__isofs_iget(struct super_block *sb, if (!inode) return ERR_PTR(-ENOMEM); =20 - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { ret =3D isofs_read_inode(inode, relocated); if (ret < 0) { iget_failed(inode); diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index d175cccb7c55..764bba8ba999 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c @@ -265,7 +265,7 @@ struct inode *jffs2_iget(struct super_block *sb, unsign= ed long ino) inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 f =3D JFFS2_INODE_INFO(inode); @@ -373,7 +373,7 @@ void jffs2_dirty_inode(struct inode *inode, int flags) { struct iattr iattr; =20 - if (!(inode->i_state & I_DIRTY_DATASYNC)) { + if (!(inode_state_read_once(inode) & I_DIRTY_DATASYNC)) { jffs2_dbg(2, "%s(): not calling setattr() for ino #%lu\n", __func__, inode->i_ino); return; diff --git a/fs/jfs/file.c b/fs/jfs/file.c index 2a4a288b821c..87ad042221e7 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c @@ -26,8 +26,8 @@ int jfs_fsync(struct file *file, loff_t start, loff_t end= , int datasync) return rc; =20 inode_lock(inode); - if (!(inode->i_state & I_DIRTY_ALL) || - (datasync && !(inode->i_state & I_DIRTY_DATASYNC))) { + if (!(inode_state_read_once(inode) & I_DIRTY_ALL) || + (datasync && !(inode_state_read_once(inode) & I_DIRTY_DATASYNC))) { /* Make sure committed changes hit the disk */ jfs_flush_journal(JFS_SBI(inode->i_sb)->log, 1); inode_unlock(inode); diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index fcedeb514e14..15fb2ee7f799 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c @@ -29,7 +29,7 @@ struct inode *jfs_iget(struct super_block *sb, unsigned l= ong ino) inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 ret =3D diRead(inode); diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index be17e3c43582..a3dd2d6b0805 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c @@ -1286,7 +1286,7 @@ int txCommit(tid_t tid, /* transaction identifier */ * to verify this, only a trivial s/I_LOCK/I_SYNC/ was done. * Joern */ - if (tblk->u.ip->i_state & I_SYNC) + if (inode_state_read_once(tblk->u.ip) & I_SYNC) tblk->xflag &=3D ~COMMIT_LAZY; } =20 diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index 3c293a5a21b1..7abd305facdb 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c @@ -251,7 +251,7 @@ struct inode *kernfs_get_inode(struct super_block *sb, = struct kernfs_node *kn) struct inode *inode; =20 inode =3D iget_locked(sb, kernfs_ino(kn)); - if (inode && (inode->i_state & I_NEW)) + if (inode && (inode_state_read_once(inode) & I_NEW)) kernfs_init_inode(kn, inode); =20 return inode; diff --git a/fs/minix/inode.c b/fs/minix/inode.c index df9d11479caf..e0d857489044 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -583,7 +583,7 @@ struct inode *minix_iget(struct super_block *sb, unsign= ed long ino) inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 if (INODE_VERSION(inode) =3D=3D MINIX_V1) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index b52805951856..c54981ed88fc 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -475,7 +475,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, st= ruct nfs_fattr *fattr) goto out_no_inode; } =20 - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { struct nfs_inode *nfsi =3D NFS_I(inode); unsigned long now =3D jiffies; =20 diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index a3135b5af7ee..f157d43d1312 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -317,7 +317,7 @@ pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo) WARN_ONCE(1, "NFS: BUG unfreed layout segments.\n"); pnfs_detach_layout_hdr(lo); /* Notify pnfs_destroy_layout_final() that we're done */ - if (inode->i_state & (I_FREEING | I_CLEAR)) + if (inode_state_read(inode) & (I_FREEING | I_CLEAR)) wake_up_var_locked(lo, &inode->i_lock); spin_unlock(&inode->i_lock); pnfs_free_layout_hdr(lo); diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 98ab55ba3ced..e03acfd14787 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1139,7 +1139,7 @@ static int wait_for_concurrent_writes(struct file *fi= le) dprintk("nfsd: write resume %d\n", task_pid_nr(current)); } =20 - if (inode->i_state & I_DIRTY) { + if (inode_state_read_once(inode) & I_DIRTY) { dprintk("nfsd: write sync %d\n", task_pid_nr(current)); err =3D vfs_fsync(file, 0); } diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 37cbbee7fa58..c72b1b443bfa 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -536,7 +536,7 @@ struct inode *ntfs_iget5(struct super_block *sb, const = struct MFT_REF *ref, return ERR_PTR(-ENOMEM); =20 /* If this is a freshly allocated inode, need to read it now. */ - if (inode->i_state & I_NEW) + if (inode_state_read_once(inode) & I_NEW) inode =3D ntfs_read_mft(inode, name, ref); else if (ref->seq !=3D ntfs_i(inode)->mi.mrec->seq) { /* diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 92a6149da9c1..619ff03b15d6 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c @@ -2487,7 +2487,7 @@ int ocfs2_inode_lock_full_nested(struct inode *inode, * which hasn't been populated yet, so clear the refresh flag * and let the caller handle it. */ - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { status =3D 0; if (lockres) ocfs2_complete_lock_res_refresh(lockres, 0); diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 14bf440ea4df..c0a1bb74e4a7 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -152,8 +152,8 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 b= lkno, unsigned flags, mlog_errno(PTR_ERR(inode)); goto bail; } - trace_ocfs2_iget5_locked(inode->i_state); - if (inode->i_state & I_NEW) { + trace_ocfs2_iget5_locked(inode_state_read_once(inode)); + if (inode_state_read_once(inode) & I_NEW) { rc =3D ocfs2_read_locked_inode(inode, &args); unlock_new_inode(inode); } @@ -1307,12 +1307,12 @@ int ocfs2_drop_inode(struct inode *inode) inode->i_nlink, oi->ip_flags); =20 assert_spin_locked(&inode->i_lock); - inode->i_state |=3D I_WILL_FREE; + inode_state_add(inode, I_WILL_FREE); spin_unlock(&inode->i_lock); write_inode_now(inode, 1); spin_lock(&inode->i_lock); - WARN_ON(inode->i_state & I_NEW); - inode->i_state &=3D ~I_WILL_FREE; + WARN_ON(inode_state_read(inode) & I_NEW); + inode_state_del(inode, I_WILL_FREE); =20 return 1; } diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c index 135c49c5d848..db80af312678 100644 --- a/fs/omfs/inode.c +++ b/fs/omfs/inode.c @@ -212,7 +212,7 @@ struct inode *omfs_iget(struct super_block *sb, ino_t i= no) inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 bh =3D omfs_bread(inode->i_sb, ino); diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c index 26ecda0e4d19..fb8d84bdedfb 100644 --- a/fs/openpromfs/inode.c +++ b/fs/openpromfs/inode.c @@ -236,7 +236,7 @@ static struct dentry *openpromfs_lookup(struct inode *d= ir, struct dentry *dentry mutex_unlock(&op_mutex); if (IS_ERR(inode)) return ERR_CAST(inode); - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { simple_inode_init_ts(inode); ent_oi =3D OP_I(inode); ent_oi->type =3D ent_type; diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index a01400cd41fd..1eb4fbe35a46 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -1041,7 +1041,7 @@ struct inode *orangefs_iget(struct super_block *sb, if (!inode) return ERR_PTR(-ENOMEM); =20 - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 error =3D orangefs_inode_getattr(inode, ORANGEFS_GETATTR_NEW); diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c index 0fdceb00ca07..9ab1119ebd28 100644 --- a/fs/orangefs/orangefs-utils.c +++ b/fs/orangefs/orangefs-utils.c @@ -247,7 +247,7 @@ int orangefs_inode_getattr(struct inode *inode, int fla= gs) spin_lock(&inode->i_lock); /* Must have all the attributes in the mask and be within cache time. */ if ((!flags && time_before(jiffies, orangefs_inode->getattr_time)) || - orangefs_inode->attr_valid || inode->i_state & I_DIRTY_PAGES) { + orangefs_inode->attr_valid || inode_state_read(inode) & I_DIRTY_PAGES= ) { if (orangefs_inode->attr_valid) { spin_unlock(&inode->i_lock); write_inode_now(inode, 1); @@ -281,13 +281,13 @@ int orangefs_inode_getattr(struct inode *inode, int f= lags) spin_lock(&inode->i_lock); /* Must have all the attributes in the mask and be within cache time. */ if ((!flags && time_before(jiffies, orangefs_inode->getattr_time)) || - orangefs_inode->attr_valid || inode->i_state & I_DIRTY_PAGES) { + orangefs_inode->attr_valid || inode_state_read(inode) & I_DIRTY_PAGES= ) { if (orangefs_inode->attr_valid) { spin_unlock(&inode->i_lock); write_inode_now(inode, 1); goto again2; } - if (inode->i_state & I_DIRTY_PAGES) { + if (inode_state_read(inode) & I_DIRTY_PAGES) { ret =3D 0; goto out_unlock; } diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index e399e2dd3a12..31d78da203ea 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c @@ -290,7 +290,7 @@ struct inode *qnx4_iget(struct super_block *sb, unsigne= d long ino) inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 qnx4_inode =3D qnx4_raw_inode(inode); diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c index 3310d1ad4d0e..88d285005083 100644 --- a/fs/qnx6/inode.c +++ b/fs/qnx6/inode.c @@ -521,7 +521,7 @@ struct inode *qnx6_iget(struct super_block *sb, unsigne= d ino) inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 ei =3D QNX6_I(inode); diff --git a/fs/romfs/super.c b/fs/romfs/super.c index 0addcc849ff2..360b00854115 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c @@ -302,7 +302,7 @@ static struct inode *romfs_iget(struct super_block *sb,= unsigned long pos) if (!i) return ERR_PTR(-ENOMEM); =20 - if (!(i->i_state & I_NEW)) + if (!(inode_state_read_once(i) & I_NEW)) return i; =20 /* precalculate the data offset */ diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c index 3bd85ab2deb1..3e6d0ddc707c 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -444,7 +444,7 @@ cifs_evict_inode(struct inode *inode) { netfs_wait_for_outstanding_io(inode); truncate_inode_pages_final(&inode->i_data); - if (inode->i_state & I_PINNING_NETFS_WB) + if (inode_state_read_once(inode) & I_PINNING_NETFS_WB) cifs_fscache_unuse_inode_cookie(inode, true); cifs_fscache_release_inode_cookie(inode); clear_inode(inode); diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c index 211d5b8b42f4..3918c9820a35 100644 --- a/fs/smb/client/inode.c +++ b/fs/smb/client/inode.c @@ -101,7 +101,7 @@ cifs_revalidate_cache(struct inode *inode, struct cifs_= fattr *fattr) cifs_dbg(FYI, "%s: revalidating inode %llu\n", __func__, cifs_i->uniqueid); =20 - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { cifs_dbg(FYI, "%s: inode %llu is new\n", __func__, cifs_i->uniqueid); return; @@ -146,7 +146,7 @@ cifs_nlink_fattr_to_inode(struct inode *inode, struct c= ifs_fattr *fattr) */ if (fattr->cf_flags & CIFS_FATTR_UNKNOWN_NLINK) { /* only provide fake values on a new inode */ - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { if (fattr->cf_cifsattrs & ATTR_DIRECTORY) set_nlink(inode, 2); else @@ -167,12 +167,12 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_= fattr *fattr, struct cifsInodeInfo *cifs_i =3D CIFS_I(inode); struct cifs_sb_info *cifs_sb =3D CIFS_SB(inode->i_sb); =20 - if (!(inode->i_state & I_NEW) && + if (!(inode_state_read_once(inode) & I_NEW) && unlikely(inode_wrong_type(inode, fattr->cf_mode))) { CIFS_I(inode)->time =3D 0; /* force reval */ return -ESTALE; } - if (inode->i_state & I_NEW) + if (inode_state_read_once(inode) & I_NEW) CIFS_I(inode)->netfs.zero_point =3D fattr->cf_eof; =20 cifs_revalidate_cache(inode, fattr); @@ -194,7 +194,7 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fa= ttr *fattr, inode->i_gid =3D fattr->cf_gid; =20 /* if dynperm is set, don't clobber existing mode */ - if (inode->i_state & I_NEW || + if (inode_state_read_once(inode) & I_NEW || !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)) inode->i_mode =3D fattr->cf_mode; =20 @@ -236,7 +236,7 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fa= ttr *fattr, =20 if (fattr->cf_flags & CIFS_FATTR_JUNCTION) inode->i_flags |=3D S_AUTOMOUNT; - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { cifs_set_netfs_context(inode); cifs_set_ops(inode); } @@ -1638,7 +1638,7 @@ cifs_iget(struct super_block *sb, struct cifs_fattr *= fattr) cifs_fattr_to_inode(inode, fattr, false); if (sb->s_flags & SB_NOATIME) inode->i_flags |=3D S_NOATIME | S_NOCMTIME; - if (inode->i_state & I_NEW) { + if (inode_state_read_once(inode) & I_NEW) { inode->i_ino =3D hash; cifs_fscache_get_inode_cookie(inode); unlock_new_inode(inode); diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c index d5918eba27e3..8fbcc361f9a2 100644 --- a/fs/squashfs/inode.c +++ b/fs/squashfs/inode.c @@ -82,7 +82,7 @@ struct inode *squashfs_iget(struct super_block *sb, long = long ino, =20 if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 err =3D squashfs_read_inode(inode, ino); diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index e75a6cec67be..5f5de8de0268 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1323,7 +1323,7 @@ int ubifs_fsync(struct file *file, loff_t start, loff= _t end, int datasync) inode_lock(inode); =20 /* Synchronize the inode unless this is a 'datasync()' call. */ - if (!datasync || (inode->i_state & I_DIRTY_DATASYNC)) { + if (!datasync || (inode_state_read_once(inode) & I_DIRTY_DATASYNC)) { err =3D inode->i_sb->s_op->write_inode(inode, NULL); if (err) goto out; diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index a0269ba96e3d..4a7b16f5cb7d 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -114,7 +114,7 @@ struct inode *ubifs_iget(struct super_block *sb, unsign= ed long inum) inode =3D iget_locked(sb, inum); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; ui =3D ubifs_inode(inode); =20 diff --git a/fs/udf/inode.c b/fs/udf/inode.c index f24aa98e6869..de232d400f6a 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -1962,7 +1962,7 @@ struct inode *__udf_iget(struct super_block *sb, stru= ct kernel_lb_addr *ino, if (!inode) return ERR_PTR(-ENOMEM); =20 - if (!(inode->i_state & I_NEW)) { + if (!(inode_state_read_once(inode) & I_NEW)) { if (UDF_I(inode)->i_hidden !=3D hidden_inode) { iput(inode); return ERR_PTR(-EFSCORRUPTED); diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 8361c00e8fa6..e2b0a35de2a7 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c @@ -655,7 +655,7 @@ struct inode *ufs_iget(struct super_block *sb, unsigned= long ino) inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 ufsi =3D UFS_I(inode); diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index 4dc7f967c861..b3d46ce657d0 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -644,7 +644,7 @@ static struct inode *zonefs_get_file_inode(struct inode= *dir, inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) { + if (!(inode_state_read_once(inode) & I_NEW)) { WARN_ON_ONCE(inode->i_private !=3D z); return inode; } @@ -683,7 +683,7 @@ static struct inode *zonefs_get_zgroup_inode(struct sup= er_block *sb, inode =3D iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); - if (!(inode->i_state & I_NEW)) + if (!(inode_state_read_once(inode) & I_NEW)) return inode; =20 inode->i_ino =3D ino; --=20 2.43.0