diff options
author | Deepa Dinamani <deepa.kernel@gmail.com> | 2016-02-07 02:57:21 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-02-18 05:46:03 -0500 |
commit | 04b285f35e2086b69682c7ed054aa35eebea9f72 (patch) | |
tree | 72120ea015c4234a1a2533184ac23b925a36a086 /fs/btrfs/inode.c | |
parent | 8f682f6955b94ddfb548a1db23c1dd633d90f7de (diff) |
btrfs: Replace CURRENT_TIME by current_fs_time()
CURRENT_TIME macro is not appropriate for filesystems as it
doesn't use the right granularity for filesystem timestamps.
Use current_fs_time() instead.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: linux-btrfs@vger.kernel.org
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5f06eb1f4384..cf0b3795364a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4013,7 +4013,8 @@ err: | |||
4013 | btrfs_i_size_write(dir, dir->i_size - name_len * 2); | 4013 | btrfs_i_size_write(dir, dir->i_size - name_len * 2); |
4014 | inode_inc_iversion(inode); | 4014 | inode_inc_iversion(inode); |
4015 | inode_inc_iversion(dir); | 4015 | inode_inc_iversion(dir); |
4016 | inode->i_ctime = dir->i_mtime = dir->i_ctime = CURRENT_TIME; | 4016 | inode->i_ctime = dir->i_mtime = |
4017 | dir->i_ctime = current_fs_time(inode->i_sb); | ||
4017 | ret = btrfs_update_inode(trans, root, dir); | 4018 | ret = btrfs_update_inode(trans, root, dir); |
4018 | out: | 4019 | out: |
4019 | return ret; | 4020 | return ret; |
@@ -4156,7 +4157,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, | |||
4156 | 4157 | ||
4157 | btrfs_i_size_write(dir, dir->i_size - name_len * 2); | 4158 | btrfs_i_size_write(dir, dir->i_size - name_len * 2); |
4158 | inode_inc_iversion(dir); | 4159 | inode_inc_iversion(dir); |
4159 | dir->i_mtime = dir->i_ctime = CURRENT_TIME; | 4160 | dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb); |
4160 | ret = btrfs_update_inode_fallback(trans, root, dir); | 4161 | ret = btrfs_update_inode_fallback(trans, root, dir); |
4161 | if (ret) | 4162 | if (ret) |
4162 | btrfs_abort_transaction(trans, root, ret); | 4163 | btrfs_abort_transaction(trans, root, ret); |
@@ -5588,7 +5589,7 @@ static struct inode *new_simple_dir(struct super_block *s, | |||
5588 | inode->i_op = &btrfs_dir_ro_inode_operations; | 5589 | inode->i_op = &btrfs_dir_ro_inode_operations; |
5589 | inode->i_fop = &simple_dir_operations; | 5590 | inode->i_fop = &simple_dir_operations; |
5590 | inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO; | 5591 | inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO; |
5591 | inode->i_mtime = CURRENT_TIME; | 5592 | inode->i_mtime = current_fs_time(inode->i_sb); |
5592 | inode->i_atime = inode->i_mtime; | 5593 | inode->i_atime = inode->i_mtime; |
5593 | inode->i_ctime = inode->i_mtime; | 5594 | inode->i_ctime = inode->i_mtime; |
5594 | BTRFS_I(inode)->i_otime = inode->i_mtime; | 5595 | BTRFS_I(inode)->i_otime = inode->i_mtime; |
@@ -6160,7 +6161,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
6160 | inode_init_owner(inode, dir, mode); | 6161 | inode_init_owner(inode, dir, mode); |
6161 | inode_set_bytes(inode, 0); | 6162 | inode_set_bytes(inode, 0); |
6162 | 6163 | ||
6163 | inode->i_mtime = CURRENT_TIME; | 6164 | inode->i_mtime = current_fs_time(inode->i_sb); |
6164 | inode->i_atime = inode->i_mtime; | 6165 | inode->i_atime = inode->i_mtime; |
6165 | inode->i_ctime = inode->i_mtime; | 6166 | inode->i_ctime = inode->i_mtime; |
6166 | BTRFS_I(inode)->i_otime = inode->i_mtime; | 6167 | BTRFS_I(inode)->i_otime = inode->i_mtime; |
@@ -6273,7 +6274,8 @@ int btrfs_add_link(struct btrfs_trans_handle *trans, | |||
6273 | btrfs_i_size_write(parent_inode, parent_inode->i_size + | 6274 | btrfs_i_size_write(parent_inode, parent_inode->i_size + |
6274 | name_len * 2); | 6275 | name_len * 2); |
6275 | inode_inc_iversion(parent_inode); | 6276 | inode_inc_iversion(parent_inode); |
6276 | parent_inode->i_mtime = parent_inode->i_ctime = CURRENT_TIME; | 6277 | parent_inode->i_mtime = parent_inode->i_ctime = |
6278 | current_fs_time(parent_inode->i_sb); | ||
6277 | ret = btrfs_update_inode(trans, root, parent_inode); | 6279 | ret = btrfs_update_inode(trans, root, parent_inode); |
6278 | if (ret) | 6280 | if (ret) |
6279 | btrfs_abort_transaction(trans, root, ret); | 6281 | btrfs_abort_transaction(trans, root, ret); |
@@ -6491,7 +6493,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
6491 | BTRFS_I(inode)->dir_index = 0ULL; | 6493 | BTRFS_I(inode)->dir_index = 0ULL; |
6492 | inc_nlink(inode); | 6494 | inc_nlink(inode); |
6493 | inode_inc_iversion(inode); | 6495 | inode_inc_iversion(inode); |
6494 | inode->i_ctime = CURRENT_TIME; | 6496 | inode->i_ctime = current_fs_time(inode->i_sb); |
6495 | ihold(inode); | 6497 | ihold(inode); |
6496 | set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags); | 6498 | set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags); |
6497 | 6499 | ||
@@ -9254,7 +9256,6 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
9254 | struct btrfs_root *dest = BTRFS_I(new_dir)->root; | 9256 | struct btrfs_root *dest = BTRFS_I(new_dir)->root; |
9255 | struct inode *new_inode = d_inode(new_dentry); | 9257 | struct inode *new_inode = d_inode(new_dentry); |
9256 | struct inode *old_inode = d_inode(old_dentry); | 9258 | struct inode *old_inode = d_inode(old_dentry); |
9257 | struct timespec ctime = CURRENT_TIME; | ||
9258 | u64 index = 0; | 9259 | u64 index = 0; |
9259 | u64 root_objectid; | 9260 | u64 root_objectid; |
9260 | int ret; | 9261 | int ret; |
@@ -9351,9 +9352,9 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
9351 | inode_inc_iversion(old_dir); | 9352 | inode_inc_iversion(old_dir); |
9352 | inode_inc_iversion(new_dir); | 9353 | inode_inc_iversion(new_dir); |
9353 | inode_inc_iversion(old_inode); | 9354 | inode_inc_iversion(old_inode); |
9354 | old_dir->i_ctime = old_dir->i_mtime = ctime; | 9355 | old_dir->i_ctime = old_dir->i_mtime = |
9355 | new_dir->i_ctime = new_dir->i_mtime = ctime; | 9356 | new_dir->i_ctime = new_dir->i_mtime = |
9356 | old_inode->i_ctime = ctime; | 9357 | old_inode->i_ctime = current_fs_time(old_dir->i_sb); |
9357 | 9358 | ||
9358 | if (old_dentry->d_parent != new_dentry->d_parent) | 9359 | if (old_dentry->d_parent != new_dentry->d_parent) |
9359 | btrfs_record_unlink_dir(trans, old_dir, old_inode, 1); | 9360 | btrfs_record_unlink_dir(trans, old_dir, old_inode, 1); |
@@ -9378,7 +9379,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
9378 | 9379 | ||
9379 | if (new_inode) { | 9380 | if (new_inode) { |
9380 | inode_inc_iversion(new_inode); | 9381 | inode_inc_iversion(new_inode); |
9381 | new_inode->i_ctime = CURRENT_TIME; | 9382 | new_inode->i_ctime = current_fs_time(new_inode->i_sb); |
9382 | if (unlikely(btrfs_ino(new_inode) == | 9383 | if (unlikely(btrfs_ino(new_inode) == |
9383 | BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) { | 9384 | BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) { |
9384 | root_objectid = BTRFS_I(new_inode)->location.objectid; | 9385 | root_objectid = BTRFS_I(new_inode)->location.objectid; |
@@ -9856,7 +9857,7 @@ next: | |||
9856 | *alloc_hint = ins.objectid + ins.offset; | 9857 | *alloc_hint = ins.objectid + ins.offset; |
9857 | 9858 | ||
9858 | inode_inc_iversion(inode); | 9859 | inode_inc_iversion(inode); |
9859 | inode->i_ctime = CURRENT_TIME; | 9860 | inode->i_ctime = current_fs_time(inode->i_sb); |
9860 | BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; | 9861 | BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; |
9861 | if (!(mode & FALLOC_FL_KEEP_SIZE) && | 9862 | if (!(mode & FALLOC_FL_KEEP_SIZE) && |
9862 | (actual_len > inode->i_size) && | 9863 | (actual_len > inode->i_size) && |