diff options
author | Jeff Layton <jlayton@redhat.com> | 2017-12-11 06:35:09 -0500 |
---|---|---|
committer | Jeff Layton <jlayton@redhat.com> | 2018-01-29 06:42:20 -0500 |
commit | 2489dbabea80e8c075eb01bf195d8bb0b1440dd2 (patch) | |
tree | f4698270eff79f02ec615024ea2deb51eb227188 | |
parent | 7594c461161745f0d38a4346d4f895e0837b8094 (diff) |
fat: convert to new i_version API
Signed-off-by: Jeff Layton <jlayton@redhat.com>
-rw-r--r-- | fs/fat/dir.c | 3 | ||||
-rw-r--r-- | fs/fat/inode.c | 9 | ||||
-rw-r--r-- | fs/fat/namei_msdos.c | 7 | ||||
-rw-r--r-- | fs/fat/namei_vfat.c | 22 |
4 files changed, 22 insertions, 19 deletions
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index b833ffeee1e1..8e100c3bf72c 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/compat.h> | 17 | #include <linux/compat.h> |
18 | #include <linux/uaccess.h> | 18 | #include <linux/uaccess.h> |
19 | #include <linux/iversion.h> | ||
19 | #include "fat.h" | 20 | #include "fat.h" |
20 | 21 | ||
21 | /* | 22 | /* |
@@ -1055,7 +1056,7 @@ int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo) | |||
1055 | brelse(bh); | 1056 | brelse(bh); |
1056 | if (err) | 1057 | if (err) |
1057 | return err; | 1058 | return err; |
1058 | dir->i_version++; | 1059 | inode_inc_iversion(dir); |
1059 | 1060 | ||
1060 | if (nr_slots) { | 1061 | if (nr_slots) { |
1061 | /* | 1062 | /* |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 20a0a89eaca5..ffbbf0520d9e 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/blkdev.h> | 20 | #include <linux/blkdev.h> |
21 | #include <linux/backing-dev.h> | 21 | #include <linux/backing-dev.h> |
22 | #include <asm/unaligned.h> | 22 | #include <asm/unaligned.h> |
23 | #include <linux/iversion.h> | ||
23 | #include "fat.h" | 24 | #include "fat.h" |
24 | 25 | ||
25 | #ifndef CONFIG_FAT_DEFAULT_IOCHARSET | 26 | #ifndef CONFIG_FAT_DEFAULT_IOCHARSET |
@@ -507,7 +508,7 @@ int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) | |||
507 | MSDOS_I(inode)->i_pos = 0; | 508 | MSDOS_I(inode)->i_pos = 0; |
508 | inode->i_uid = sbi->options.fs_uid; | 509 | inode->i_uid = sbi->options.fs_uid; |
509 | inode->i_gid = sbi->options.fs_gid; | 510 | inode->i_gid = sbi->options.fs_gid; |
510 | inode->i_version++; | 511 | inode_inc_iversion(inode); |
511 | inode->i_generation = get_seconds(); | 512 | inode->i_generation = get_seconds(); |
512 | 513 | ||
513 | if ((de->attr & ATTR_DIR) && !IS_FREE(de->name)) { | 514 | if ((de->attr & ATTR_DIR) && !IS_FREE(de->name)) { |
@@ -590,7 +591,7 @@ struct inode *fat_build_inode(struct super_block *sb, | |||
590 | goto out; | 591 | goto out; |
591 | } | 592 | } |
592 | inode->i_ino = iunique(sb, MSDOS_ROOT_INO); | 593 | inode->i_ino = iunique(sb, MSDOS_ROOT_INO); |
593 | inode->i_version = 1; | 594 | inode_set_iversion(inode, 1); |
594 | err = fat_fill_inode(inode, de); | 595 | err = fat_fill_inode(inode, de); |
595 | if (err) { | 596 | if (err) { |
596 | iput(inode); | 597 | iput(inode); |
@@ -1377,7 +1378,7 @@ static int fat_read_root(struct inode *inode) | |||
1377 | MSDOS_I(inode)->i_pos = MSDOS_ROOT_INO; | 1378 | MSDOS_I(inode)->i_pos = MSDOS_ROOT_INO; |
1378 | inode->i_uid = sbi->options.fs_uid; | 1379 | inode->i_uid = sbi->options.fs_uid; |
1379 | inode->i_gid = sbi->options.fs_gid; | 1380 | inode->i_gid = sbi->options.fs_gid; |
1380 | inode->i_version++; | 1381 | inode_inc_iversion(inode); |
1381 | inode->i_generation = 0; | 1382 | inode->i_generation = 0; |
1382 | inode->i_mode = fat_make_mode(sbi, ATTR_DIR, S_IRWXUGO); | 1383 | inode->i_mode = fat_make_mode(sbi, ATTR_DIR, S_IRWXUGO); |
1383 | inode->i_op = sbi->dir_ops; | 1384 | inode->i_op = sbi->dir_ops; |
@@ -1828,7 +1829,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, | |||
1828 | if (!root_inode) | 1829 | if (!root_inode) |
1829 | goto out_fail; | 1830 | goto out_fail; |
1830 | root_inode->i_ino = MSDOS_ROOT_INO; | 1831 | root_inode->i_ino = MSDOS_ROOT_INO; |
1831 | root_inode->i_version = 1; | 1832 | inode_set_iversion(root_inode, 1); |
1832 | error = fat_read_root(root_inode); | 1833 | error = fat_read_root(root_inode); |
1833 | if (error < 0) { | 1834 | if (error < 0) { |
1834 | iput(root_inode); | 1835 | iput(root_inode); |
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index d24d2758a363..582ca731a6c9 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/iversion.h> | ||
10 | #include "fat.h" | 11 | #include "fat.h" |
11 | 12 | ||
12 | /* Characters that are undesirable in an MS-DOS file name */ | 13 | /* Characters that are undesirable in an MS-DOS file name */ |
@@ -480,7 +481,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name, | |||
480 | } else | 481 | } else |
481 | mark_inode_dirty(old_inode); | 482 | mark_inode_dirty(old_inode); |
482 | 483 | ||
483 | old_dir->i_version++; | 484 | inode_inc_iversion(old_dir); |
484 | old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); | 485 | old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); |
485 | if (IS_DIRSYNC(old_dir)) | 486 | if (IS_DIRSYNC(old_dir)) |
486 | (void)fat_sync_inode(old_dir); | 487 | (void)fat_sync_inode(old_dir); |
@@ -508,7 +509,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name, | |||
508 | goto out; | 509 | goto out; |
509 | new_i_pos = sinfo.i_pos; | 510 | new_i_pos = sinfo.i_pos; |
510 | } | 511 | } |
511 | new_dir->i_version++; | 512 | inode_inc_iversion(new_dir); |
512 | 513 | ||
513 | fat_detach(old_inode); | 514 | fat_detach(old_inode); |
514 | fat_attach(old_inode, new_i_pos); | 515 | fat_attach(old_inode, new_i_pos); |
@@ -540,7 +541,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name, | |||
540 | old_sinfo.bh = NULL; | 541 | old_sinfo.bh = NULL; |
541 | if (err) | 542 | if (err) |
542 | goto error_dotdot; | 543 | goto error_dotdot; |
543 | old_dir->i_version++; | 544 | inode_inc_iversion(old_dir); |
544 | old_dir->i_ctime = old_dir->i_mtime = ts; | 545 | old_dir->i_ctime = old_dir->i_mtime = ts; |
545 | if (IS_DIRSYNC(old_dir)) | 546 | if (IS_DIRSYNC(old_dir)) |
546 | (void)fat_sync_inode(old_dir); | 547 | (void)fat_sync_inode(old_dir); |
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index 02c066663a3a..cefea792cde8 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/namei.h> | 21 | #include <linux/namei.h> |
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | 23 | #include <linux/iversion.h> | |
24 | #include "fat.h" | 24 | #include "fat.h" |
25 | 25 | ||
26 | static inline unsigned long vfat_d_version(struct dentry *dentry) | 26 | static inline unsigned long vfat_d_version(struct dentry *dentry) |
@@ -46,7 +46,7 @@ static int vfat_revalidate_shortname(struct dentry *dentry) | |||
46 | { | 46 | { |
47 | int ret = 1; | 47 | int ret = 1; |
48 | spin_lock(&dentry->d_lock); | 48 | spin_lock(&dentry->d_lock); |
49 | if (vfat_d_version(dentry) != d_inode(dentry->d_parent)->i_version) | 49 | if (inode_cmp_iversion(d_inode(dentry->d_parent), vfat_d_version(dentry))) |
50 | ret = 0; | 50 | ret = 0; |
51 | spin_unlock(&dentry->d_lock); | 51 | spin_unlock(&dentry->d_lock); |
52 | return ret; | 52 | return ret; |
@@ -759,7 +759,7 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, | |||
759 | out: | 759 | out: |
760 | mutex_unlock(&MSDOS_SB(sb)->s_lock); | 760 | mutex_unlock(&MSDOS_SB(sb)->s_lock); |
761 | if (!inode) | 761 | if (!inode) |
762 | vfat_d_version_set(dentry, dir->i_version); | 762 | vfat_d_version_set(dentry, inode_query_iversion(dir)); |
763 | return d_splice_alias(inode, dentry); | 763 | return d_splice_alias(inode, dentry); |
764 | error: | 764 | error: |
765 | mutex_unlock(&MSDOS_SB(sb)->s_lock); | 765 | mutex_unlock(&MSDOS_SB(sb)->s_lock); |
@@ -781,7 +781,7 @@ static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
781 | err = vfat_add_entry(dir, &dentry->d_name, 0, 0, &ts, &sinfo); | 781 | err = vfat_add_entry(dir, &dentry->d_name, 0, 0, &ts, &sinfo); |
782 | if (err) | 782 | if (err) |
783 | goto out; | 783 | goto out; |
784 | dir->i_version++; | 784 | inode_inc_iversion(dir); |
785 | 785 | ||
786 | inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos); | 786 | inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos); |
787 | brelse(sinfo.bh); | 787 | brelse(sinfo.bh); |
@@ -789,7 +789,7 @@ static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
789 | err = PTR_ERR(inode); | 789 | err = PTR_ERR(inode); |
790 | goto out; | 790 | goto out; |
791 | } | 791 | } |
792 | inode->i_version++; | 792 | inode_inc_iversion(inode); |
793 | inode->i_mtime = inode->i_atime = inode->i_ctime = ts; | 793 | inode->i_mtime = inode->i_atime = inode->i_ctime = ts; |
794 | /* timestamp is already written, so mark_inode_dirty() is unneeded. */ | 794 | /* timestamp is already written, so mark_inode_dirty() is unneeded. */ |
795 | 795 | ||
@@ -823,7 +823,7 @@ static int vfat_rmdir(struct inode *dir, struct dentry *dentry) | |||
823 | clear_nlink(inode); | 823 | clear_nlink(inode); |
824 | inode->i_mtime = inode->i_atime = current_time(inode); | 824 | inode->i_mtime = inode->i_atime = current_time(inode); |
825 | fat_detach(inode); | 825 | fat_detach(inode); |
826 | vfat_d_version_set(dentry, dir->i_version); | 826 | vfat_d_version_set(dentry, inode_query_iversion(dir)); |
827 | out: | 827 | out: |
828 | mutex_unlock(&MSDOS_SB(sb)->s_lock); | 828 | mutex_unlock(&MSDOS_SB(sb)->s_lock); |
829 | 829 | ||
@@ -849,7 +849,7 @@ static int vfat_unlink(struct inode *dir, struct dentry *dentry) | |||
849 | clear_nlink(inode); | 849 | clear_nlink(inode); |
850 | inode->i_mtime = inode->i_atime = current_time(inode); | 850 | inode->i_mtime = inode->i_atime = current_time(inode); |
851 | fat_detach(inode); | 851 | fat_detach(inode); |
852 | vfat_d_version_set(dentry, dir->i_version); | 852 | vfat_d_version_set(dentry, inode_query_iversion(dir)); |
853 | out: | 853 | out: |
854 | mutex_unlock(&MSDOS_SB(sb)->s_lock); | 854 | mutex_unlock(&MSDOS_SB(sb)->s_lock); |
855 | 855 | ||
@@ -875,7 +875,7 @@ static int vfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
875 | err = vfat_add_entry(dir, &dentry->d_name, 1, cluster, &ts, &sinfo); | 875 | err = vfat_add_entry(dir, &dentry->d_name, 1, cluster, &ts, &sinfo); |
876 | if (err) | 876 | if (err) |
877 | goto out_free; | 877 | goto out_free; |
878 | dir->i_version++; | 878 | inode_inc_iversion(dir); |
879 | inc_nlink(dir); | 879 | inc_nlink(dir); |
880 | 880 | ||
881 | inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos); | 881 | inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos); |
@@ -885,7 +885,7 @@ static int vfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
885 | /* the directory was completed, just return a error */ | 885 | /* the directory was completed, just return a error */ |
886 | goto out; | 886 | goto out; |
887 | } | 887 | } |
888 | inode->i_version++; | 888 | inode_inc_iversion(inode); |
889 | set_nlink(inode, 2); | 889 | set_nlink(inode, 2); |
890 | inode->i_mtime = inode->i_atime = inode->i_ctime = ts; | 890 | inode->i_mtime = inode->i_atime = inode->i_ctime = ts; |
891 | /* timestamp is already written, so mark_inode_dirty() is unneeded. */ | 891 | /* timestamp is already written, so mark_inode_dirty() is unneeded. */ |
@@ -951,7 +951,7 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
951 | goto out; | 951 | goto out; |
952 | new_i_pos = sinfo.i_pos; | 952 | new_i_pos = sinfo.i_pos; |
953 | } | 953 | } |
954 | new_dir->i_version++; | 954 | inode_inc_iversion(new_dir); |
955 | 955 | ||
956 | fat_detach(old_inode); | 956 | fat_detach(old_inode); |
957 | fat_attach(old_inode, new_i_pos); | 957 | fat_attach(old_inode, new_i_pos); |
@@ -979,7 +979,7 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
979 | old_sinfo.bh = NULL; | 979 | old_sinfo.bh = NULL; |
980 | if (err) | 980 | if (err) |
981 | goto error_dotdot; | 981 | goto error_dotdot; |
982 | old_dir->i_version++; | 982 | inode_inc_iversion(old_dir); |
983 | old_dir->i_ctime = old_dir->i_mtime = ts; | 983 | old_dir->i_ctime = old_dir->i_mtime = ts; |
984 | if (IS_DIRSYNC(old_dir)) | 984 | if (IS_DIRSYNC(old_dir)) |
985 | (void)fat_sync_inode(old_dir); | 985 | (void)fat_sync_inode(old_dir); |