Commit 6fbac201 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'iversion-v4.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux

Pull inode->i_version cleanup from Jeff Layton:
 "Goffredo went ahead and sent a patch to rename this function, and
  reverse its sense, as we discussed last week.

  The patch is very straightforward and I figure it's probably best to
  go ahead and merge this to get the API as settled as possible"

* tag 'iversion-v4.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux:
  iversion: Rename make inode_cmp_iversion{+raw} to inode_eq_iversion{+raw}
parents fe803f86 c472c07b
...@@ -81,7 +81,7 @@ affs_readdir(struct file *file, struct dir_context *ctx) ...@@ -81,7 +81,7 @@ affs_readdir(struct file *file, struct dir_context *ctx)
* we can jump directly to where we left off. * we can jump directly to where we left off.
*/ */
ino = (u32)(long)file->private_data; ino = (u32)(long)file->private_data;
if (ino && inode_cmp_iversion(inode, file->f_version) == 0) { if (ino && inode_eq_iversion(inode, file->f_version)) {
pr_debug("readdir() left off=%d\n", ino); pr_debug("readdir() left off=%d\n", ino);
goto inside; goto inside;
} }
......
...@@ -242,7 +242,7 @@ exofs_readdir(struct file *file, struct dir_context *ctx) ...@@ -242,7 +242,7 @@ exofs_readdir(struct file *file, struct dir_context *ctx)
unsigned long n = pos >> PAGE_SHIFT; unsigned long n = pos >> PAGE_SHIFT;
unsigned long npages = dir_pages(inode); unsigned long npages = dir_pages(inode);
unsigned chunk_mask = ~(exofs_chunk_size(inode)-1); unsigned chunk_mask = ~(exofs_chunk_size(inode)-1);
bool need_revalidate = inode_cmp_iversion(inode, file->f_version); bool need_revalidate = !inode_eq_iversion(inode, file->f_version);
if (pos > inode->i_size - EXOFS_DIR_REC_LEN(1)) if (pos > inode->i_size - EXOFS_DIR_REC_LEN(1))
return 0; return 0;
......
...@@ -294,7 +294,7 @@ ext2_readdir(struct file *file, struct dir_context *ctx) ...@@ -294,7 +294,7 @@ ext2_readdir(struct file *file, struct dir_context *ctx)
unsigned long npages = dir_pages(inode); unsigned long npages = dir_pages(inode);
unsigned chunk_mask = ~(ext2_chunk_size(inode)-1); unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
unsigned char *types = NULL; unsigned char *types = NULL;
bool need_revalidate = inode_cmp_iversion(inode, file->f_version); bool need_revalidate = !inode_eq_iversion(inode, file->f_version);
if (pos > inode->i_size - EXT2_DIR_REC_LEN(1)) if (pos > inode->i_size - EXT2_DIR_REC_LEN(1))
return 0; return 0;
......
...@@ -209,7 +209,7 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx) ...@@ -209,7 +209,7 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx)
* readdir(2), then we might be pointing to an invalid * readdir(2), then we might be pointing to an invalid
* dirent right now. Scan from the start of the block * dirent right now. Scan from the start of the block
* to make sure. */ * to make sure. */
if (inode_cmp_iversion(inode, file->f_version)) { if (!inode_eq_iversion(inode, file->f_version)) {
for (i = 0; i < sb->s_blocksize && i < offset; ) { for (i = 0; i < sb->s_blocksize && i < offset; ) {
de = (struct ext4_dir_entry_2 *) de = (struct ext4_dir_entry_2 *)
(bh->b_data + i); (bh->b_data + i);
...@@ -569,7 +569,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx) ...@@ -569,7 +569,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx)
* cached entries. * cached entries.
*/ */
if ((!info->curr_node) || if ((!info->curr_node) ||
inode_cmp_iversion(inode, file->f_version)) { !inode_eq_iversion(inode, file->f_version)) {
info->curr_node = NULL; info->curr_node = NULL;
free_rb_tree_fname(&info->root); free_rb_tree_fname(&info->root);
file->f_version = inode_query_iversion(inode); file->f_version = inode_query_iversion(inode);
......
...@@ -1487,7 +1487,7 @@ int ext4_read_inline_dir(struct file *file, ...@@ -1487,7 +1487,7 @@ int ext4_read_inline_dir(struct file *file,
* dirent right now. Scan from the start of the inline * dirent right now. Scan from the start of the inline
* dir to make sure. * dir to make sure.
*/ */
if (inode_cmp_iversion(inode, file->f_version)) { if (!inode_eq_iversion(inode, file->f_version)) {
for (i = 0; i < extra_size && i < offset;) { for (i = 0; i < extra_size && i < offset;) {
/* /*
* "." is with offset 0 and * "." is with offset 0 and
......
...@@ -46,7 +46,7 @@ static int vfat_revalidate_shortname(struct dentry *dentry) ...@@ -46,7 +46,7 @@ static int vfat_revalidate_shortname(struct dentry *dentry)
{ {
int ret = 1; int ret = 1;
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
if (inode_cmp_iversion(d_inode(dentry->d_parent), vfat_d_version(dentry))) if (!inode_eq_iversion(d_inode(dentry->d_parent), vfat_d_version(dentry)))
ret = 0; ret = 0;
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
return ret; return ret;
......
...@@ -1314,7 +1314,7 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr ...@@ -1314,7 +1314,7 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr
if ((fattr->valid & NFS_ATTR_FATTR_PRECHANGE) if ((fattr->valid & NFS_ATTR_FATTR_PRECHANGE)
&& (fattr->valid & NFS_ATTR_FATTR_CHANGE) && (fattr->valid & NFS_ATTR_FATTR_CHANGE)
&& !inode_cmp_iversion_raw(inode, fattr->pre_change_attr)) { && inode_eq_iversion_raw(inode, fattr->pre_change_attr)) {
inode_set_iversion_raw(inode, fattr->change_attr); inode_set_iversion_raw(inode, fattr->change_attr);
if (S_ISDIR(inode->i_mode)) if (S_ISDIR(inode->i_mode))
nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA);
...@@ -1373,7 +1373,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat ...@@ -1373,7 +1373,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat
if (!nfs_file_has_buffered_writers(nfsi)) { if (!nfs_file_has_buffered_writers(nfsi)) {
/* Verify a few of the more important attributes */ /* Verify a few of the more important attributes */
if ((fattr->valid & NFS_ATTR_FATTR_CHANGE) != 0 && inode_cmp_iversion_raw(inode, fattr->change_attr)) if ((fattr->valid & NFS_ATTR_FATTR_CHANGE) != 0 && !inode_eq_iversion_raw(inode, fattr->change_attr))
invalid |= NFS_INO_INVALID_ATTR | NFS_INO_REVAL_PAGECACHE; invalid |= NFS_INO_INVALID_ATTR | NFS_INO_REVAL_PAGECACHE;
if ((fattr->valid & NFS_ATTR_FATTR_MTIME) && !timespec_equal(&inode->i_mtime, &fattr->mtime)) if ((fattr->valid & NFS_ATTR_FATTR_MTIME) && !timespec_equal(&inode->i_mtime, &fattr->mtime))
...@@ -1803,7 +1803,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) ...@@ -1803,7 +1803,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
/* More cache consistency checks */ /* More cache consistency checks */
if (fattr->valid & NFS_ATTR_FATTR_CHANGE) { if (fattr->valid & NFS_ATTR_FATTR_CHANGE) {
if (inode_cmp_iversion_raw(inode, fattr->change_attr)) { if (!inode_eq_iversion_raw(inode, fattr->change_attr)) {
dprintk("NFS: change_attr change on server for file %s/%ld\n", dprintk("NFS: change_attr change on server for file %s/%ld\n",
inode->i_sb->s_id, inode->i_ino); inode->i_sb->s_id, inode->i_ino);
/* Could it be a race with writeback? */ /* Could it be a race with writeback? */
......
...@@ -1776,7 +1776,7 @@ static int ocfs2_dir_foreach_blk_id(struct inode *inode, ...@@ -1776,7 +1776,7 @@ static int ocfs2_dir_foreach_blk_id(struct inode *inode,
* readdir(2), then we might be pointing to an invalid * readdir(2), then we might be pointing to an invalid
* dirent right now. Scan from the start of the block * dirent right now. Scan from the start of the block
* to make sure. */ * to make sure. */
if (inode_cmp_iversion(inode, *f_version)) { if (!inode_eq_iversion(inode, *f_version)) {
for (i = 0; i < i_size_read(inode) && i < offset; ) { for (i = 0; i < i_size_read(inode) && i < offset; ) {
de = (struct ocfs2_dir_entry *) de = (struct ocfs2_dir_entry *)
(data->id_data + i); (data->id_data + i);
...@@ -1870,7 +1870,7 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode, ...@@ -1870,7 +1870,7 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode,
* readdir(2), then we might be pointing to an invalid * readdir(2), then we might be pointing to an invalid
* dirent right now. Scan from the start of the block * dirent right now. Scan from the start of the block
* to make sure. */ * to make sure. */
if (inode_cmp_iversion(inode, *f_version)) { if (!inode_eq_iversion(inode, *f_version)) {
for (i = 0; i < sb->s_blocksize && i < offset; ) { for (i = 0; i < sb->s_blocksize && i < offset; ) {
de = (struct ocfs2_dir_entry *) (bh->b_data + i); de = (struct ocfs2_dir_entry *) (bh->b_data + i);
/* It's too expensive to do a full /* It's too expensive to do a full
......
...@@ -429,7 +429,7 @@ ufs_readdir(struct file *file, struct dir_context *ctx) ...@@ -429,7 +429,7 @@ ufs_readdir(struct file *file, struct dir_context *ctx)
unsigned long n = pos >> PAGE_SHIFT; unsigned long n = pos >> PAGE_SHIFT;
unsigned long npages = dir_pages(inode); unsigned long npages = dir_pages(inode);
unsigned chunk_mask = ~(UFS_SB(sb)->s_uspi->s_dirblksize - 1); unsigned chunk_mask = ~(UFS_SB(sb)->s_uspi->s_dirblksize - 1);
bool need_revalidate = inode_cmp_iversion(inode, file->f_version); bool need_revalidate = !inode_eq_iversion(inode, file->f_version);
unsigned flags = UFS_SB(sb)->s_flags; unsigned flags = UFS_SB(sb)->s_flags;
UFSD("BEGIN\n"); UFSD("BEGIN\n");
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
* *
* With this implementation, the value should always appear to observers to * With this implementation, the value should always appear to observers to
* increase over time if the file has changed. It's recommended to use * increase over time if the file has changed. It's recommended to use
* inode_cmp_iversion() helper to compare values. * inode_eq_iversion() helper to compare values.
* *
* Note that some filesystems (e.g. NFS and AFS) just use the field to store * Note that some filesystems (e.g. NFS and AFS) just use the field to store
* a server-provided value (for the most part). For that reason, those * a server-provided value (for the most part). For that reason, those
...@@ -305,33 +305,33 @@ inode_query_iversion(struct inode *inode) ...@@ -305,33 +305,33 @@ inode_query_iversion(struct inode *inode)
} }
/** /**
* inode_cmp_iversion_raw - check whether the raw i_version counter has changed * inode_eq_iversion_raw - check whether the raw i_version counter has changed
* @inode: inode to check * @inode: inode to check
* @old: old value to check against its i_version * @old: old value to check against its i_version
* *
* Compare the current raw i_version counter with a previous one. Returns false * Compare the current raw i_version counter with a previous one. Returns true
* if they are the same or true if they are different. * if they are the same or false if they are different.
*/ */
static inline bool static inline bool
inode_cmp_iversion_raw(const struct inode *inode, u64 old) inode_eq_iversion_raw(const struct inode *inode, u64 old)
{ {
return inode_peek_iversion_raw(inode) != old; return inode_peek_iversion_raw(inode) == old;
} }
/** /**
* inode_cmp_iversion - check whether the i_version counter has changed * inode_eq_iversion - check whether the i_version counter has changed
* @inode: inode to check * @inode: inode to check
* @old: old value to check against its i_version * @old: old value to check against its i_version
* *
* Compare an i_version counter with a previous one. Returns false if they are * Compare an i_version counter with a previous one. Returns true if they are
* the same, and true if they are different. * the same, and false if they are different.
* *
* Note that we don't need to set the QUERIED flag in this case, as the value * Note that we don't need to set the QUERIED flag in this case, as the value
* in the inode is not being recorded for later use. * in the inode is not being recorded for later use.
*/ */
static inline bool static inline bool
inode_cmp_iversion(const struct inode *inode, u64 old) inode_eq_iversion(const struct inode *inode, u64 old)
{ {
return inode_peek_iversion(inode) != old; return inode_peek_iversion(inode) == old;
} }
#endif #endif
...@@ -135,7 +135,7 @@ static void ima_check_last_writer(struct integrity_iint_cache *iint, ...@@ -135,7 +135,7 @@ static void ima_check_last_writer(struct integrity_iint_cache *iint,
update = test_and_clear_bit(IMA_UPDATE_XATTR, update = test_and_clear_bit(IMA_UPDATE_XATTR,
&iint->atomic_flags); &iint->atomic_flags);
if (!IS_I_VERSION(inode) || if (!IS_I_VERSION(inode) ||
inode_cmp_iversion(inode, iint->version) || !inode_eq_iversion(inode, iint->version) ||
(iint->flags & IMA_NEW_FILE)) { (iint->flags & IMA_NEW_FILE)) {
iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE); iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE);
iint->measured_pcrs = 0; iint->measured_pcrs = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment