diff options
author | Kalpak Shah <kalpak@clusterfs.com> | 2007-07-18 09:15:20 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2007-07-18 09:15:20 -0400 |
commit | ef7f38359ea8b3e9c7f2cae9a4d4935f55ca9e80 (patch) | |
tree | ee34a5821332cf70b89827eb872f08bc0dd43f89 /fs/ext4/inode.c | |
parent | 0f49d5d019afa4e94253bfc92f0daca3badb990b (diff) |
ext4: Add nanosecond timestamps
This patch adds nanosecond timestamps for ext4. This involves adding
*time_extra fields to the ext4_inode to extend the timestamps to
64-bits. Creation time is also added by this patch.
These extended fields will fit into an inode if the filesystem was
formatted with large inodes (-I 256 or larger) and there are currently
no EAs consuming all of the available space. For new inodes we always
reserve enough space for the kernel's known extended fields, but for
inodes created with an old kernel this might not have been the case. So
this patch also adds the EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE feature
flag(ro-compat so that older kernels can't create inodes with a smaller
extra_isize). which indicates if the fields fitting inside
s_min_extra_isize are available or not. If the expansion of inodes if
unsuccessful then this feature will be disabled. This feature is only
enabled if requested by the sysadmin.
None of the extended inode fields is critical for correct filesystem
operation.
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 49035c5a2c43..b83f91edebd1 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -726,7 +726,7 @@ static int ext4_splice_branch(handle_t *handle, struct inode *inode, | |||
726 | 726 | ||
727 | /* We are done with atomic stuff, now do the rest of housekeeping */ | 727 | /* We are done with atomic stuff, now do the rest of housekeeping */ |
728 | 728 | ||
729 | inode->i_ctime = CURRENT_TIME_SEC; | 729 | inode->i_ctime = ext4_current_time(inode); |
730 | ext4_mark_inode_dirty(handle, inode); | 730 | ext4_mark_inode_dirty(handle, inode); |
731 | 731 | ||
732 | /* had we spliced it onto indirect block? */ | 732 | /* had we spliced it onto indirect block? */ |
@@ -2375,7 +2375,7 @@ do_indirects: | |||
2375 | ext4_discard_reservation(inode); | 2375 | ext4_discard_reservation(inode); |
2376 | 2376 | ||
2377 | mutex_unlock(&ei->truncate_mutex); | 2377 | mutex_unlock(&ei->truncate_mutex); |
2378 | inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; | 2378 | inode->i_mtime = inode->i_ctime = ext4_current_time(inode); |
2379 | ext4_mark_inode_dirty(handle, inode); | 2379 | ext4_mark_inode_dirty(handle, inode); |
2380 | 2380 | ||
2381 | /* | 2381 | /* |
@@ -2629,10 +2629,6 @@ void ext4_read_inode(struct inode * inode) | |||
2629 | } | 2629 | } |
2630 | inode->i_nlink = le16_to_cpu(raw_inode->i_links_count); | 2630 | inode->i_nlink = le16_to_cpu(raw_inode->i_links_count); |
2631 | inode->i_size = le32_to_cpu(raw_inode->i_size); | 2631 | inode->i_size = le32_to_cpu(raw_inode->i_size); |
2632 | inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime); | ||
2633 | inode->i_ctime.tv_sec = (signed)le32_to_cpu(raw_inode->i_ctime); | ||
2634 | inode->i_mtime.tv_sec = (signed)le32_to_cpu(raw_inode->i_mtime); | ||
2635 | inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec = 0; | ||
2636 | 2632 | ||
2637 | ei->i_state = 0; | 2633 | ei->i_state = 0; |
2638 | ei->i_dir_start_lookup = 0; | 2634 | ei->i_dir_start_lookup = 0; |
@@ -2710,6 +2706,11 @@ void ext4_read_inode(struct inode * inode) | |||
2710 | } else | 2706 | } else |
2711 | ei->i_extra_isize = 0; | 2707 | ei->i_extra_isize = 0; |
2712 | 2708 | ||
2709 | EXT4_INODE_GET_XTIME(i_ctime, inode, raw_inode); | ||
2710 | EXT4_INODE_GET_XTIME(i_mtime, inode, raw_inode); | ||
2711 | EXT4_INODE_GET_XTIME(i_atime, inode, raw_inode); | ||
2712 | EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode); | ||
2713 | |||
2713 | if (S_ISREG(inode->i_mode)) { | 2714 | if (S_ISREG(inode->i_mode)) { |
2714 | inode->i_op = &ext4_file_inode_operations; | 2715 | inode->i_op = &ext4_file_inode_operations; |
2715 | inode->i_fop = &ext4_file_operations; | 2716 | inode->i_fop = &ext4_file_operations; |
@@ -2791,9 +2792,12 @@ static int ext4_do_update_inode(handle_t *handle, | |||
2791 | } | 2792 | } |
2792 | raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); | 2793 | raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); |
2793 | raw_inode->i_size = cpu_to_le32(ei->i_disksize); | 2794 | raw_inode->i_size = cpu_to_le32(ei->i_disksize); |
2794 | raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec); | 2795 | |
2795 | raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec); | 2796 | EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode); |
2796 | raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec); | 2797 | EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode); |
2798 | EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode); | ||
2799 | EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode); | ||
2800 | |||
2797 | raw_inode->i_blocks = cpu_to_le32(inode->i_blocks); | 2801 | raw_inode->i_blocks = cpu_to_le32(inode->i_blocks); |
2798 | raw_inode->i_dtime = cpu_to_le32(ei->i_dtime); | 2802 | raw_inode->i_dtime = cpu_to_le32(ei->i_dtime); |
2799 | raw_inode->i_flags = cpu_to_le32(ei->i_flags); | 2803 | raw_inode->i_flags = cpu_to_le32(ei->i_flags); |