Skip to content

Commit

Permalink
btrfs: use timespec64 for i_otime
Browse files Browse the repository at this point in the history
While the regular inode timestamps all use timespec64 now, the i_otime
field is btrfs specific and still needs to be converted to correctly
represent times beyond 2038.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Arnd Bergmann authored and David Sterba committed Aug 6, 2018
1 parent afd4851 commit d3c6be6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fs/btrfs/btrfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ struct btrfs_inode {
struct btrfs_delayed_node *delayed_node;

/* File creation time. */
struct timespec i_otime;
struct timespec64 i_otime;

/* Hook into fs_info->delayed_iputs */
struct list_head delayed_iput;
Expand Down
4 changes: 2 additions & 2 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -5744,7 +5744,7 @@ static struct inode *new_simple_dir(struct super_block *s,
inode->i_mtime = current_time(inode);
inode->i_atime = inode->i_mtime;
inode->i_ctime = inode->i_mtime;
BTRFS_I(inode)->i_otime = timespec64_to_timespec(inode->i_mtime);
BTRFS_I(inode)->i_otime = inode->i_mtime;

return inode;
}
Expand Down Expand Up @@ -6348,7 +6348,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
inode->i_mtime = current_time(inode);
inode->i_atime = inode->i_mtime;
inode->i_ctime = inode->i_mtime;
BTRFS_I(inode)->i_otime = timespec64_to_timespec(inode->i_mtime);
BTRFS_I(inode)->i_otime = inode->i_mtime;

inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_inode_item);
Expand Down

0 comments on commit d3c6be6

Please sign in to comment.