Skip to content

Commit 6fbac20

Browse files
committed
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}
2 parents fe803f8 + c472c07 commit 6fbac20

11 files changed

Lines changed: 25 additions & 25 deletions

File tree

‎fs/affs/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ affs_readdir(struct file *file, struct dir_context *ctx)
8181
* we can jump directly to where we left off.
8282
*/
8383
ino = (u32)(long)file->private_data;
84-
if (ino && inode_cmp_iversion(inode, file->f_version) == 0) {
84+
if (ino && inode_eq_iversion(inode, file->f_version)) {
8585
pr_debug("readdir() left off=%d\n", ino);
8686
goto inside;
8787
}

‎fs/exofs/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ exofs_readdir(struct file *file, struct dir_context *ctx)
242242
unsigned long n = pos >> PAGE_SHIFT;
243243
unsigned long npages = dir_pages(inode);
244244
unsigned chunk_mask = ~(exofs_chunk_size(inode)-1);
245-
bool need_revalidate = inode_cmp_iversion(inode, file->f_version);
245+
bool need_revalidate = !inode_eq_iversion(inode, file->f_version);
246246

247247
if (pos > inode->i_size - EXOFS_DIR_REC_LEN(1))
248248
return 0;

‎fs/ext2/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ ext2_readdir(struct file *file, struct dir_context *ctx)
294294
unsigned long npages = dir_pages(inode);
295295
unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
296296
unsigned char *types = NULL;
297-
bool need_revalidate = inode_cmp_iversion(inode, file->f_version);
297+
bool need_revalidate = !inode_eq_iversion(inode, file->f_version);
298298

299299
if (pos > inode->i_size - EXT2_DIR_REC_LEN(1))
300300
return 0;

‎fs/ext4/dir.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx)
209209
* readdir(2), then we might be pointing to an invalid
210210
* dirent right now. Scan from the start of the block
211211
* to make sure. */
212-
if (inode_cmp_iversion(inode, file->f_version)) {
212+
if (!inode_eq_iversion(inode, file->f_version)) {
213213
for (i = 0; i < sb->s_blocksize && i < offset; ) {
214214
de = (struct ext4_dir_entry_2 *)
215215
(bh->b_data + i);
@@ -569,7 +569,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx)
569569
* cached entries.
570570
*/
571571
if ((!info->curr_node) ||
572-
inode_cmp_iversion(inode, file->f_version)) {
572+
!inode_eq_iversion(inode, file->f_version)) {
573573
info->curr_node = NULL;
574574
free_rb_tree_fname(&info->root);
575575
file->f_version = inode_query_iversion(inode);

‎fs/ext4/inline.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ int ext4_read_inline_dir(struct file *file,
14871487
* dirent right now. Scan from the start of the inline
14881488
* dir to make sure.
14891489
*/
1490-
if (inode_cmp_iversion(inode, file->f_version)) {
1490+
if (!inode_eq_iversion(inode, file->f_version)) {
14911491
for (i = 0; i < extra_size && i < offset;) {
14921492
/*
14931493
* "." is with offset 0 and

‎fs/fat/namei_vfat.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static int vfat_revalidate_shortname(struct dentry *dentry)
4646
{
4747
int ret = 1;
4848
spin_lock(&dentry->d_lock);
49-
if (inode_cmp_iversion(d_inode(dentry->d_parent), vfat_d_version(dentry)))
49+
if (!inode_eq_iversion(d_inode(dentry->d_parent), vfat_d_version(dentry)))
5050
ret = 0;
5151
spin_unlock(&dentry->d_lock);
5252
return ret;

‎fs/nfs/inode.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr
13141314

13151315
if ((fattr->valid & NFS_ATTR_FATTR_PRECHANGE)
13161316
&& (fattr->valid & NFS_ATTR_FATTR_CHANGE)
1317-
&& !inode_cmp_iversion_raw(inode, fattr->pre_change_attr)) {
1317+
&& inode_eq_iversion_raw(inode, fattr->pre_change_attr)) {
13181318
inode_set_iversion_raw(inode, fattr->change_attr);
13191319
if (S_ISDIR(inode->i_mode))
13201320
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
13731373

13741374
if (!nfs_file_has_buffered_writers(nfsi)) {
13751375
/* Verify a few of the more important attributes */
1376-
if ((fattr->valid & NFS_ATTR_FATTR_CHANGE) != 0 && inode_cmp_iversion_raw(inode, fattr->change_attr))
1376+
if ((fattr->valid & NFS_ATTR_FATTR_CHANGE) != 0 && !inode_eq_iversion_raw(inode, fattr->change_attr))
13771377
invalid |= NFS_INO_INVALID_ATTR | NFS_INO_REVAL_PAGECACHE;
13781378

13791379
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)
18031803

18041804
/* More cache consistency checks */
18051805
if (fattr->valid & NFS_ATTR_FATTR_CHANGE) {
1806-
if (inode_cmp_iversion_raw(inode, fattr->change_attr)) {
1806+
if (!inode_eq_iversion_raw(inode, fattr->change_attr)) {
18071807
dprintk("NFS: change_attr change on server for file %s/%ld\n",
18081808
inode->i_sb->s_id, inode->i_ino);
18091809
/* Could it be a race with writeback? */

‎fs/ocfs2/dir.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ static int ocfs2_dir_foreach_blk_id(struct inode *inode,
17761776
* readdir(2), then we might be pointing to an invalid
17771777
* dirent right now. Scan from the start of the block
17781778
* to make sure. */
1779-
if (inode_cmp_iversion(inode, *f_version)) {
1779+
if (!inode_eq_iversion(inode, *f_version)) {
17801780
for (i = 0; i < i_size_read(inode) && i < offset; ) {
17811781
de = (struct ocfs2_dir_entry *)
17821782
(data->id_data + i);
@@ -1870,7 +1870,7 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode,
18701870
* readdir(2), then we might be pointing to an invalid
18711871
* dirent right now. Scan from the start of the block
18721872
* to make sure. */
1873-
if (inode_cmp_iversion(inode, *f_version)) {
1873+
if (!inode_eq_iversion(inode, *f_version)) {
18741874
for (i = 0; i < sb->s_blocksize && i < offset; ) {
18751875
de = (struct ocfs2_dir_entry *) (bh->b_data + i);
18761876
/* It's too expensive to do a full

‎fs/ufs/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ ufs_readdir(struct file *file, struct dir_context *ctx)
429429
unsigned long n = pos >> PAGE_SHIFT;
430430
unsigned long npages = dir_pages(inode);
431431
unsigned chunk_mask = ~(UFS_SB(sb)->s_uspi->s_dirblksize - 1);
432-
bool need_revalidate = inode_cmp_iversion(inode, file->f_version);
432+
bool need_revalidate = !inode_eq_iversion(inode, file->f_version);
433433
unsigned flags = UFS_SB(sb)->s_flags;
434434

435435
UFSD("BEGIN\n");

‎include/linux/iversion.h‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
*
4646
* With this implementation, the value should always appear to observers to
4747
* increase over time if the file has changed. It's recommended to use
48-
* inode_cmp_iversion() helper to compare values.
48+
* inode_eq_iversion() helper to compare values.
4949
*
5050
* Note that some filesystems (e.g. NFS and AFS) just use the field to store
5151
* a server-provided value (for the most part). For that reason, those
@@ -305,33 +305,33 @@ inode_query_iversion(struct inode *inode)
305305
}
306306

307307
/**
308-
* inode_cmp_iversion_raw - check whether the raw i_version counter has changed
308+
* inode_eq_iversion_raw - check whether the raw i_version counter has changed
309309
* @inode: inode to check
310310
* @old: old value to check against its i_version
311311
*
312-
* Compare the current raw i_version counter with a previous one. Returns false
313-
* if they are the same or true if they are different.
312+
* Compare the current raw i_version counter with a previous one. Returns true
313+
* if they are the same or false if they are different.
314314
*/
315315
static inline bool
316-
inode_cmp_iversion_raw(const struct inode *inode, u64 old)
316+
inode_eq_iversion_raw(const struct inode *inode, u64 old)
317317
{
318-
return inode_peek_iversion_raw(inode) != old;
318+
return inode_peek_iversion_raw(inode) == old;
319319
}
320320

321321
/**
322-
* inode_cmp_iversion - check whether the i_version counter has changed
322+
* inode_eq_iversion - check whether the i_version counter has changed
323323
* @inode: inode to check
324324
* @old: old value to check against its i_version
325325
*
326-
* Compare an i_version counter with a previous one. Returns false if they are
327-
* the same, and true if they are different.
326+
* Compare an i_version counter with a previous one. Returns true if they are
327+
* the same, and false if they are different.
328328
*
329329
* Note that we don't need to set the QUERIED flag in this case, as the value
330330
* in the inode is not being recorded for later use.
331331
*/
332332
static inline bool
333-
inode_cmp_iversion(const struct inode *inode, u64 old)
333+
inode_eq_iversion(const struct inode *inode, u64 old)
334334
{
335-
return inode_peek_iversion(inode) != old;
335+
return inode_peek_iversion(inode) == old;
336336
}
337337
#endif

0 commit comments

Comments
 (0)