Skip to content

Commit c2050a4

Browse files
deepa-hubAl Viro
authored andcommitted
fs: Replace current_fs_time() with current_time()
current_fs_time() uses struct super_block* as an argument. As per Linus's suggestion, this is changed to take struct inode* as a parameter instead. This is because the function is primarily meant for vfs inode timestamps. Also the function was renamed as per Arnd's suggestion. Change all calls to current_fs_time() to use the new current_time() function instead. current_fs_time() will be deleted. Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 02027d4 commit c2050a4

34 files changed

Lines changed: 70 additions & 70 deletions

‎drivers/char/sonypi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
934934

935935
if (ret > 0) {
936936
struct inode *inode = file_inode(file);
937-
inode->i_atime = current_fs_time(inode->i_sb);
937+
inode->i_atime = current_time(inode);
938938
}
939939

940940
return ret;

‎drivers/platform/x86/sony-laptop.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4116,7 +4116,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
41164116

41174117
if (ret > 0) {
41184118
struct inode *inode = file_inode(file);
4119-
inode->i_atime = current_fs_time(inode->i_sb);
4119+
inode->i_atime = current_time(inode);
41204120
}
41214121

41224122
return ret;

‎fs/attr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de
209209
inode->i_flags &= ~S_NOSEC;
210210
}
211211

212-
now = current_fs_time(inode->i_sb);
212+
now = current_time(inode);
213213

214214
attr->ia_ctime = now;
215215
if (!(ia_valid & ATTR_ATIME_SET))

‎fs/bad_inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ void make_bad_inode(struct inode *inode)
173173

174174
inode->i_mode = S_IFREG;
175175
inode->i_atime = inode->i_mtime = inode->i_ctime =
176-
current_fs_time(inode->i_sb);
176+
current_time(inode);
177177
inode->i_op = &bad_inode_ops;
178178
inode->i_fop = &bad_file_ops;
179179
}

‎fs/binfmt_misc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode)
584584
inode->i_ino = get_next_ino();
585585
inode->i_mode = mode;
586586
inode->i_atime = inode->i_mtime = inode->i_ctime =
587-
current_fs_time(inode->i_sb);
587+
current_time(inode);
588588
}
589589
return inode;
590590
}

‎fs/btrfs/file.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,7 +1757,7 @@ static void update_time_for_write(struct inode *inode)
17571757
if (IS_NOCMTIME(inode))
17581758
return;
17591759

1760-
now = current_fs_time(inode->i_sb);
1760+
now = current_time(inode);
17611761
if (!timespec_equal(&inode->i_mtime, &now))
17621762
inode->i_mtime = now;
17631763

@@ -2578,7 +2578,7 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len)
25782578
goto out_free;
25792579

25802580
inode_inc_iversion(inode);
2581-
inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
2581+
inode->i_mtime = inode->i_ctime = current_time(inode);
25822582

