Skip to contentSkip to conversation

fs: remove unnecessary i_version handling from various filesystems

PATCH RESEND Applied Jeff Layton 2 participants 5 messages Dec 7, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover fs: remove unnecessary i_version handling from various filesystems

From: Jeff Layton <[email protected]>

Hi Andrew,

I sent these patches to the various fs maintainers prior to the last merge window, but they didn't get picked up. This is mainly removing i_version/f_version handling from filesystems that don't implement it properly, and that don't use it anyway.

This is almost certainly the result of cargo-cult copying from other filesystems.

Would you be willing to merge these for the v4.16 window?

Thanks,
Jeff

Jeff Layton (3):
lustre: don't set f_version in ll_readdir
ntfs: remove i_version handling
hpfs: don't bother with the i_version counter or f_version

 drivers/staging/lustre/lustre/llite/dir.c | 3 ---
 fs/hpfs/dir.c                             | 1 -
 fs/hpfs/dnode.c                           | 2 --
 fs/hpfs/super.c                           | 1 -
 fs/ntfs/inode.c                           | 9 ---------
 fs/ntfs/mft.c                             | 6 ------
 6 files changed, 22 deletions(-)
Signature · 1 line
2.14.3
#1 lore raw

PATCH RESEND 1/3 lustre: don't set f_version in ll_readdir

From: Jeff Layton <[email protected]>

f_version is only ever used by filesystem-specific code. Generic VFS code never uses it.

Nothing in lustre ever looks at it, so just remove this.

---
 drivers/staging/lustre/lustre/llite/dir.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +0 -3
index 5b2e47c246f3..6f59045be0f9 100644
@@ -369,8 +369,6 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx)
 	}
 	ctx->pos = pos;
 	ll_finish_md_op_data(op_data);
-	filp->f_version = inode->i_version;
-
 out:
 	if (!rc)
 		ll_stats_ops_tally(sbi, LPROC_LL_READDIR, 1);
@@ -1678,7 +1676,6 @@ static loff_t ll_dir_seek(struct file *file, loff_t offset, int origin)
 			else
 				fd->lfd_pos = offset;
 			file->f_pos = offset;
-			file->f_version = 0;
 		}
 		ret = offset;
 	}
Signature · 1 line
2.14.3
#2 lore raw

PATCH RESEND 2/3 ntfs: remove i_version handling

In reply to Jeff Layton

From: Jeff Layton <[email protected]>

NTFS keeps track of the i_version counter here, seemingly for no reason. It does not set the SB_I_VERSION flag so it'll never be incremented on write, and it doesn't increment it internally for metadata operations.

---
 fs/ntfs/inode.c | 9 ---------
 fs/ntfs/mft.c   | 6 ------
 2 files changed, 15 deletions(-)
fs/ntfs/inode.c +0 -9
index 7c410f879412..1c1ee489284b 100644
@@ -560,13 +560,6 @@ static int ntfs_read_locked_inode(struct inode *vi)
 	ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino);
 
 	/* Setup the generic vfs inode parts now. */
-
-	/*
-	 * This is for checking whether an inode has changed w.r.t. a file so
-	 * that the file can be updated if necessary (compare with f_version).
-	 */
-	vi->i_version = 1;
-
 	vi->i_uid = vol->uid;
 	vi->i_gid = vol->gid;
 	vi->i_mode = 0;
@@ -1240,7 +1233,6 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 	base_ni = NTFS_I(base_vi);
 
 	/* Just mirror the values from the base inode. */
-	vi->i_version	= base_vi->i_version;
 	vi->i_uid	= base_vi->i_uid;
 	vi->i_gid	= base_vi->i_gid;
 	set_nlink(vi, base_vi->i_nlink);
@@ -1507,7 +1499,6 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
 	ni	= NTFS_I(vi);
 	base_ni = NTFS_I(base_vi);
 	/* Just mirror the values from the base inode. */
-	vi->i_version	= base_vi->i_version;
 	vi->i_uid	= base_vi->i_uid;
 	vi->i_gid	= base_vi->i_gid;
 	set_nlink(vi, base_vi->i_nlink);
fs/ntfs/mft.c +0 -6
index ee8392aee9f6..2831f495a674 100644
@@ -2641,12 +2641,6 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, const int mode,
 			goto undo_mftbmp_alloc;
 		}
 		vi->i_ino = bit;
