ufs: use new i_version API

Signed-off-by: Jeff Layton <jlayton@redhat.com>
This commit is contained in:
Jeff Layton 2017-12-11 06:35:18 -05:00
parent cc56c33e78
commit bb8c2d66bc
3 changed files with 9 additions and 6 deletions

View File

@ -20,6 +20,7 @@
#include <linux/time.h> #include <linux/time.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/swap.h> #include <linux/swap.h>
#include <linux/iversion.h>
#include "ufs_fs.h" #include "ufs_fs.h"
#include "ufs.h" #include "ufs.h"
@ -47,7 +48,7 @@ static int ufs_commit_chunk(struct page *page, loff_t pos, unsigned len)
struct inode *dir = mapping->host; struct inode *dir = mapping->host;
int err = 0; int err = 0;
dir->i_version++; inode_inc_iversion(dir);
block_write_end(NULL, mapping, pos, len, len, page, NULL); block_write_end(NULL, mapping, pos, len, len, page, NULL);
if (pos+len > dir->i_size) { if (pos+len > dir->i_size) {
i_size_write(dir, pos+len); i_size_write(dir, pos+len);
@ -428,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);
int need_revalidate = file->f_version != inode->i_version; bool need_revalidate = inode_cmp_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");
@ -455,8 +456,8 @@ ufs_readdir(struct file *file, struct dir_context *ctx)
offset = ufs_validate_entry(sb, kaddr, offset, chunk_mask); offset = ufs_validate_entry(sb, kaddr, offset, chunk_mask);
ctx->pos = (n<<PAGE_SHIFT) + offset; ctx->pos = (n<<PAGE_SHIFT) + offset;
} }
file->f_version = inode->i_version; file->f_version = inode_query_iversion(inode);
need_revalidate = 0; need_revalidate = false;
} }
de = (struct ufs_dir_entry *)(kaddr+offset); de = (struct ufs_dir_entry *)(kaddr+offset);
limit = kaddr + ufs_last_byte(inode, n) - UFS_DIR_REC_LEN(1); limit = kaddr + ufs_last_byte(inode, n) - UFS_DIR_REC_LEN(1);

View File

@ -36,6 +36,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/writeback.h> #include <linux/writeback.h>
#include <linux/iversion.h>
#include "ufs_fs.h" #include "ufs_fs.h"
#include "ufs.h" #include "ufs.h"
@ -693,7 +694,7 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino)
if (err) if (err)
goto bad_inode; goto bad_inode;
inode->i_version++; inode_inc_iversion(inode);
ufsi->i_lastfrag = ufsi->i_lastfrag =
(inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift; (inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift;
ufsi->i_dir_start_lookup = 0; ufsi->i_dir_start_lookup = 0;

View File

@ -88,6 +88,7 @@
#include <linux/log2.h> #include <linux/log2.h>
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/iversion.h>
#include "ufs_fs.h" #include "ufs_fs.h"
#include "ufs.h" #include "ufs.h"
@ -1440,7 +1441,7 @@ static struct inode *ufs_alloc_inode(struct super_block *sb)
if (!ei) if (!ei)
return NULL; return NULL;
ei->vfs_inode.i_version = 1; inode_set_iversion(&ei->vfs_inode, 1);
seqlock_init(&ei->meta_lock); seqlock_init(&ei->meta_lock);
mutex_init(&ei->truncate_mutex); mutex_init(&ei->truncate_mutex);
return &ei->vfs_inode; return &ei->vfs_inode;