25832583
trans->block_rsv = &root->fs_info->trans_block_rsv;
25842584
ret = btrfs_update_inode(trans, root, inode);
@@ -2842,7 +2842,7 @@ static long btrfs_fallocate(struct file *file, int mode,
28422842
if (IS_ERR(trans)) {
28432843
ret = PTR_ERR(trans);
28442844
} else {
2845-
inode->i_ctime = current_fs_time(inode->i_sb);
2845+
inode->i_ctime = current_time(inode);
28462846
i_size_write(inode, actual_end);
28472847
btrfs_ordered_update_i_size(inode, actual_end, NULL);
28482848
ret = btrfs_update_inode(trans, root, inode);

‎fs/btrfs/inode.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4059,7 +4059,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
40594059
inode_inc_iversion(inode);
40604060
inode_inc_iversion(dir);
40614061
inode->i_ctime = dir->i_mtime =
4062-
dir->i_ctime = current_fs_time(inode->i_sb);
4062+
dir->i_ctime = current_time(inode);
40634063
ret = btrfs_update_inode(trans, root, dir);
40644064
out:
40654065
return ret;
@@ -4202,7 +4202,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
42024202

42034203
btrfs_i_size_write(dir, dir->i_size - name_len * 2);
42044204
inode_inc_iversion(dir);
4205-
dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
4205+
dir->i_mtime = dir->i_ctime = current_time(dir);
42064206
ret = btrfs_update_inode_fallback(trans, root, dir);
42074207
if (ret)
42084208
btrfs_abort_transaction(trans, ret);
@@ -4965,7 +4965,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
49654965
inode_inc_iversion(inode);
49664966
if (!(mask & (ATTR_CTIME | ATTR_MTIME)))
49674967
inode->i_ctime = inode->i_mtime =
4968-
current_fs_time(inode->i_sb);
4968+
current_time(inode);
49694969
}
49704970

49714971
if (newsize > oldsize) {
@@ -5672,7 +5672,7 @@ static struct inode *new_simple_dir(struct super_block *s,
56725672
inode->i_op = &btrfs_dir_ro_inode_operations;
56735673
inode->i_fop = &simple_dir_operations;
56745674
inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO;
5675-
inode->i_mtime = current_fs_time(inode->i_sb);
5675+
inode->i_mtime = current_time(inode);
56765676
inode->i_atime = inode->i_mtime;
56775677
inode->i_ctime = inode->i_mtime;
56785678
BTRFS_I(inode)->i_otime = inode->i_mtime;
@@ -6258,7 +6258,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
62586258
inode_init_owner(inode, dir, mode);
62596259
inode_set_bytes(inode, 0);
62606260

6261-
inode->i_mtime = current_fs_time(inode->i_sb);
6261+
inode->i_mtime = current_time(inode);
62626262
inode->i_atime = inode->i_mtime;
62636263
inode->i_ctime = inode->i_mtime;
62646264
BTRFS_I(inode)->i_otime = inode->i_mtime;
@@ -6372,7 +6372,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
63726372
name_len * 2);
63736373
inode_inc_iversion(parent_inode);
63746374
parent_inode->i_mtime = parent_inode->i_ctime =
6375-
current_fs_time(parent_inode->i_sb);
6375+
current_time(parent_inode);
63766376
ret = btrfs_update_inode(trans, root, parent_inode);
63776377
if (ret)
63786378
btrfs_abort_transaction(trans, ret);
@@ -6590,7 +6590,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
65906590
BTRFS_I(inode)->dir_index = 0ULL;
65916591
inc_nlink(inode);
65926592
inode_inc_iversion(inode);
6593-
inode->i_ctime = current_fs_time(inode->i_sb);
6593+
inode->i_ctime = current_time(inode);
65946594
ihold(inode);
65956595
set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags);
65966596

@@ -9492,7 +9492,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
94929492
struct btrfs_root *dest = BTRFS_I(new_dir)->root;
94939493
struct inode *new_inode = new_dentry->d_inode;
94949494
struct inode *old_inode = old_dentry->d_inode;
9495-
struct timespec ctime = CURRENT_TIME;
9495+
struct timespec ctime = current_time(old_inode);
94969496
struct dentry *parent;
94979497
u64 old_ino = btrfs_ino(old_inode);
94989498
u64 new_ino = btrfs_ino(new_inode);
@@ -9860,7 +9860,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
98609860
inode_inc_iversion(old_inode);
98619861
old_dir->i_ctime = old_dir->i_mtime =
98629862
new_dir->i_ctime = new_dir->i_mtime =
9863-
old_inode->i_ctime = current_fs_time(old_dir->i_sb);
9863+
old_inode->i_ctime = current_time(old_dir);
98649864

98659865
if (old_dentry->d_parent != new_dentry->d_parent)
98669866
btrfs_record_unlink_dir(trans, old_dir, old_inode, 1);
@@ -9885,7 +9885,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
98859885

98869886
if (new_inode) {
98879887
inode_inc_iversion(new_inode);
9888-
new_inode->i_ctime = current_fs_time(new_inode->i_sb);
9888+
new_inode->i_ctime = current_time(new_inode);
98899889
if (unlikely(btrfs_ino(new_inode) ==
98909890
BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) {
98919891
root_objectid = BTRFS_I(new_inode)->location.objectid;
@@ -10403,7 +10403,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
1040310403
*alloc_hint = ins.objectid + ins.offset;
1040410404

1040510405
inode_inc_iversion(inode);
10406-
inode->i_ctime = current_fs_time(inode->i_sb);
10406+
inode->i_ctime = current_time(inode);
1040710407
BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC;
1040810408
if (!(mode & FALLOC_FL_KEEP_SIZE) &&
1040910409
(actual_len > inode->i_size) &&

‎fs/btrfs/ioctl.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
349349

350350
btrfs_update_iflags(inode);
351351
inode_inc_iversion(inode);
352-
inode->i_ctime = current_fs_time(inode->i_sb);
352+
inode->i_ctime = current_time(inode);
353353
ret = btrfs_update_inode(trans, root, inode);
354354

355355
btrfs_end_transaction(trans, root);
@@ -445,7 +445,7 @@ static noinline int create_subvol(struct inode *dir,
445445
struct btrfs_root *root = BTRFS_I(dir)->root;
446446
struct btrfs_root *new_root;
447447
struct btrfs_block_rsv block_rsv;
448-
struct timespec cur_time = current_fs_time(dir->i_sb);
448+
struct timespec cur_time = current_time(dir);
449449
struct inode *inode;
450450
int ret;
451451
int err;
@@ -3279,7 +3279,7 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans,
32793279

32803280
inode_inc_iversion(inode);
32813281
if (!no_time_update)
3282-
inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
3282+
inode->i_mtime = inode->i_ctime = current_time(inode);
32833283
/*
32843284
* We round up to the block size at eof when determining which
32853285
* extents to clone above, but shouldn't round up the file size.
@@ -5094,7 +5094,7 @@ static long _btrfs_ioctl_set_received_subvol(struct file *file,
50945094
struct btrfs_root *root = BTRFS_I(inode)->root;
50955095
struct btrfs_root_item *root_item = &root->root_item;
50965096
struct btrfs_trans_handle *trans;
5097-
struct timespec ct = current_fs_time(inode->i_sb);
5097+
struct timespec ct = current_time(inode);
50985098
int ret = 0;
50995099
int received_uuid_changed;
51005100

‎fs/btrfs/transaction.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
14741474
parent_root = BTRFS_I(parent_inode)->root;
14751475
record_root_in_trans(trans, parent_root, 0);
14761476

1477-
cur_time = current_fs_time(parent_inode->i_sb);
1477+
cur_time = current_time(parent_inode);
14781478

14791479
/*
14801480
* insert the directory item
@@ -1630,7 +1630,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
16301630
btrfs_i_size_write(parent_inode, parent_inode->i_size +
16311631
dentry->d_name.len * 2);
16321632
parent_inode->i_mtime = parent_inode->i_ctime =
1633-
current_fs_time(parent_inode->i_sb);
1633+
current_time(parent_inode);
16341634
ret = btrfs_update_inode_fallback(trans, parent_root, parent_inode);
16351635
if (ret) {
16361636
btrfs_abort_transaction(trans, ret);

‎fs/btrfs/xattr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ int __btrfs_setxattr(struct btrfs_trans_handle *trans,
252252
goto out;
253253

254254
inode_inc_iversion(inode);
255-
inode->i_ctime = current_fs_time(inode->i_sb);
255+
inode->i_ctime = current_time(inode);
256256
set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags);
257257
ret = btrfs_update_inode(trans, root, inode);
258258
BUG_ON(ret);

0 commit comments

Comments
 (0)