-		/*
-		 * This is for checking whether an inode has changed w.r.t. a
-		 * file so that the file can be updated if necessary (compare
-		 * with f_version).
-		 */
-		vi->i_version = 1;
 
 		/* The owner and group come from the ntfs volume. */
 		vi->i_uid = vol->uid;
Signature · 1 line
2.14.3
#3 lore raw

PATCH RESEND 3/3 hpfs: don't bother with the i_version counter or f_version

In reply to Jeff Layton

From: Jeff Layton <[email protected]>

HPFS does not set SB_I_VERSION and does not use the i_version counter internally.

---
 fs/hpfs/dir.c   | 1 -
 fs/hpfs/dnode.c | 2 --
 fs/hpfs/super.c | 1 -
 3 files changed, 4 deletions(-)
fs/hpfs/dir.c +0 -1
index 8d6b7e35faf9..c83ece7facc5 100644
@@ -150,7 +150,6 @@ static int hpfs_readdir(struct file *file, struct dir_context *ctx)
 			if (unlikely(ret < 0))
 				goto out;
 			ctx->pos = ((loff_t) hpfs_de_as_down_as_possible(inode->i_sb, hpfs_inode->i_dno) << 4) + 1;
-			file->f_version = inode->i_version;
 		}
 		next_pos = ctx->pos;
 		if (!(de = map_pos_dirent(inode, &next_pos, &qbh))) {
fs/hpfs/dnode.c +0 -2
index 3b834563b1f1..a4ad18afbdec 100644
@@ -419,7 +419,6 @@ int hpfs_add_dirent(struct inode *i,
 		c = 1;
 		goto ret;
 	}	
-	i->i_version++;
 	c = hpfs_add_to_dnode(i, dno, name, namelen, new_de, 0);
 	ret:
 	return c;
@@ -726,7 +725,6 @@ int hpfs_remove_dirent(struct inode *i, dnode_secno dno, struct hpfs_dirent *de,
 			return 2;
 		}
 	}
-	i->i_version++;
 	for_all_poss(i, hpfs_pos_del, (t = get_pos(dnode, de)) + 1, 1);
 	hpfs_delete_de(i->i_sb, dnode, de);
 	hpfs_mark_4buffers_dirty(qbh);
fs/hpfs/super.c +0 -1
index c45a3b9b9ac7..f2c3ebcd309c 100644
@@ -235,7 +235,6 @@ static struct inode *hpfs_alloc_inode(struct super_block *sb)
 	ei = kmem_cache_alloc(hpfs_inode_cachep, GFP_NOFS);
 	if (!ei)
 		return NULL;
-	ei->vfs_inode.i_version = 1;
 	return &ei->vfs_inode;
 }
 
Signature · 1 line
2.14.3
#4 lore raw
In reply to Jeff Layton

Hi,

Yes please to merging the ntfs one at least.

And guilty as charged on the cargo-cult copying... (-;

Best regards,

Anton

On 7 Dec 2017, at 11:32, Jeff Layton <[email protected]<mailto:[email protected]>> wrote:

From: Jeff Layton <[email protected]<mailto:[email protected]>>

Hi Andrew,

I sent these patches to the various fs maintainers prior to the last merge window, but they didn't get picked up. This is mainly removing i_version/f_version handling from filesystems that don't implement it properly, and that don't use it anyway.

This is almost certainly the result of cargo-cult copying from other filesystems.

Would you be willing to merge these for the v4.16 window?

Thanks,
Jeff

Jeff Layton (3):
lustre: don't set f_version in ll_readdir
ntfs: remove i_version handling
hpfs: don't bother with the i_version counter or f_version

drivers/staging/lustre/lustre/llite/dir.c | 3 ---
fs/hpfs/dir.c                             | 1 -
fs/hpfs/dnode.c                           | 2 --
fs/hpfs/super.c                           | 1 -
fs/ntfs/inode.c                           | 9 ---------
fs/ntfs/mft.c                             | 6 ------
6 files changed, 22 deletions(-)

--
2.14.3

--
Anton Altaparmakov <anton at tuxera.com<http://tuxera.com>> (replace at with @) Lead in File System Development, Tuxera Inc., http://www.tuxera.com/
Linux NTFS maintainer

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Linux-NTFS-Dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-ntfs-dev