mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-04 20:57:45 -04:00
Coccinelle-based conversion to use ->i_state accessors
All places were patched by coccinelle with the default expecting that ->i_lock is held, afterwards entries got fixed up by hand to use unlocked variants as needed. The script: @@ expression inode, flags; @@ - inode->i_state & flags + inode_state_read(inode) & flags @@ expression inode, flags; @@ - inode->i_state &= ~flags + inode_state_clear(inode, flags) @@ expression inode, flag1, flag2; @@ - inode->i_state &= ~flag1 & ~flag2 + inode_state_clear(inode, flag1 | flag2) @@ expression inode, flags; @@ - inode->i_state |= flags + inode_state_set(inode, flags) @@ expression inode, flags; @@ - inode->i_state = flags + inode_state_assign(inode, flags) @@ expression inode, flags; @@ - flags = inode->i_state + flags = inode_state_read(inode) @@ expression inode, flags; @@ - READ_ONCE(inode->i_state) & flags + inode_state_read(inode) & flags Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
d8753f788a
commit
b4dbfd8653
@@ -147,10 +147,10 @@ bool netfs_dirty_folio(struct address_space *mapping, struct folio *folio)
|
||||
if (!fscache_cookie_valid(cookie))
|
||||
return true;
|
||||
|
||||
if (!(inode->i_state & I_PINNING_NETFS_WB)) {
|
||||
if (!(inode_state_read_once(inode) & I_PINNING_NETFS_WB)) {
|
||||
spin_lock(&inode->i_lock);
|
||||
if (!(inode->i_state & I_PINNING_NETFS_WB)) {
|
||||
inode->i_state |= I_PINNING_NETFS_WB;
|
||||
if (!(inode_state_read(inode) & I_PINNING_NETFS_WB)) {
|
||||
inode_state_set(inode, I_PINNING_NETFS_WB);
|
||||
need_use = true;
|
||||
}
|
||||
spin_unlock(&inode->i_lock);
|
||||
@@ -192,7 +192,7 @@ void netfs_clear_inode_writeback(struct inode *inode, const void *aux)
|
||||
{
|
||||
struct fscache_cookie *cookie = netfs_i_cookie(netfs_inode(inode));
|
||||
|
||||
if (inode->i_state & I_PINNING_NETFS_WB) {
|
||||
if (inode_state_read_once(inode) & I_PINNING_NETFS_WB) {
|
||||
loff_t i_size = i_size_read(inode);
|
||||
fscache_unuse_cookie(cookie, aux, &i_size);
|
||||
}
|
||||
|
||||
@@ -36,12 +36,12 @@ void netfs_single_mark_inode_dirty(struct inode *inode)
|
||||
|
||||
mark_inode_dirty(inode);
|
||||
|
||||
if (caching && !(inode->i_state & I_PINNING_NETFS_WB)) {
|
||||
if (caching && !(inode_state_read_once(inode) & I_PINNING_NETFS_WB)) {
|
||||
bool need_use = false;
|
||||
|
||||
spin_lock(&inode->i_lock);
|
||||
if (!(inode->i_state & I_PINNING_NETFS_WB)) {
|
||||
inode->i_state |= I_PINNING_NETFS_WB;
|
||||
if (!(inode_state_read(inode) & I_PINNING_NETFS_WB)) {
|
||||
inode_state_set(inode, I_PINNING_NETFS_WB);
|
||||
need_use = true;
|
||||
}
|
||||
spin_unlock(&inode->i_lock);
|
||||
|
||||
Reference in New Issue
Block a user