aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@poochiereds.net>2014-04-30 09:31:45 -0400
committerSteve French <smfrench@gmail.com>2014-05-21 13:18:05 -0400
commitaff8d5ca7a3dca0bd6f6e86c9a85bf04941262ce (patch)
tree3bb10e19fa53334df6b7731a14e4cfb4bec82f35 /fs/cifs/inode.c
parent02323db17e3a73dd335690b7b1a2392912b05513 (diff)
cifs: convert booleans in cifsInodeInfo to a flags field
In later patches, we'll need to have a bitlock, so go ahead and convert these bools to use atomic bitops instead. Also, clean up the initialization of the flags field. There's no need to unset each bit individually just after it was zeroed on allocation. Signed-off-by: Jeff Layton <jlayton@poochiereds.net> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index a22d667f1069..fa9ef8d902b5 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -117,7 +117,7 @@ cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr)
117 117
118 cifs_dbg(FYI, "%s: invalidating inode %llu mapping\n", 118 cifs_dbg(FYI, "%s: invalidating inode %llu mapping\n",
119 __func__, cifs_i->uniqueid); 119 __func__, cifs_i->uniqueid);
120 cifs_i->invalid_mapping = true; 120 set_bit(CIFS_INO_INVALID_MAPPING, &cifs_i->flags);
121} 121}
122 122
123/* 123/*
@@ -177,7 +177,10 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr)
177 else 177 else
178 cifs_i->time = jiffies; 178 cifs_i->time = jiffies;
179 179
180 cifs_i->delete_pending = fattr->cf_flags & CIFS_FATTR_DELETE_PENDING; 180 if (fattr->cf_flags & CIFS_FATTR_DELETE_PENDING)
181 set_bit(CIFS_INO_DELETE_PENDING, &cifs_i->flags);
182 else
183 clear_bit(CIFS_INO_DELETE_PENDING, &cifs_i->flags);
181 184
182 cifs_i->server_eof = fattr->cf_eof; 185 cifs_i->server_eof = fattr->cf_eof;
183 /* 186 /*
@@ -1121,7 +1124,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
1121 } 1124 }
1122 1125
1123 /* try to set DELETE_ON_CLOSE */ 1126 /* try to set DELETE_ON_CLOSE */
1124 if (!cifsInode->delete_pending) { 1127 if (!test_bit(CIFS_INO_DELETE_PENDING, &cifsInode->flags)) {
1125 rc = CIFSSMBSetFileDisposition(xid, tcon, true, fid.netfid, 1128 rc = CIFSSMBSetFileDisposition(xid, tcon, true, fid.netfid,
1126 current->tgid); 1129 current->tgid);
1127 /* 1130 /*
@@ -1138,7 +1141,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
1138 rc = -EBUSY; 1141 rc = -EBUSY;
1139 goto undo_rename; 1142 goto undo_rename;
1140 } 1143 }
1141 cifsInode->delete_pending = true; 1144 set_bit(CIFS_INO_DELETE_PENDING, &cifsInode->flags);
1142 } 1145 }
1143 1146
1144out_close: 1147out_close:
@@ -1761,14 +1764,14 @@ cifs_invalidate_mapping(struct inode *inode)
1761 int rc = 0; 1764 int rc = 0;
1762 struct cifsInodeInfo *cifs_i = CIFS_I(inode); 1765 struct cifsInodeInfo *cifs_i = CIFS_I(inode);
1763 1766
1764 cifs_i->invalid_mapping = false; 1767 clear_bit(CIFS_INO_INVALID_MAPPING, &cifs_i->flags);
1765 1768
1766 if (inode->i_mapping && inode->i_mapping->nrpages != 0) { 1769 if (inode->i_mapping && inode->i_mapping->nrpages != 0) {
1767 rc = invalidate_inode_pages2(inode->i_mapping); 1770 rc = invalidate_inode_pages2(inode->i_mapping);
1768 if (rc) { 1771 if (rc) {
1769 cifs_dbg(VFS, "%s: could not invalidate inode %p\n", 1772 cifs_dbg(VFS, "%s: could not invalidate inode %p\n",
1770 __func__, inode); 1773 __func__, inode);
1771 cifs_i->invalid_mapping = true; 1774 set_bit(CIFS_INO_INVALID_MAPPING, &cifs_i->flags);
1772 } 1775 }
1773 } 1776 }
1774 1777
@@ -1842,7 +1845,7 @@ int cifs_revalidate_file(struct file *filp)
1842 if (rc) 1845 if (rc)
1843 return rc; 1846 return rc;
1844 1847
1845 if (CIFS_I(inode)->invalid_mapping) 1848 if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags))
1846 rc = cifs_invalidate_mapping(inode); 1849 rc = cifs_invalidate_mapping(inode);
1847 return rc; 1850 return rc;
1848} 1851}
@@ -1857,7 +1860,7 @@ int cifs_revalidate_dentry(struct dentry *dentry)
1857 if (rc) 1860 if (rc)
1858 return rc; 1861 return rc;
1859 1862
1860 if (CIFS_I(inode)->invalid_mapping) 1863 if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags))
1861 rc = cifs_invalidate_mapping(inode); 1864 rc = cifs_invalidate_mapping(inode);
1862 return rc; 1865 return rc;
1863} 1866}