Skip to content

Commit 11068e0

Browse files
committed
fs: remove f_version
Now that detecting concurrent seeks is done by the filesystems that require it we can remove f_version and free up 8 bytes for future extensions. Link: https://lore.kernel.org/r/20240830-vfs-file-f_version-v1-20-6d3e4816aa7b@kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 5a957bb commit 11068e0

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

fs/read_write.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ static loff_t vfs_setpos_cookie(struct file *file, loff_t offset,
6262

6363
if (offset != file->f_pos) {
6464
file->f_pos = offset;
65-
*cookie = 0;
65+
if (cookie)
66+
*cookie = 0;
6667
}
6768
return offset;
6869
}
@@ -81,7 +82,7 @@ static loff_t vfs_setpos_cookie(struct file *file, loff_t offset,
8182
*/
8283
loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize)
8384
{
84-
return vfs_setpos_cookie(file, offset, maxsize, &file->f_version);
85+
return vfs_setpos_cookie(file, offset, maxsize, NULL);
8586
}
8687
EXPORT_SYMBOL(vfs_setpos);
8788

@@ -364,10 +365,8 @@ loff_t default_llseek(struct file *file, loff_t offset, int whence)
364365
}
365366
retval = -EINVAL;
366367
if (offset >= 0 || unsigned_offsets(file)) {
367-
if (offset != file->f_pos) {
368+
if (offset != file->f_pos)
368369
file->f_pos = offset;
369-
file->f_version = 0;
370-
}
371370
retval = offset;
372371
}
373372
out:

include/linux/fs.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,6 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
10031003
* @f_pos_lock: lock protecting file position
10041004
* @f_pipe: specific to pipes
10051005
* @f_pos: file position
1006-
* @f_version: file version
10071006
* @f_security: LSM security context of this file
10081007
* @f_owner: file owner
10091008
* @f_wb_err: writeback error
@@ -1034,11 +1033,10 @@ struct file {
10341033
u64 f_pipe;
10351034
};
10361035
loff_t f_pos;
1037-
u64 f_version;
1038-
/* --- cacheline 2 boundary (128 bytes) --- */
10391036
#ifdef CONFIG_SECURITY
10401037
void *f_security;
10411038
#endif
1039+
/* --- cacheline 2 boundary (128 bytes) --- */
10421040
struct fown_struct *f_owner;
10431041
errseq_t f_wb_err;
10441042
errseq_t f_sb_err;

0 commit comments

Comments
 (0)