--- /dev/null
+Index: linux-2.6.9-rhel4/fs/ext3/ialloc.c
+===================================================================
+--- linux-2.6.9-rhel4.orig/fs/ext3/ialloc.c
++++ linux-2.6.9-rhel4/fs/ext3/ialloc.c
+@@ -612,7 +612,8 @@ got:
+ /* This is the optimal IO size (for stat), not the fs block size */
+ inode->i_blksize = PAGE_SIZE;
+ inode->i_blocks = 0;
+- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
++ ext3_current_time(inode);
+
+ memset(ei->i_data, 0, sizeof(ei->i_data));
+ ei->i_next_alloc_block = 0;
+@@ -650,9 +651,8 @@ got:
+ spin_unlock(&sbi->s_next_gen_lock);
+
+ ei->i_state = EXT3_STATE_NEW;
+- ei->i_extra_isize =
+- (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) ?
+- sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
++
++ ei->i_extra_isize = EXT3_SB(sb)->s_want_extra_isize;
+
+ ret = inode;
+ if(DQUOT_ALLOC_INODE(inode)) {
+Index: linux-2.6.9-rhel4/fs/ext3/inode.c
+===================================================================
+--- linux-2.6.9-rhel4.orig/fs/ext3/inode.c
++++ linux-2.6.9-rhel4/fs/ext3/inode.c
+@@ -627,7 +627,7 @@ static int ext3_splice_branch(handle_t *
+
+ /* We are done with atomic stuff, now do the rest of housekeeping */
+
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+
+ /* had we spliced it onto indirect block? */
+@@ -2227,7 +2227,7 @@ do_indirects:
+ ;
+ }
+ up(&ei->truncate_sem);
+- inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_mtime = inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+
+ /* In a multi-transaction truncate, we only make the final
+@@ -2454,10 +2454,6 @@ void ext3_read_inode(struct inode * inod
+ }
+ inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
+ inode->i_size = le32_to_cpu(raw_inode->i_size);
+- inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
+- inode->i_ctime.tv_sec = le32_to_cpu(raw_inode->i_ctime);
+- inode->i_mtime.tv_sec = le32_to_cpu(raw_inode->i_mtime);
+- inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec = 0;
+
+ ei->i_state = 0;
+ ei->i_next_alloc_block = 0;
+@@ -2518,6 +2514,11 @@ void ext3_read_inode(struct inode * inod
+ else
+ ei->i_extra_isize = 0;
+
++ EXT3_INODE_GET_XTIME(i_ctime, inode, raw_inode);
++ EXT3_INODE_GET_XTIME(i_mtime, inode, raw_inode);
++ EXT3_INODE_GET_XTIME(i_atime, inode, raw_inode);
++ EXT3_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
++
+ if (S_ISREG(inode->i_mode)) {
+ inode->i_op = &ext3_file_inode_operations;
+ inode->i_fop = &ext3_file_operations;
+@@ -2598,9 +2599,12 @@ static int ext3_do_update_inode(handle_t
+ }
+ raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
+ raw_inode->i_size = cpu_to_le32(ei->i_disksize);
+- raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
+- raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
+- raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
++
++ EXT3_INODE_SET_XTIME(i_ctime, inode, raw_inode);
++ EXT3_INODE_SET_XTIME(i_mtime, inode, raw_inode);
++ EXT3_INODE_SET_XTIME(i_atime, inode, raw_inode);
++ EXT3_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
++
+ raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
+ raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
+ raw_inode->i_flags = cpu_to_le32(ei->i_flags);
+Index: linux-2.6.9-rhel4/fs/ext3/ioctl.c
+===================================================================
+--- linux-2.6.9-rhel4.orig/fs/ext3/ioctl.c
++++ linux-2.6.9-rhel4/fs/ext3/ioctl.c
+@@ -112,7 +112,7 @@ int ext3_ioctl (struct inode * inode, st
+ ei->i_flags = flags;
+
+ ext3_set_inode_flags(inode);
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+
+ err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+ flags_err:
+@@ -150,7 +150,7 @@ flags_err:
+ return PTR_ERR(handle);
+ err = ext3_reserve_inode_write(handle, inode, &iloc);
+ if (err == 0) {
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ inode->i_generation = generation;
+ err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+ }
+Index: linux-2.6.9-rhel4/fs/ext3/namei.c
+===================================================================
+--- linux-2.6.9-rhel4.orig/fs/ext3/namei.c
++++ linux-2.6.9-rhel4/fs/ext3/namei.c
+@@ -1302,7 +1302,7 @@ static int add_dirent_to_buf(handle_t *h
+ * happen is that the times are slightly out of date
+ * and/or different from the directory change time.
+ */
+- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
++ dir->i_mtime = dir->i_ctime = ext3_current_time(dir);
+ ext3_update_dx_flag(dir);
+ dir->i_version++;
+ ext3_mark_inode_dirty(handle, dir);
+@@ -2098,7 +2098,7 @@ static int ext3_rmdir (struct inode * di
+ inode->i_version++;
+ inode->i_nlink = 0;
+ ext3_orphan_add(handle, inode);
+- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
++ inode->i_ctime = dir->i_ctime = dir->i_mtime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ ext3_dec_count(handle, dir);
+ ext3_update_dx_flag(dir);
+@@ -2148,13 +2148,13 @@ static int ext3_unlink(struct inode * di
+ retval = ext3_delete_entry(handle, dir, de, bh);
+ if (retval)
+ goto end_unlink;
+- dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
++ dir->i_ctime = dir->i_mtime = ext3_current_time(dir);
+ ext3_update_dx_flag(dir);
+ ext3_mark_inode_dirty(handle, dir);
+ ext3_dec_count(handle, inode);
+ if (!inode->i_nlink)
+ ext3_orphan_add(handle, inode);
+- inode->i_ctime = dir->i_ctime;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ retval = 0;
+
+@@ -2255,7 +2255,7 @@ retry:
+ if (IS_DIRSYNC(dir))
+ handle->h_sync = 1;
+
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_inc_count(handle, inode);
+ atomic_inc(&inode->i_count);
+
+@@ -2357,7 +2357,7 @@ static int ext3_rename (struct inode * o
+ * Like most other Unix systems, set the ctime for inodes on a
+ * rename.
+ */
+- old_inode->i_ctime = CURRENT_TIME_SEC;
++ old_inode->i_ctime = ext3_current_time(old_inode);
+ ext3_mark_inode_dirty(handle, old_inode);
+
+ /*
+@@ -2390,9 +2390,9 @@ static int ext3_rename (struct inode * o
+
+ if (new_inode) {
+ ext3_dec_count(handle, new_inode);
+- new_inode->i_ctime = CURRENT_TIME_SEC;
++ new_inode->i_ctime = ext3_current_time(new_inode);
+ }
+- old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
++ old_dir->i_ctime = old_dir->i_mtime = ext3_current_time(old_dir);
+ ext3_update_dx_flag(old_dir);
+ if (dir_bh) {
+ BUFFER_TRACE(dir_bh, "get_write_access");
+Index: linux-2.6.9-rhel4/fs/ext3/super.c
+===================================================================
+--- linux-2.6.9-rhel4.orig/fs/ext3/super.c
++++ linux-2.6.9-rhel4/fs/ext3/super.c
+@@ -1468,6 +1468,8 @@ static int ext3_fill_super (struct super
+ sbi->s_inode_size);
+ goto failed_mount;
+ }
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE)
++ sb->s_time_gran = 1 << (EXT3_EPOCH_BITS - 2);
+ }
+ sbi->s_frag_size = EXT3_MIN_FRAG_SIZE <<
+ le32_to_cpu(es->s_log_frag_size);
+@@ -1654,6 +1656,32 @@ static int ext3_fill_super (struct super
+ }
+
+ ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
++
++ /* determine the minimum size of new large inodes, if present */
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ if (EXT3_HAS_RO_COMPAT_FEATURE(sb,
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE)) {
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_want_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_want_extra_isize);
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_min_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_min_extra_isize);
++ }
++ }
++ /* Check if enough inode space is available */
++ if (EXT3_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >
++ sbi->s_inode_size) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ printk(KERN_INFO "EXT3-fs: required extra inode space not"
++ "available.\n");
++ }
++
+ /*
+ * akpm: core read_super() calls in here with the superblock locked.
+ * That deadlocks, because orphan cleanup needs to lock the superblock
+Index: linux-2.6.9-rhel4/fs/ext3/xattr.c
+===================================================================
+--- linux-2.6.9-rhel4.orig/fs/ext3/xattr.c
++++ linux-2.6.9-rhel4/fs/ext3/xattr.c
+@@ -1305,7 +1305,7 @@ getblk_failed:
+
+ /* Update the inode. */
+ EXT3_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0;
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ if (IS_SYNC(inode))
+ handle->h_sync = 1;
+Index: linux-2.6.9-rhel4/include/linux/ext3_fs.h
+===================================================================
+--- linux-2.6.9-rhel4.orig/include/linux/ext3_fs.h
++++ linux-2.6.9-rhel4/include/linux/ext3_fs.h
+@@ -258,7 +258,7 @@ struct ext3_inode {
+ __le16 i_uid; /* Low 16 bits of Owner Uid */
+ __le32 i_size; /* Size in bytes */
+ __le32 i_atime; /* Access time */
+- __le32 i_ctime; /* Creation time */
++ __le32 i_ctime; /* Inode Change time */
+ __le32 i_mtime; /* Modification time */
+ __le32 i_dtime; /* Deletion Time */
+ __le16 i_gid; /* Low 16 bits of Group Id */
+@@ -307,10 +307,73 @@ struct ext3_inode {
+ } osd2; /* OS dependent 2 */
+ __u16 i_extra_isize;
+ __u16 i_pad1;
++ __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
++ __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
++ __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
++ __le32 i_crtime; /* File Creation time */
++ __le32 i_crtime_extra; /* extra File Creation time (nsec << 2 | epoch) */
+ };
+
+ #define i_size_high i_dir_acl
+
++#define EXT3_EPOCH_BITS 2
++#define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1)
++#define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS)
++
++#define EXT3_FITS_IN_INODE(ext3_inode, einode, field) \
++ ((offsetof(typeof(*ext3_inode), field) + \
++ sizeof((ext3_inode)->field)) \
++ <= (EXT3_GOOD_OLD_INODE_SIZE + \
++ (einode)->i_extra_isize)) \
++
++static inline __le32 ext3_encode_extra_time(struct timespec *time)
++{
++ return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
++ time->tv_sec >> 32 : 0) |
++ ((time->tv_nsec << 2) & EXT3_NSEC_MASK));
++}
++
++static inline void ext3_decode_extra_time(struct timespec *time, __le32 extra) {
++ if (sizeof(time->tv_sec) > 4)
++ time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT3_EPOCH_MASK)
++ << 32;
++ time->tv_nsec = (le32_to_cpu(extra) & EXT3_NSEC_MASK) >> 2;
++}
++
++#define EXT3_INODE_SET_XTIME(xtime, inode, raw_inode) \
++do { \
++ (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
++ if (EXT3_FITS_IN_INODE(raw_inode, EXT3_I(inode), xtime ## _extra))\
++ (raw_inode)->xtime ## _extra = \
++ ext3_encode_extra_time(&(inode)->xtime); \
++} while (0)
++
++#define EXT3_EINODE_SET_XTIME(xtime, einode, raw_inode) \
++do { \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime)) \
++ (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
++ (raw_inode)->xtime ## _extra = \
++ ext3_encode_extra_time(&(einode)->xtime); \
++} while (0)
++
++#define EXT3_INODE_GET_XTIME(xtime, inode, raw_inode) \
++do { \
++ (inode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime); \
++ if (EXT3_FITS_IN_INODE(raw_inode, EXT3_I(inode), xtime ## _extra))\
++ ext3_decode_extra_time(&(inode)->xtime, \
++ raw_inode->xtime ## _extra); \
++} while (0)
++
++#define EXT3_EINODE_GET_XTIME(xtime, einode, raw_inode) \
++do { \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime)) \
++ (einode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime); \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
++ ext3_decode_extra_time(&(einode)->xtime, \
++ raw_inode->xtime ## _extra); \
++} while (0)
++
+ #if defined(__KERNEL__) || defined(__linux__)
+ #define i_reserved1 osd1.linux1.l_i_reserved1
+ #define i_frag osd2.linux2.l_i_frag
+@@ -490,7 +553,9 @@ struct ext3_super_block {
+ __u16 s_reserved_word_pad;
+ __le32 s_default_mount_opts;
+ __le32 s_first_meta_bg; /* First metablock block group */
+- __u32 s_reserved[190]; /* Padding to the end of the block */
++ __le16 s_min_extra_isize; /* All inodes have at least # bytes */
++ __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
++ __u32 s_reserved[189]; /* Padding to the end of the block */
+ };
+
+ #ifdef __KERNEL__
+@@ -565,6 +630,8 @@ static inline struct ext3_inode_info *EX
+ #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
+ #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
+ #define EXT3_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
++#define EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
++
+
+ #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
+ #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
+@@ -581,6 +648,7 @@ static inline struct ext3_inode_info *EX
+ #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
+ EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
+ EXT3_FEATURE_RO_COMPAT_DIR_NLINK| \
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE| \
+ EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
+
+ /*
+@@ -708,6 +776,12 @@ static inline struct ext3_inode *ext3_ra
+ return (struct ext3_inode *) (iloc->bh->b_data + iloc->offset);
+ }
+
++static inline struct timespec ext3_current_time(struct inode *inode)
++{
++ return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
++ current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
++}
++
+ /*
+ * This structure is stuffed into the struct file's private_data field
+ * for directories. It is where we put information so that we can do
+Index: linux-2.6.9-rhel4/include/linux/ext3_fs_i.h
+===================================================================
+--- linux-2.6.9-rhel4.orig/include/linux/ext3_fs_i.h
++++ linux-2.6.9-rhel4/include/linux/ext3_fs_i.h
+@@ -130,6 +130,7 @@ struct ext3_inode_info {
+ struct inode vfs_inode;
+
+ __u32 i_cached_extent[4];
++ struct timespec i_crtime;
+ };
+
+ #endif /* _LINUX_EXT3_FS_I */
+Index: linux-2.6.9-rhel4/include/linux/ext3_fs_sb.h
+===================================================================
+--- linux-2.6.9-rhel4.orig/include/linux/ext3_fs_sb.h
++++ linux-2.6.9-rhel4/include/linux/ext3_fs_sb.h
+@@ -122,6 +122,8 @@ struct ext3_sb_info {
+ spinlock_t s_bal_lock;
+ unsigned long s_mb_buddies_generated;
+ unsigned long long s_mb_generation_time;
++
++ unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
+ };
+
+ #define EXT3_GROUP_INFO(sb, group) \
--- /dev/null
+Index: linux-2.6.16.27-0.9/fs/ext3/ialloc.c
+===================================================================
+--- linux-2.6.16.27-0.9.orig/fs/ext3/ialloc.c
++++ linux-2.6.16.27-0.9/fs/ext3/ialloc.c
+@@ -577,7 +577,8 @@ got:
+ /* This is the optimal IO size (for stat), not the fs block size */
+ inode->i_blksize = PAGE_SIZE;
+ inode->i_blocks = 0;
+- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
++ ext3_current_time(inode);
+
+ memset(ei->i_data, 0, sizeof(ei->i_data));
+ ei->i_dir_start_lookup = 0;
+@@ -609,9 +610,8 @@ got:
+ spin_unlock(&sbi->s_next_gen_lock);
+
+ ei->i_state = EXT3_STATE_NEW;
+- ei->i_extra_isize =
+- (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) ?
+- sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
++
++ ei->i_extra_isize = EXT3_SB(sb)->s_want_extra_isize;
+
+ ret = inode;
+ if(DQUOT_ALLOC_INODE(inode)) {
+Index: linux-2.6.16.27-0.9/fs/ext3/inode.c
+===================================================================
+--- linux-2.6.16.27-0.9.orig/fs/ext3/inode.c
++++ linux-2.6.16.27-0.9/fs/ext3/inode.c
+@@ -620,7 +620,7 @@ static int ext3_splice_branch(handle_t *
+
+ /* We are done with atomic stuff, now do the rest of housekeeping */
+
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+
+ /* had we spliced it onto indirect block? */
+@@ -2244,7 +2244,7 @@ do_indirects:
+ ext3_discard_reservation(inode);
+
+ up(&ei->truncate_sem);
+- inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_mtime = inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+
+ /* In a multi-transaction truncate, we only make the final
+@@ -2479,10 +2479,6 @@ void ext3_read_inode(struct inode * inod
+ }
+ inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
+ inode->i_size = le32_to_cpu(raw_inode->i_size);
+- inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
+- inode->i_ctime.tv_sec = le32_to_cpu(raw_inode->i_ctime);
+- inode->i_mtime.tv_sec = le32_to_cpu(raw_inode->i_mtime);
+- inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec = 0;
+
+ ei->i_state = 0;
+ ei->i_dir_start_lookup = 0;
+@@ -2557,6 +2553,11 @@ void ext3_read_inode(struct inode * inod
+ } else
+ ei->i_extra_isize = 0;
+
++ EXT3_INODE_GET_XTIME(i_ctime, inode, raw_inode);
++ EXT3_INODE_GET_XTIME(i_mtime, inode, raw_inode);
++ EXT3_INODE_GET_XTIME(i_atime, inode, raw_inode);
++ EXT3_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
++
+ if (S_ISREG(inode->i_mode)) {
+ inode->i_op = &ext3_file_inode_operations;
+ inode->i_fop = &ext3_file_operations;
+@@ -2637,9 +2638,12 @@ static int ext3_do_update_inode(handle_t
+ }
+ raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
+ raw_inode->i_size = cpu_to_le32(ei->i_disksize);
+- raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
+- raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
+- raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
++
++ EXT3_INODE_SET_XTIME(i_ctime, inode, raw_inode);
++ EXT3_INODE_SET_XTIME(i_mtime, inode, raw_inode);
++ EXT3_INODE_SET_XTIME(i_atime, inode, raw_inode);
++ EXT3_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
++
+ raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
+ raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
+ raw_inode->i_flags = cpu_to_le32(ei->i_flags);
+Index: linux-2.6.16.27-0.9/fs/ext3/ioctl.c
+===================================================================
+--- linux-2.6.16.27-0.9.orig/fs/ext3/ioctl.c
++++ linux-2.6.16.27-0.9/fs/ext3/ioctl.c
+@@ -88,7 +88,7 @@ int ext3_ioctl (struct inode * inode, st
+ ei->i_flags = flags;
+
+ ext3_set_inode_flags(inode);
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+
+ err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+ flags_err:
+@@ -126,7 +126,7 @@ flags_err:
+ return PTR_ERR(handle);
+ err = ext3_reserve_inode_write(handle, inode, &iloc);
+ if (err == 0) {
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ inode->i_generation = generation;
+ err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+ }
+Index: linux-2.6.16.27-0.9/fs/ext3/namei.c
+===================================================================
+--- linux-2.6.16.27-0.9.orig/fs/ext3/namei.c
++++ linux-2.6.16.27-0.9/fs/ext3/namei.c
+@@ -1276,7 +1276,7 @@ static int add_dirent_to_buf(handle_t *h
+ * happen is that the times are slightly out of date
+ * and/or different from the directory change time.
+ */
+- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
++ dir->i_mtime = dir->i_ctime = ext3_current_time(dir);
+ ext3_update_dx_flag(dir);
+ dir->i_version++;
+ ext3_mark_inode_dirty(handle, dir);
+@@ -2056,7 +2056,7 @@ static int ext3_rmdir (struct inode * di
+ inode->i_version++;
+ inode->i_nlink = 0;
+ ext3_orphan_add(handle, inode);
+- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
++ inode->i_ctime = dir->i_ctime = dir->i_mtime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ ext3_dec_count(handle, dir);
+ ext3_update_dx_flag(dir);
+@@ -2106,13 +2106,13 @@ static int ext3_unlink(struct inode * di
+ retval = ext3_delete_entry(handle, dir, de, bh);
+ if (retval)
+ goto end_unlink;
+- dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
++ dir->i_ctime = dir->i_mtime = ext3_current_time(dir);
+ ext3_update_dx_flag(dir);
+ ext3_mark_inode_dirty(handle, dir);
+ ext3_dec_count(handle, inode);
+ if (!inode->i_nlink)
+ ext3_orphan_add(handle, inode);
+- inode->i_ctime = dir->i_ctime;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ retval = 0;
+
+@@ -2214,7 +2214,7 @@ retry:
+ if (IS_DIRSYNC(dir))
+ handle->h_sync = 1;
+
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_inc_count(handle, inode);
+ atomic_inc(&inode->i_count);
+
+@@ -2317,7 +2317,7 @@ static int ext3_rename (struct inode * o
+ * Like most other Unix systems, set the ctime for inodes on a
+ * rename.
+ */
+- old_inode->i_ctime = CURRENT_TIME_SEC;
++ old_inode->i_ctime = ext3_current_time(old_inode);
+ ext3_mark_inode_dirty(handle, old_inode);
+
+ /*
+@@ -2350,9 +2350,9 @@ static int ext3_rename (struct inode * o
+
+ if (new_inode) {
+ ext3_dec_count(handle, new_inode);
+- new_inode->i_ctime = CURRENT_TIME_SEC;
++ new_inode->i_ctime = ext3_current_time(new_inode);
+ }
+- old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
++ old_dir->i_ctime = old_dir->i_mtime = ext3_current_time(old_dir);
+ ext3_update_dx_flag(old_dir);
+ if (dir_bh) {
+ BUFFER_TRACE(dir_bh, "get_write_access");
+Index: linux-2.6.16.27-0.9/fs/ext3/super.c
+===================================================================
+--- linux-2.6.16.27-0.9.orig/fs/ext3/super.c
++++ linux-2.6.16.27-0.9/fs/ext3/super.c
+@@ -1614,6 +1614,8 @@ static int ext3_fill_super (struct super
+ sbi->s_inode_size);
+ goto failed_mount;
+ }
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE)
++ sb->s_time_gran = 1 << (EXT3_EPOCH_BITS - 2);
+ }
+ sbi->s_frag_size = EXT3_MIN_FRAG_SIZE <<
+ le32_to_cpu(es->s_log_frag_size);
+@@ -1809,6 +1811,32 @@ static int ext3_fill_super (struct super
+ }
+
+ ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
++
++ /* determine the minimum size of new large inodes, if present */
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ if (EXT3_HAS_RO_COMPAT_FEATURE(sb,
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE)) {
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_want_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_want_extra_isize);
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_min_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_min_extra_isize);
++ }
++ }
++ /* Check if enough inode space is available */
++ if (EXT3_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >
++ sbi->s_inode_size) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ printk(KERN_INFO "EXT3-fs: required extra inode space not"
++ "available.\n");
++ }
++
+ /*
+ * akpm: core read_super() calls in here with the superblock locked.
+ * That deadlocks, because orphan cleanup needs to lock the superblock
+Index: linux-2.6.16.27-0.9/fs/ext3/xattr.c
+===================================================================
+--- linux-2.6.16.27-0.9.orig/fs/ext3/xattr.c
++++ linux-2.6.16.27-0.9/fs/ext3/xattr.c
+@@ -1006,8 +1006,8 @@ ext3_xattr_set_handle(handle_t *handle,
+ }
+ if (!error) {
+ ext3_xattr_update_super_block(handle, inode->i_sb);
+- inode->i_ctime = CURRENT_TIME_SEC;
+- error = ext3_mark_iloc_dirty(handle, inode, &is.iloc);
++ inode->i_ctime = ext3_current_time(inode);
++ ext3_mark_inode_dirty(handle, inode);
+ /*
+ * The bh is consumed by ext3_mark_iloc_dirty, even with
+ * error != 0.
+Index: linux-2.6.16.27-0.9/include/linux/ext3_fs.h
+===================================================================
+--- linux-2.6.16.27-0.9.orig/include/linux/ext3_fs.h
++++ linux-2.6.16.27-0.9/include/linux/ext3_fs.h
+@@ -272,7 +272,7 @@ struct ext3_inode {
+ __le16 i_uid; /* Low 16 bits of Owner Uid */
+ __le32 i_size; /* Size in bytes */
+ __le32 i_atime; /* Access time */
+- __le32 i_ctime; /* Creation time */
++ __le32 i_ctime; /* Inode Change time */
+ __le32 i_mtime; /* Modification time */
+ __le32 i_dtime; /* Deletion Time */
+ __le16 i_gid; /* Low 16 bits of Group Id */
+@@ -321,10 +321,73 @@ struct ext3_inode {
+ } osd2; /* OS dependent 2 */
+ __le16 i_extra_isize;
+ __le16 i_pad1;
++ __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
++ __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
++ __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
++ __le32 i_crtime; /* File Creation time */
++ __le32 i_crtime_extra; /* extra File Creation time (nsec << 2 | epoch) */
+ };
+
+ #define i_size_high i_dir_acl
+
++#define EXT3_EPOCH_BITS 2
++#define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1)
++#define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS)
++
++#define EXT3_FITS_IN_INODE(ext3_inode, einode, field) \
++ ((offsetof(typeof(*ext3_inode), field) + \
++ sizeof((ext3_inode)->field)) \
++ <= (EXT3_GOOD_OLD_INODE_SIZE + \
++ (einode)->i_extra_isize)) \
++
++static inline __le32 ext3_encode_extra_time(struct timespec *time)
++{
++ return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
++ time->tv_sec >> 32 : 0) |
++ ((time->tv_nsec << 2) & EXT3_NSEC_MASK));
++}
++
++static inline void ext3_decode_extra_time(struct timespec *time, __le32 extra) {
++ if (sizeof(time->tv_sec) > 4)
++ time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT3_EPOCH_MASK)
++ << 32;
++ time->tv_nsec = (le32_to_cpu(extra) & EXT3_NSEC_MASK) >> 2;
++}
++
++#define EXT3_INODE_SET_XTIME(xtime, inode, raw_inode) \
++do { \
++ (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
++ if (EXT3_FITS_IN_INODE(raw_inode, EXT3_I(inode), xtime ## _extra)) \
++ (raw_inode)->xtime ## _extra = \
++ ext3_encode_extra_time(&(inode)->xtime); \
++} while (0)
++
++#define EXT3_EINODE_SET_XTIME(xtime, einode, raw_inode) \
++do { \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime)) \
++ (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
++ (raw_inode)->xtime ## _extra = \
++ ext3_encode_extra_time(&(einode)->xtime); \
++} while (0)
++
++#define EXT3_INODE_GET_XTIME(xtime, inode, raw_inode) \
++do { \
++ (inode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime); \
++ if (EXT3_FITS_IN_INODE(raw_inode, EXT3_I(inode), xtime ## _extra))\
++ ext3_decode_extra_time(&(inode)->xtime, \
++ raw_inode->xtime ## _extra); \
++} while (0)
++
++#define EXT3_EINODE_GET_XTIME(xtime, einode, raw_inode) \
++do { \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime)) \
++ (einode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime);\
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
++ ext3_decode_extra_time(&(einode)->xtime, \
++ raw_inode->xtime ## _extra); \
++} while (0)
++
+ #if defined(__KERNEL__) || defined(__linux__)
+ #define i_reserved1 osd1.linux1.l_i_reserved1
+ #define i_frag osd2.linux2.l_i_frag
+@@ -508,7 +571,9 @@ struct ext3_super_block {
+ __u16 s_reserved_word_pad;
+ __le32 s_default_mount_opts;
+ __le32 s_first_meta_bg; /* First metablock block group */
+- __u32 s_reserved[190]; /* Padding to the end of the block */
++ __le16 s_min_extra_isize; /* All inodes have at least # bytes */
++ __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
++ __u32 s_reserved[189]; /* Padding to the end of the block */
+ };
+
+ #ifdef __KERNEL__
+@@ -583,6 +648,8 @@ static inline struct ext3_inode_info *EX
+ #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
+ #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
+ #define EXT3_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
++#define EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
++
+
+ #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
+ #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
+@@ -599,6 +666,7 @@ static inline struct ext3_inode_info *EX
+ #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
+ EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
+ EXT3_FEATURE_RO_COMPAT_DIR_NLINK| \
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE| \
+ EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
+
+ /*
+@@ -726,6 +794,12 @@ static inline struct ext3_inode *ext3_ra
+ return (struct ext3_inode *) (iloc->bh->b_data + iloc->offset);
+ }
+
++static inline struct timespec ext3_current_time(struct inode *inode)
++{
++ return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
++ current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
++}
++
+ /*
+ * This structure is stuffed into the struct file's private_data field
+ * for directories. It is where we put information so that we can do
+Index: linux-2.6.16.27-0.9/include/linux/ext3_fs_i.h
+===================================================================
+--- linux-2.6.16.27-0.9.orig/include/linux/ext3_fs_i.h
++++ linux-2.6.16.27-0.9/include/linux/ext3_fs_i.h
+@@ -135,6 +135,7 @@ struct ext3_inode_info {
+ struct inode vfs_inode;
+
+ __u32 i_cached_extent[4];
++ struct timespec i_crtime;
+
+ void *i_filterdata;
+ };
+Index: linux-2.6.16.27-0.9/include/linux/ext3_fs_sb.h
+===================================================================
+--- linux-2.6.16.27-0.9.orig/include/linux/ext3_fs_sb.h
++++ linux-2.6.16.27-0.9/include/linux/ext3_fs_sb.h
+@@ -119,6 +119,8 @@ struct ext3_sb_info {
+ spinlock_t s_bal_lock;
+ unsigned long s_mb_buddies_generated;
+ unsigned long long s_mb_generation_time;
++
++ unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
+ };
+
+ #define EXT3_GROUP_INFO(sb, group) \
--- /dev/null
+Index: linux-2.6.5-7.283/fs/ext3/ialloc.c
+===================================================================
+--- linux-2.6.5-7.283.orig/fs/ext3/ialloc.c
++++ linux-2.6.5-7.283/fs/ext3/ialloc.c
+@@ -613,7 +613,8 @@ got:
+ /* This is the optimal IO size (for stat), not the fs block size */
+ inode->i_blksize = PAGE_SIZE;
+ inode->i_blocks = 0;
+- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
++ inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
++ CURRENT_TIME;
+
+ memset(ei->i_data, 0, sizeof(ei->i_data));
+ ei->i_next_alloc_block = 0;
+@@ -651,9 +652,8 @@ got:
+ spin_unlock(&sbi->s_next_gen_lock);
+
+ ei->i_state = EXT3_STATE_NEW;
+- ei->i_extra_isize =
+- (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) ?
+- sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
++
++ ei->i_extra_isize = EXT3_SB(sb)->s_want_extra_isize;
+
+ ret = inode;
+ if(DQUOT_ALLOC_INODE(inode)) {
+Index: linux-2.6.5-7.283/fs/ext3/inode.c
+===================================================================
+--- linux-2.6.5-7.283.orig/fs/ext3/inode.c
++++ linux-2.6.5-7.283/fs/ext3/inode.c
+@@ -2459,7 +2459,11 @@ void ext3_read_inode(struct inode * inod
+ inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
+ inode->i_ctime.tv_sec = le32_to_cpu(raw_inode->i_ctime);
+ inode->i_mtime.tv_sec = le32_to_cpu(raw_inode->i_mtime);
+- inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec = 0;
++ if (EXT3_FITS_IN_INODE(raw_inode, ei, i_crtime)) {
++ ei->i_crtime.tv_sec = le32_to_cpu(raw_inode->i_crtime);
++ }
++ inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec =
++ ei->i_crtime.tv_nsec = 0;
+
+ ei->i_state = 0;
+ ei->i_next_alloc_block = 0;
+@@ -2603,6 +2607,10 @@ static int ext3_do_update_inode(handle_t
+ raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
+ raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
+ raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
++ if (EXT3_FITS_IN_INODE(raw_inode, ei, i_crtime)) {
++ raw_inode->i_crtime = cpu_to_le32(ei->i_crtime.tv_sec);
++ }
++
+ raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
+ raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
+ raw_inode->i_flags = cpu_to_le32(ei->i_flags);
+Index: linux-2.6.5-7.283/fs/ext3/super.c
+===================================================================
+--- linux-2.6.5-7.283.orig/fs/ext3/super.c
++++ linux-2.6.5-7.283/fs/ext3/super.c
+@@ -1515,6 +1515,32 @@ static int ext3_fill_super (struct super
+ }
+
+ ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
++
++ /* determine the minimum size of new large inodes, if present */
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ if (EXT3_HAS_RO_COMPAT_FEATURE(sb,
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE)) {
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_want_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_want_extra_isize);
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_min_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_min_extra_isize);
++ }
++ }
++ /* Check if enough inode space is available */
++ if (EXT3_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >
++ sbi->s_inode_size) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ printk(KERN_INFO "EXT3-fs: required extra inode space not"
++ "available.\n");
++ }
++
+ /*
+ * akpm: core read_super() calls in here with the superblock locked.
+ * That deadlocks, because orphan cleanup needs to lock the superblock
+Index: linux-2.6.5-7.283/include/linux/ext3_fs.h
+===================================================================
+--- linux-2.6.5-7.283.orig/include/linux/ext3_fs.h
++++ linux-2.6.5-7.283/include/linux/ext3_fs.h
+@@ -232,7 +232,7 @@ struct ext3_inode {
+ __u16 i_uid; /* Low 16 bits of Owner Uid */
+ __u32 i_size; /* Size in bytes */
+ __u32 i_atime; /* Access time */
+- __u32 i_ctime; /* Creation time */
++ __u32 i_ctime; /* Inode Change time */
+ __u32 i_mtime; /* Modification time */
+ __u32 i_dtime; /* Deletion Time */
+ __u16 i_gid; /* Low 16 bits of Group Id */
+@@ -281,10 +281,25 @@ struct ext3_inode {
+ } osd2; /* OS dependent 2 */
+ __u16 i_extra_isize;
+ __u16 i_pad1;
++ __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
++ __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
++ __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
++ __le32 i_crtime; /* File Creation time */
++ __le32 i_crtime_extra; /* extra File Creation time (nsec << 2 | epoch) */
+ };
+
+ #define i_size_high i_dir_acl
+
++#define EXT3_EPOCH_BITS 2
++#define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1)
++#define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS)
++
++#define EXT3_FITS_IN_INODE(ext3_inode, einode, field) \
++ ((offsetof(typeof(*ext3_inode), field) + \
++ sizeof((ext3_inode)->field)) \
++ <= (EXT3_GOOD_OLD_INODE_SIZE + \
++ (einode)->i_extra_isize)) \
++
+ #if defined(__KERNEL__) || defined(__linux__)
+ #define i_reserved1 osd1.linux1.l_i_reserved1
+ #define i_frag osd2.linux2.l_i_frag
+@@ -464,7 +479,9 @@ struct ext3_super_block {
+ __u16 s_reserved_word_pad;
+ __u32 s_default_mount_opts;
+ __u32 s_first_meta_bg; /* First metablock block group */
+- __u32 s_reserved[190]; /* Padding to the end of the block */
++ __le16 s_min_extra_isize; /* All inodes have at least # bytes */
++ __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
++ __u32 s_reserved[189]; /* Padding to the end of the block */
+ };
+
+ #ifdef __KERNEL__
+@@ -539,6 +556,7 @@ static inline struct ext3_inode_info *EX
+ #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
+ #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
+ #define EXT3_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
++#define EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
+
+ #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
+ #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
+@@ -555,6 +573,7 @@ static inline struct ext3_inode_info *EX
+ #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
+ EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
+ EXT3_FEATURE_RO_COMPAT_DIR_NLINK| \
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE| \
+ EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
+
+ /*
+Index: linux-2.6.5-7.283/include/linux/ext3_fs_i.h
+===================================================================
+--- linux-2.6.5-7.283.orig/include/linux/ext3_fs_i.h
++++ linux-2.6.5-7.283/include/linux/ext3_fs_i.h
+@@ -131,6 +131,7 @@ struct ext3_inode_info {
+ struct inode vfs_inode;
+
+ struct ext3_ext_cache i_cached_extent;
++ struct timespec i_crtime;
+ };
+
+ #endif /* _LINUX_EXT3_FS_I */
+Index: linux-2.6.5-7.283/include/linux/ext3_fs_sb.h
+===================================================================
+--- linux-2.6.5-7.283.orig/include/linux/ext3_fs_sb.h
++++ linux-2.6.5-7.283/include/linux/ext3_fs_sb.h
+@@ -119,6 +119,8 @@ struct ext3_sb_info {
+ spinlock_t s_bal_lock;
+ unsigned long s_mb_buddies_generated;
+ unsigned long long s_mb_generation_time;
++
++ unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
+ };
+
+ #define EXT3_GROUP_INFO(sb, group) \
--- /dev/null
+Index: linux-2.6.18/fs/ext3/ialloc.c
+===================================================================
+--- linux-2.6.18.orig/fs/ext3/ialloc.c
++++ linux-2.6.18/fs/ext3/ialloc.c
+@@ -615,7 +615,8 @@ got:
+ /* This is the optimal IO size (for stat), not the fs block size */
+ inode->i_blksize = PAGE_SIZE;
+ inode->i_blocks = 0;
+- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
++ ext3_current_time(inode);
+
+ memset(ei->i_data, 0, sizeof(ei->i_data));
+ ei->i_dir_start_lookup = 0;
+@@ -647,9 +648,8 @@ got:
+ spin_unlock(&sbi->s_next_gen_lock);
+
+ ei->i_state = EXT3_STATE_NEW;
+- ei->i_extra_isize =
+- (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) ?
+- sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
++
++ ei->i_extra_isize = EXT3_SB(sb)->s_want_extra_isize;
+
+ ret = inode;
+ if(DQUOT_ALLOC_INODE(inode)) {
+Index: linux-2.6.18/fs/ext3/inode.c
+===================================================================
+--- linux-2.6.18.orig/fs/ext3/inode.c
++++ linux-2.6.18/fs/ext3/inode.c
+@@ -729,7 +729,7 @@ static int ext3_splice_branch(handle_t *
+
+ /* We are done with atomic stuff, now do the rest of housekeeping */
+
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+
+ /* had we spliced it onto indirect block? */
+@@ -2388,7 +2388,7 @@ do_indirects:
+ ext3_discard_reservation(inode);
+
+ mutex_unlock(&ei->truncate_mutex);
+- inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_mtime = inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+
+ /*
+@@ -2624,10 +2624,6 @@ void ext3_read_inode(struct inode * inod
+ }
+ inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
+ inode->i_size = le32_to_cpu(raw_inode->i_size);
+- inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
+- inode->i_ctime.tv_sec = le32_to_cpu(raw_inode->i_ctime);
+- inode->i_mtime.tv_sec = le32_to_cpu(raw_inode->i_mtime);
+- inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec = 0;
+
+ ei->i_state = 0;
+ ei->i_dir_start_lookup = 0;
+@@ -2702,6 +2698,11 @@ void ext3_read_inode(struct inode * inod
+ } else
+ ei->i_extra_isize = 0;
+
++ EXT3_INODE_GET_XTIME(i_ctime, inode, raw_inode);
++ EXT3_INODE_GET_XTIME(i_mtime, inode, raw_inode);
++ EXT3_INODE_GET_XTIME(i_atime, inode, raw_inode);
++ EXT3_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
++
+ if (S_ISREG(inode->i_mode)) {
+ inode->i_op = &ext3_file_inode_operations;
+ inode->i_fop = &ext3_file_operations;
+@@ -2782,9 +2783,12 @@ static int ext3_do_update_inode(handle_t
+ }
+ raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
+ raw_inode->i_size = cpu_to_le32(ei->i_disksize);
+- raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
+- raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
+- raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
++
++ EXT3_INODE_SET_XTIME(i_ctime, inode, raw_inode);
++ EXT3_INODE_SET_XTIME(i_mtime, inode, raw_inode);
++ EXT3_INODE_SET_XTIME(i_atime, inode, raw_inode);
++ EXT3_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
++
+ raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
+ raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
+ raw_inode->i_flags = cpu_to_le32(ei->i_flags);
+Index: linux-2.6.18/fs/ext3/ioctl.c
+===================================================================
+--- linux-2.6.18.orig/fs/ext3/ioctl.c
++++ linux-2.6.18/fs/ext3/ioctl.c
+@@ -120,7 +120,7 @@ int ext3_ioctl (struct inode * inode, st
+ ei->i_flags = flags;
+
+ ext3_set_inode_flags(inode);
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+
+ err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+ flags_err:
+@@ -161,7 +161,7 @@ flags_err:
+ return PTR_ERR(handle);
+ err = ext3_reserve_inode_write(handle, inode, &iloc);
+ if (err == 0) {
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ inode->i_generation = generation;
+ err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+ }
+Index: linux-2.6.18/fs/ext3/namei.c
+===================================================================
+--- linux-2.6.18.orig/fs/ext3/namei.c
++++ linux-2.6.18/fs/ext3/namei.c
+@@ -1287,7 +1287,7 @@ static int add_dirent_to_buf(handle_t *h
+ * happen is that the times are slightly out of date
+ * and/or different from the directory change time.
+ */
+- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
++ dir->i_mtime = dir->i_ctime = ext3_current_time(dir);
+ ext3_update_dx_flag(dir);
+ dir->i_version++;
+ ext3_mark_inode_dirty(handle, dir);
+@@ -2079,7 +2079,7 @@ static int ext3_rmdir (struct inode * di
+ inode->i_version++;
+ inode->i_nlink = 0;
+ ext3_orphan_add(handle, inode);
+- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
++ inode->i_ctime = dir->i_ctime = dir->i_mtime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ ext3_dec_count(handle, dir);
+ ext3_update_dx_flag(dir);
+@@ -2129,13 +2129,13 @@ static int ext3_unlink(struct inode * di
+ retval = ext3_delete_entry(handle, dir, de, bh);
+ if (retval)
+ goto end_unlink;
+- dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
++ dir->i_ctime = dir->i_mtime = ext3_current_time(dir);
+ ext3_update_dx_flag(dir);
+ ext3_mark_inode_dirty(handle, dir);
+ ext3_dec_count(handle, inode);
+ if (!inode->i_nlink)
+ ext3_orphan_add(handle, inode);
+- inode->i_ctime = dir->i_ctime;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ retval = 0;
+
+@@ -2237,7 +2237,7 @@ retry:
+ if (IS_DIRSYNC(dir))
+ handle->h_sync = 1;
+
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_inc_count(handle, inode);
+ atomic_inc(&inode->i_count);
+
+@@ -2340,7 +2340,7 @@ static int ext3_rename (struct inode * o
+ * Like most other Unix systems, set the ctime for inodes on a
+ * rename.
+ */
+- old_inode->i_ctime = CURRENT_TIME_SEC;
++ old_inode->i_ctime = ext3_current_time(old_inode);
+ ext3_mark_inode_dirty(handle, old_inode);
+
+ /*
+@@ -2373,9 +2373,9 @@ static int ext3_rename (struct inode * o
+
+ if (new_inode) {
+ ext3_dec_count(handle, new_inode);
+- new_inode->i_ctime = CURRENT_TIME_SEC;
++ new_inode->i_ctime = ext3_current_time(new_inode);
+ }
+- old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
++ old_dir->i_ctime = old_dir->i_mtime = ext3_current_time(old_dir);
+ ext3_update_dx_flag(old_dir);
+ if (dir_bh) {
+ BUFFER_TRACE(dir_bh, "get_write_access");
+Index: linux-2.6.18/fs/ext3/super.c
+===================================================================
+--- linux-2.6.18.orig/fs/ext3/super.c
++++ linux-2.6.18/fs/ext3/super.c
+@@ -1615,6 +1615,8 @@ static int ext3_fill_super (struct super
+ sbi->s_inode_size);
+ goto failed_mount;
+ }
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE)
++ sb->s_time_gran = 1 << (EXT3_EPOCH_BITS - 2);
+ }
+ sbi->s_frag_size = EXT3_MIN_FRAG_SIZE <<
+ le32_to_cpu(es->s_log_frag_size);
+@@ -1819,6 +1821,32 @@ static int ext3_fill_super (struct super
+ }
+
+ ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
++
++ /* determine the minimum size of new large inodes, if present */
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ if (EXT3_HAS_RO_COMPAT_FEATURE(sb,
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE)) {
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_want_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_want_extra_isize);
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_min_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_min_extra_isize);
++ }
++ }
++ /* Check if enough inode space is available */
++ if (EXT3_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >
++ sbi->s_inode_size) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ printk(KERN_INFO "EXT3-fs: required extra inode space not"
++ "available.\n");
++ }
++
+ /*
+ * akpm: core read_super() calls in here with the superblock locked.
+ * That deadlocks, because orphan cleanup needs to lock the superblock
+Index: linux-2.6.18/fs/ext3/xattr.c
+===================================================================
+--- linux-2.6.18.orig/fs/ext3/xattr.c
++++ linux-2.6.18/fs/ext3/xattr.c
+@@ -1007,7 +1007,7 @@ ext3_xattr_set_handle(handle_t *handle,
+ }
+ if (!error) {
+ ext3_xattr_update_super_block(handle, inode->i_sb);
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ error = ext3_mark_iloc_dirty(handle, inode, &is.iloc);
+ /*
+ * The bh is consumed by ext3_mark_iloc_dirty, even with
+Index: linux-2.6.18/include/linux/ext3_fs.h
+===================================================================
+--- linux-2.6.18.orig/include/linux/ext3_fs.h
++++ linux-2.6.18/include/linux/ext3_fs.h
+@@ -268,7 +268,7 @@ struct ext3_inode {
+ __le16 i_uid; /* Low 16 bits of Owner Uid */
+ __le32 i_size; /* Size in bytes */
+ __le32 i_atime; /* Access time */
+- __le32 i_ctime; /* Creation time */
++ __le32 i_ctime; /* Inode Change time */
+ __le32 i_mtime; /* Modification time */
+ __le32 i_dtime; /* Deletion Time */
+ __le16 i_gid; /* Low 16 bits of Group Id */
+@@ -317,10 +317,73 @@ struct ext3_inode {
+ } osd2; /* OS dependent 2 */
+ __le16 i_extra_isize;
+ __le16 i_pad1;
++ __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
++ __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
++ __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
++ __le32 i_crtime; /* File Creation time */
++ __le32 i_crtime_extra; /* extra File Creation time (nsec << 2 | epoch) */
+ };
+
+ #define i_size_high i_dir_acl
+
++#define EXT3_EPOCH_BITS 2
++#define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1)
++#define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS)
++
++#define EXT3_FITS_IN_INODE(ext3_inode, einode, field) \
++ ((offsetof(typeof(*ext3_inode), field) + \
++ sizeof((ext3_inode)->field)) \
++ <= (EXT3_GOOD_OLD_INODE_SIZE + \
++ (einode)->i_extra_isize)) \
++
++static inline __le32 ext3_encode_extra_time(struct timespec *time)
++{
++ return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
++ time->tv_sec >> 32 : 0) |
++ ((time->tv_nsec << 2) & EXT3_NSEC_MASK));
++}
++
++static inline void ext3_decode_extra_time(struct timespec *time, __le32 extra) {
++ if (sizeof(time->tv_sec) > 4)
++ time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT3_EPOCH_MASK)
++ << 32;
++ time->tv_nsec = (le32_to_cpu(extra) & EXT3_NSEC_MASK) >> 2;
++}
++
++#define EXT3_INODE_SET_XTIME(xtime, inode, raw_inode) \
++do { \
++ (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
++ if (EXT3_FITS_IN_INODE(raw_inode, EXT3_I(inode), xtime ## _extra)) \
++ (raw_inode)->xtime ## _extra = \
++ ext3_encode_extra_time(&(inode)->xtime); \
++} while (0)
++
++#define EXT3_EINODE_SET_XTIME(xtime, einode, raw_inode)\
++do { \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime)) \
++ (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
++ (raw_inode)->xtime ## _extra = \
++ ext3_encode_extra_time(&(einode)->xtime); \
++} while (0)
++
++#define EXT3_INODE_GET_XTIME(xtime, inode, raw_inode) \
++do { \
++ (inode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime); \
++ if (EXT3_FITS_IN_INODE(raw_inode, EXT3_I(inode), xtime ## _extra)) \
++ ext3_decode_extra_time(&(inode)->xtime, \
++ raw_inode->xtime ## _extra); \
++} while (0)
++
++#define EXT3_EINODE_GET_XTIME(xtime, einode, raw_inode) \
++do { \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime)) \
++ (einode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime); \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
++ ext3_decode_extra_time(&(einode)->xtime, \
++ raw_inode->xtime ## _extra); \
++} while (0)
++
+ #if defined(__KERNEL__) || defined(__linux__)
+ #define i_reserved1 osd1.linux1.l_i_reserved1
+ #define i_frag osd2.linux2.l_i_frag
+@@ -503,8 +566,10 @@ struct ext3_super_block {
+ __u8 s_reserved_char_pad;
+ __u16 s_reserved_word_pad;
+ __le32 s_default_mount_opts;
+- __le32 s_first_meta_bg; /* First metablock block group */
+- __u32 s_reserved[190]; /* Padding to the end of the block */
++ __le32 s_first_meta_bg; /* First metablock block group */
++ __le16 s_min_extra_isize; /* All inodes have at least # bytes */
++ __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
++ __u32 s_reserved[189]; /* Padding to the end of the block */
+ };
+
+ #ifdef __KERNEL__
+@@ -519,6 +584,13 @@ static inline struct ext3_inode_info *EX
+ return container_of(inode, struct ext3_inode_info, vfs_inode);
+ }
+
++static inline struct timespec ext3_current_time(struct inode *inode)
++{
++ return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
++ current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
++}
++
++
+ static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
+ {
+ return ino == EXT3_ROOT_INO ||
+@@ -590,6 +662,8 @@ static inline int ext3_valid_inum(struct
+ #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
+ #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
+ #define EXT3_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
++#define EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
++
+
+ #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
+ #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
+@@ -606,6 +680,7 @@ static inline int ext3_valid_inum(struct
+ #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
+ EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
+ EXT3_FEATURE_RO_COMPAT_DIR_NLINK| \
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE| \
+ EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
+
+ /*
+Index: linux-2.6.18/include/linux/ext3_fs_sb.h
+===================================================================
+--- linux-2.6.18.orig/include/linux/ext3_fs_sb.h
++++ linux-2.6.18/include/linux/ext3_fs_sb.h
+@@ -119,6 +119,8 @@ struct ext3_sb_info {
+ spinlock_t s_bal_lock;
+ unsigned long s_mb_buddies_generated;
+ unsigned long long s_mb_generation_time;
++
++ unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
+ };
+
+ #define EXT3_GROUP_INFO(sb, group) \
+Index: linux-2.6.18/include/linux/ext3_fs_i.h
+===================================================================
+--- linux-2.6.18.orig/include/linux/ext3_fs_i.h
++++ linux-2.6.18/include/linux/ext3_fs_i.h
+@@ -144,6 +144,7 @@ struct ext3_inode_info {
+ struct inode vfs_inode;
+
+ __u32 i_cached_extent[4];
++ struct timespec i_crtime;
+
+ void *i_filterdata;
+ };
ext3-lookup-dotdot-2.6.9.patch
ext3-sector_t-overflow-2.6.9-rhel4.patch
ext3-check-jbd-errors-2.6.9.patch
+ext3-nanosecond-2.6-rhel4.patch
ext3-remove-cond_resched-calls-2.6.12.patch
ext3-filterdata-2.6.15.patch
ext3-disable-write-barrier-by-default-2.6-sles10.patch
+ext3-nanosecond-2.6-sles10.patch
ext3-lookup-dotdot-2.6.9.patch
ext3-sector_t-overflow-2.6.5-suse.patch
ext3-check-jbd-errors-2.6.5.patch
+ext3-nanosecond-2.6-suse.patch
ext3-ialloc-2.6.patch
ext3-remove-cond_resched-calls-2.6.12.patch
ext3-filterdata-2.6.15.patch
+ext3-nanosecond-2.6.18-vanilla.patch
Description: lfs setstripe use optional parameters instead of postional
parameters.
+Severity : enhancement
+Bugzilla : 10651
+Description: Nanosecond timestamp support.
+
--------------------------------------------------------------------------------
tbd Cluster File Systems, Inc. <info@clusterfs.com>
--- /dev/null
+Index: linux-2.6.9-rhel4/fs/ext3/ialloc.c
+===================================================================
+--- linux-2.6.9-rhel4.orig/fs/ext3/ialloc.c
++++ linux-2.6.9-rhel4/fs/ext3/ialloc.c
+@@ -612,7 +612,8 @@ got:
+ /* This is the optimal IO size (for stat), not the fs block size */
+ inode->i_blksize = PAGE_SIZE;
+ inode->i_blocks = 0;
+- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
++ ext3_current_time(inode);
+
+ memset(ei->i_data, 0, sizeof(ei->i_data));
+ ei->i_next_alloc_block = 0;
+@@ -650,9 +651,8 @@ got:
+ spin_unlock(&sbi->s_next_gen_lock);
+
+ ei->i_state = EXT3_STATE_NEW;
+- ei->i_extra_isize =
+- (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) ?
+- sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
++
++ ei->i_extra_isize = EXT3_SB(sb)->s_want_extra_isize;
+
+ ret = inode;
+ if(DQUOT_ALLOC_INODE(inode)) {
+Index: linux-2.6.9-rhel4/fs/ext3/inode.c
+===================================================================
+--- linux-2.6.9-rhel4.orig/fs/ext3/inode.c
++++ linux-2.6.9-rhel4/fs/ext3/inode.c
+@@ -627,7 +627,7 @@ static int ext3_splice_branch(handle_t *
+
+ /* We are done with atomic stuff, now do the rest of housekeeping */
+
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+
+ /* had we spliced it onto indirect block? */
+@@ -2227,7 +2227,7 @@ do_indirects:
+ ;
+ }
+ up(&ei->truncate_sem);
+- inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_mtime = inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+
+ /* In a multi-transaction truncate, we only make the final
+@@ -2454,10 +2454,6 @@ void ext3_read_inode(struct inode * inod
+ }
+ inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
+ inode->i_size = le32_to_cpu(raw_inode->i_size);
+- inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
+- inode->i_ctime.tv_sec = le32_to_cpu(raw_inode->i_ctime);
+- inode->i_mtime.tv_sec = le32_to_cpu(raw_inode->i_mtime);
+- inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec = 0;
+
+ ei->i_state = 0;
+ ei->i_next_alloc_block = 0;
+@@ -2518,6 +2514,11 @@ void ext3_read_inode(struct inode * inod
+ else
+ ei->i_extra_isize = 0;
+
++ EXT3_INODE_GET_XTIME(i_ctime, inode, raw_inode);
++ EXT3_INODE_GET_XTIME(i_mtime, inode, raw_inode);
++ EXT3_INODE_GET_XTIME(i_atime, inode, raw_inode);
++ EXT3_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
++
+ if (S_ISREG(inode->i_mode)) {
+ inode->i_op = &ext3_file_inode_operations;
+ inode->i_fop = &ext3_file_operations;
+@@ -2598,9 +2599,12 @@ static int ext3_do_update_inode(handle_t
+ }
+ raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
+ raw_inode->i_size = cpu_to_le32(ei->i_disksize);
+- raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
+- raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
+- raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
++
++ EXT3_INODE_SET_XTIME(i_ctime, inode, raw_inode);
++ EXT3_INODE_SET_XTIME(i_mtime, inode, raw_inode);
++ EXT3_INODE_SET_XTIME(i_atime, inode, raw_inode);
++ EXT3_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
++
+ raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
+ raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
+ raw_inode->i_flags = cpu_to_le32(ei->i_flags);
+Index: linux-2.6.9-rhel4/fs/ext3/ioctl.c
+===================================================================
+--- linux-2.6.9-rhel4.orig/fs/ext3/ioctl.c
++++ linux-2.6.9-rhel4/fs/ext3/ioctl.c
+@@ -112,7 +112,7 @@ int ext3_ioctl (struct inode * inode, st
+ ei->i_flags = flags;
+
+ ext3_set_inode_flags(inode);
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+
+ err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+ flags_err:
+@@ -150,7 +150,7 @@ flags_err:
+ return PTR_ERR(handle);
+ err = ext3_reserve_inode_write(handle, inode, &iloc);
+ if (err == 0) {
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ inode->i_generation = generation;
+ err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+ }
+Index: linux-2.6.9-rhel4/fs/ext3/namei.c
+===================================================================
+--- linux-2.6.9-rhel4.orig/fs/ext3/namei.c
++++ linux-2.6.9-rhel4/fs/ext3/namei.c
+@@ -1302,7 +1302,7 @@ static int add_dirent_to_buf(handle_t *h
+ * happen is that the times are slightly out of date
+ * and/or different from the directory change time.
+ */
+- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
++ dir->i_mtime = dir->i_ctime = ext3_current_time(dir);
+ ext3_update_dx_flag(dir);
+ dir->i_version++;
+ ext3_mark_inode_dirty(handle, dir);
+@@ -2098,7 +2098,7 @@ static int ext3_rmdir (struct inode * di
+ inode->i_version++;
+ inode->i_nlink = 0;
+ ext3_orphan_add(handle, inode);
+- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
++ inode->i_ctime = dir->i_ctime = dir->i_mtime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ ext3_dec_count(handle, dir);
+ ext3_update_dx_flag(dir);
+@@ -2148,13 +2148,13 @@ static int ext3_unlink(struct inode * di
+ retval = ext3_delete_entry(handle, dir, de, bh);
+ if (retval)
+ goto end_unlink;
+- dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
++ dir->i_ctime = dir->i_mtime = ext3_current_time(dir);
+ ext3_update_dx_flag(dir);
+ ext3_mark_inode_dirty(handle, dir);
+ ext3_dec_count(handle, inode);
+ if (!inode->i_nlink)
+ ext3_orphan_add(handle, inode);
+- inode->i_ctime = dir->i_ctime;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ retval = 0;
+
+@@ -2255,7 +2255,7 @@ retry:
+ if (IS_DIRSYNC(dir))
+ handle->h_sync = 1;
+
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_inc_count(handle, inode);
+ atomic_inc(&inode->i_count);
+
+@@ -2357,7 +2357,7 @@ static int ext3_rename (struct inode * o
+ * Like most other Unix systems, set the ctime for inodes on a
+ * rename.
+ */
+- old_inode->i_ctime = CURRENT_TIME_SEC;
++ old_inode->i_ctime = ext3_current_time(old_inode);
+ ext3_mark_inode_dirty(handle, old_inode);
+
+ /*
+@@ -2390,9 +2390,9 @@ static int ext3_rename (struct inode * o
+
+ if (new_inode) {
+ ext3_dec_count(handle, new_inode);
+- new_inode->i_ctime = CURRENT_TIME_SEC;
++ new_inode->i_ctime = ext3_current_time(new_inode);
+ }
+- old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
++ old_dir->i_ctime = old_dir->i_mtime = ext3_current_time(old_dir);
+ ext3_update_dx_flag(old_dir);
+ if (dir_bh) {
+ BUFFER_TRACE(dir_bh, "get_write_access");
+Index: linux-2.6.9-rhel4/fs/ext3/super.c
+===================================================================
+--- linux-2.6.9-rhel4.orig/fs/ext3/super.c
++++ linux-2.6.9-rhel4/fs/ext3/super.c
+@@ -1468,6 +1468,8 @@ static int ext3_fill_super (struct super
+ sbi->s_inode_size);
+ goto failed_mount;
+ }
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE)
++ sb->s_time_gran = 1 << (EXT3_EPOCH_BITS - 2);
+ }
+ sbi->s_frag_size = EXT3_MIN_FRAG_SIZE <<
+ le32_to_cpu(es->s_log_frag_size);
+@@ -1654,6 +1656,32 @@ static int ext3_fill_super (struct super
+ }
+
+ ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
++
++ /* determine the minimum size of new large inodes, if present */
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ if (EXT3_HAS_RO_COMPAT_FEATURE(sb,
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE)) {
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_want_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_want_extra_isize);
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_min_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_min_extra_isize);
++ }
++ }
++ /* Check if enough inode space is available */
++ if (EXT3_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >
++ sbi->s_inode_size) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ printk(KERN_INFO "EXT3-fs: required extra inode space not"
++ "available.\n");
++ }
++
+ /*
+ * akpm: core read_super() calls in here with the superblock locked.
+ * That deadlocks, because orphan cleanup needs to lock the superblock
+Index: linux-2.6.9-rhel4/fs/ext3/xattr.c
+===================================================================
+--- linux-2.6.9-rhel4.orig/fs/ext3/xattr.c
++++ linux-2.6.9-rhel4/fs/ext3/xattr.c
+@@ -1305,7 +1305,7 @@ getblk_failed:
+
+ /* Update the inode. */
+ EXT3_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0;
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ if (IS_SYNC(inode))
+ handle->h_sync = 1;
+Index: linux-2.6.9-rhel4/include/linux/ext3_fs.h
+===================================================================
+--- linux-2.6.9-rhel4.orig/include/linux/ext3_fs.h
++++ linux-2.6.9-rhel4/include/linux/ext3_fs.h
+@@ -258,7 +258,7 @@ struct ext3_inode {
+ __le16 i_uid; /* Low 16 bits of Owner Uid */
+ __le32 i_size; /* Size in bytes */
+ __le32 i_atime; /* Access time */
+- __le32 i_ctime; /* Creation time */
++ __le32 i_ctime; /* Inode Change time */
+ __le32 i_mtime; /* Modification time */
+ __le32 i_dtime; /* Deletion Time */
+ __le16 i_gid; /* Low 16 bits of Group Id */
+@@ -307,10 +307,73 @@ struct ext3_inode {
+ } osd2; /* OS dependent 2 */
+ __u16 i_extra_isize;
+ __u16 i_pad1;
++ __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
++ __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
++ __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
++ __le32 i_crtime; /* File Creation time */
++ __le32 i_crtime_extra; /* extra File Creation time (nsec << 2 | epoch) */
+ };
+
+ #define i_size_high i_dir_acl
+
++#define EXT3_EPOCH_BITS 2
++#define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1)
++#define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS)
++
++#define EXT3_FITS_IN_INODE(ext3_inode, einode, field) \
++ ((offsetof(typeof(*ext3_inode), field) + \
++ sizeof((ext3_inode)->field)) \
++ <= (EXT3_GOOD_OLD_INODE_SIZE + \
++ (einode)->i_extra_isize)) \
++
++static inline __le32 ext3_encode_extra_time(struct timespec *time)
++{
++ return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
++ time->tv_sec >> 32 : 0) |
++ ((time->tv_nsec << 2) & EXT3_NSEC_MASK));
++}
++
++static inline void ext3_decode_extra_time(struct timespec *time, __le32 extra) {
++ if (sizeof(time->tv_sec) > 4)
++ time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT3_EPOCH_MASK)
++ << 32;
++ time->tv_nsec = (le32_to_cpu(extra) & EXT3_NSEC_MASK) >> 2;
++}
++
++#define EXT3_INODE_SET_XTIME(xtime, inode, raw_inode) \
++do { \
++ (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
++ if (EXT3_FITS_IN_INODE(raw_inode, EXT3_I(inode), xtime ## _extra))\
++ (raw_inode)->xtime ## _extra = \
++ ext3_encode_extra_time(&(inode)->xtime); \
++} while (0)
++
++#define EXT3_EINODE_SET_XTIME(xtime, einode, raw_inode) \
++do { \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime)) \
++ (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
++ (raw_inode)->xtime ## _extra = \
++ ext3_encode_extra_time(&(einode)->xtime); \
++} while (0)
++
++#define EXT3_INODE_GET_XTIME(xtime, inode, raw_inode) \
++do { \
++ (inode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime); \
++ if (EXT3_FITS_IN_INODE(raw_inode, EXT3_I(inode), xtime ## _extra))\
++ ext3_decode_extra_time(&(inode)->xtime, \
++ raw_inode->xtime ## _extra); \
++} while (0)
++
++#define EXT3_EINODE_GET_XTIME(xtime, einode, raw_inode) \
++do { \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime)) \
++ (einode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime); \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
++ ext3_decode_extra_time(&(einode)->xtime, \
++ raw_inode->xtime ## _extra); \
++} while (0)
++
+ #if defined(__KERNEL__) || defined(__linux__)
+ #define i_reserved1 osd1.linux1.l_i_reserved1
+ #define i_frag osd2.linux2.l_i_frag
+@@ -490,7 +553,9 @@ struct ext3_super_block {
+ __u16 s_reserved_word_pad;
+ __le32 s_default_mount_opts;
+ __le32 s_first_meta_bg; /* First metablock block group */
+- __u32 s_reserved[190]; /* Padding to the end of the block */
++ __le16 s_min_extra_isize; /* All inodes have at least # bytes */
++ __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
++ __u32 s_reserved[189]; /* Padding to the end of the block */
+ };
+
+ #ifdef __KERNEL__
+@@ -565,6 +630,8 @@ static inline struct ext3_inode_info *EX
+ #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
+ #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
+ #define EXT3_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
++#define EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
++
+
+ #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
+ #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
+@@ -581,6 +648,7 @@ static inline struct ext3_inode_info *EX
+ #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
+ EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
+ EXT3_FEATURE_RO_COMPAT_DIR_NLINK| \
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE| \
+ EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
+
+ /*
+@@ -708,6 +776,12 @@ static inline struct ext3_inode *ext3_ra
+ return (struct ext3_inode *) (iloc->bh->b_data + iloc->offset);
+ }
+
++static inline struct timespec ext3_current_time(struct inode *inode)
++{
++ return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
++ current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
++}
++
+ /*
+ * This structure is stuffed into the struct file's private_data field
+ * for directories. It is where we put information so that we can do
+Index: linux-2.6.9-rhel4/include/linux/ext3_fs_i.h
+===================================================================
+--- linux-2.6.9-rhel4.orig/include/linux/ext3_fs_i.h
++++ linux-2.6.9-rhel4/include/linux/ext3_fs_i.h
+@@ -130,6 +130,7 @@ struct ext3_inode_info {
+ struct inode vfs_inode;
+
+ __u32 i_cached_extent[4];
++ struct timespec i_crtime;
+ };
+
+ #endif /* _LINUX_EXT3_FS_I */
+Index: linux-2.6.9-rhel4/include/linux/ext3_fs_sb.h
+===================================================================
+--- linux-2.6.9-rhel4.orig/include/linux/ext3_fs_sb.h
++++ linux-2.6.9-rhel4/include/linux/ext3_fs_sb.h
+@@ -122,6 +122,8 @@ struct ext3_sb_info {
+ spinlock_t s_bal_lock;
+ unsigned long s_mb_buddies_generated;
+ unsigned long long s_mb_generation_time;
++
++ unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
+ };
+
+ #define EXT3_GROUP_INFO(sb, group) \
--- /dev/null
+Index: linux-2.6.16.27-0.9/fs/ext3/ialloc.c
+===================================================================
+--- linux-2.6.16.27-0.9.orig/fs/ext3/ialloc.c
++++ linux-2.6.16.27-0.9/fs/ext3/ialloc.c
+@@ -577,7 +577,8 @@ got:
+ /* This is the optimal IO size (for stat), not the fs block size */
+ inode->i_blksize = PAGE_SIZE;
+ inode->i_blocks = 0;
+- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
++ ext3_current_time(inode);
+
+ memset(ei->i_data, 0, sizeof(ei->i_data));
+ ei->i_dir_start_lookup = 0;
+@@ -609,9 +610,8 @@ got:
+ spin_unlock(&sbi->s_next_gen_lock);
+
+ ei->i_state = EXT3_STATE_NEW;
+- ei->i_extra_isize =
+- (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) ?
+- sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
++
++ ei->i_extra_isize = EXT3_SB(sb)->s_want_extra_isize;
+
+ ret = inode;
+ if(DQUOT_ALLOC_INODE(inode)) {
+Index: linux-2.6.16.27-0.9/fs/ext3/inode.c
+===================================================================
+--- linux-2.6.16.27-0.9.orig/fs/ext3/inode.c
++++ linux-2.6.16.27-0.9/fs/ext3/inode.c
+@@ -620,7 +620,7 @@ static int ext3_splice_branch(handle_t *
+
+ /* We are done with atomic stuff, now do the rest of housekeeping */
+
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+
+ /* had we spliced it onto indirect block? */
+@@ -2244,7 +2244,7 @@ do_indirects:
+ ext3_discard_reservation(inode);
+
+ up(&ei->truncate_sem);
+- inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_mtime = inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+
+ /* In a multi-transaction truncate, we only make the final
+@@ -2479,10 +2479,6 @@ void ext3_read_inode(struct inode * inod
+ }
+ inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
+ inode->i_size = le32_to_cpu(raw_inode->i_size);
+- inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
+- inode->i_ctime.tv_sec = le32_to_cpu(raw_inode->i_ctime);
+- inode->i_mtime.tv_sec = le32_to_cpu(raw_inode->i_mtime);
+- inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec = 0;
+
+ ei->i_state = 0;
+ ei->i_dir_start_lookup = 0;
+@@ -2557,6 +2553,11 @@ void ext3_read_inode(struct inode * inod
+ } else
+ ei->i_extra_isize = 0;
+
++ EXT3_INODE_GET_XTIME(i_ctime, inode, raw_inode);
++ EXT3_INODE_GET_XTIME(i_mtime, inode, raw_inode);
++ EXT3_INODE_GET_XTIME(i_atime, inode, raw_inode);
++ EXT3_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
++
+ if (S_ISREG(inode->i_mode)) {
+ inode->i_op = &ext3_file_inode_operations;
+ inode->i_fop = &ext3_file_operations;
+@@ -2637,9 +2638,12 @@ static int ext3_do_update_inode(handle_t
+ }
+ raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
+ raw_inode->i_size = cpu_to_le32(ei->i_disksize);
+- raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
+- raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
+- raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
++
++ EXT3_INODE_SET_XTIME(i_ctime, inode, raw_inode);
++ EXT3_INODE_SET_XTIME(i_mtime, inode, raw_inode);
++ EXT3_INODE_SET_XTIME(i_atime, inode, raw_inode);
++ EXT3_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
++
+ raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
+ raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
+ raw_inode->i_flags = cpu_to_le32(ei->i_flags);
+Index: linux-2.6.16.27-0.9/fs/ext3/ioctl.c
+===================================================================
+--- linux-2.6.16.27-0.9.orig/fs/ext3/ioctl.c
++++ linux-2.6.16.27-0.9/fs/ext3/ioctl.c
+@@ -88,7 +88,7 @@ int ext3_ioctl (struct inode * inode, st
+ ei->i_flags = flags;
+
+ ext3_set_inode_flags(inode);
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+
+ err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+ flags_err:
+@@ -126,7 +126,7 @@ flags_err:
+ return PTR_ERR(handle);
+ err = ext3_reserve_inode_write(handle, inode, &iloc);
+ if (err == 0) {
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ inode->i_generation = generation;
+ err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+ }
+Index: linux-2.6.16.27-0.9/fs/ext3/namei.c
+===================================================================
+--- linux-2.6.16.27-0.9.orig/fs/ext3/namei.c
++++ linux-2.6.16.27-0.9/fs/ext3/namei.c
+@@ -1276,7 +1276,7 @@ static int add_dirent_to_buf(handle_t *h
+ * happen is that the times are slightly out of date
+ * and/or different from the directory change time.
+ */
+- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
++ dir->i_mtime = dir->i_ctime = ext3_current_time(dir);
+ ext3_update_dx_flag(dir);
+ dir->i_version++;
+ ext3_mark_inode_dirty(handle, dir);
+@@ -2056,7 +2056,7 @@ static int ext3_rmdir (struct inode * di
+ inode->i_version++;
+ inode->i_nlink = 0;
+ ext3_orphan_add(handle, inode);
+- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
++ inode->i_ctime = dir->i_ctime = dir->i_mtime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ ext3_dec_count(handle, dir);
+ ext3_update_dx_flag(dir);
+@@ -2106,13 +2106,13 @@ static int ext3_unlink(struct inode * di
+ retval = ext3_delete_entry(handle, dir, de, bh);
+ if (retval)
+ goto end_unlink;
+- dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
++ dir->i_ctime = dir->i_mtime = ext3_current_time(dir);
+ ext3_update_dx_flag(dir);
+ ext3_mark_inode_dirty(handle, dir);
+ ext3_dec_count(handle, inode);
+ if (!inode->i_nlink)
+ ext3_orphan_add(handle, inode);
+- inode->i_ctime = dir->i_ctime;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ retval = 0;
+
+@@ -2214,7 +2214,7 @@ retry:
+ if (IS_DIRSYNC(dir))
+ handle->h_sync = 1;
+
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_inc_count(handle, inode);
+ atomic_inc(&inode->i_count);
+
+@@ -2317,7 +2317,7 @@ static int ext3_rename (struct inode * o
+ * Like most other Unix systems, set the ctime for inodes on a
+ * rename.
+ */
+- old_inode->i_ctime = CURRENT_TIME_SEC;
++ old_inode->i_ctime = ext3_current_time(old_inode);
+ ext3_mark_inode_dirty(handle, old_inode);
+
+ /*
+@@ -2350,9 +2350,9 @@ static int ext3_rename (struct inode * o
+
+ if (new_inode) {
+ ext3_dec_count(handle, new_inode);
+- new_inode->i_ctime = CURRENT_TIME_SEC;
++ new_inode->i_ctime = ext3_current_time(new_inode);
+ }
+- old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
++ old_dir->i_ctime = old_dir->i_mtime = ext3_current_time(old_dir);
+ ext3_update_dx_flag(old_dir);
+ if (dir_bh) {
+ BUFFER_TRACE(dir_bh, "get_write_access");
+Index: linux-2.6.16.27-0.9/fs/ext3/super.c
+===================================================================
+--- linux-2.6.16.27-0.9.orig/fs/ext3/super.c
++++ linux-2.6.16.27-0.9/fs/ext3/super.c
+@@ -1614,6 +1614,8 @@ static int ext3_fill_super (struct super
+ sbi->s_inode_size);
+ goto failed_mount;
+ }
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE)
++ sb->s_time_gran = 1 << (EXT3_EPOCH_BITS - 2);
+ }
+ sbi->s_frag_size = EXT3_MIN_FRAG_SIZE <<
+ le32_to_cpu(es->s_log_frag_size);
+@@ -1809,6 +1811,32 @@ static int ext3_fill_super (struct super
+ }
+
+ ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
++
++ /* determine the minimum size of new large inodes, if present */
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ if (EXT3_HAS_RO_COMPAT_FEATURE(sb,
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE)) {
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_want_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_want_extra_isize);
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_min_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_min_extra_isize);
++ }
++ }
++ /* Check if enough inode space is available */
++ if (EXT3_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >
++ sbi->s_inode_size) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ printk(KERN_INFO "EXT3-fs: required extra inode space not"
++ "available.\n");
++ }
++
+ /*
+ * akpm: core read_super() calls in here with the superblock locked.
+ * That deadlocks, because orphan cleanup needs to lock the superblock
+Index: linux-2.6.16.27-0.9/fs/ext3/xattr.c
+===================================================================
+--- linux-2.6.16.27-0.9.orig/fs/ext3/xattr.c
++++ linux-2.6.16.27-0.9/fs/ext3/xattr.c
+@@ -1006,8 +1006,8 @@ ext3_xattr_set_handle(handle_t *handle,
+ }
+ if (!error) {
+ ext3_xattr_update_super_block(handle, inode->i_sb);
+- inode->i_ctime = CURRENT_TIME_SEC;
+- error = ext3_mark_iloc_dirty(handle, inode, &is.iloc);
++ inode->i_ctime = ext3_current_time(inode);
++ ext3_mark_inode_dirty(handle, inode);
+ /*
+ * The bh is consumed by ext3_mark_iloc_dirty, even with
+ * error != 0.
+Index: linux-2.6.16.27-0.9/include/linux/ext3_fs.h
+===================================================================
+--- linux-2.6.16.27-0.9.orig/include/linux/ext3_fs.h
++++ linux-2.6.16.27-0.9/include/linux/ext3_fs.h
+@@ -272,7 +272,7 @@ struct ext3_inode {
+ __le16 i_uid; /* Low 16 bits of Owner Uid */
+ __le32 i_size; /* Size in bytes */
+ __le32 i_atime; /* Access time */
+- __le32 i_ctime; /* Creation time */
++ __le32 i_ctime; /* Inode Change time */
+ __le32 i_mtime; /* Modification time */
+ __le32 i_dtime; /* Deletion Time */
+ __le16 i_gid; /* Low 16 bits of Group Id */
+@@ -321,10 +321,73 @@ struct ext3_inode {
+ } osd2; /* OS dependent 2 */
+ __le16 i_extra_isize;
+ __le16 i_pad1;
++ __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
++ __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
++ __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
++ __le32 i_crtime; /* File Creation time */
++ __le32 i_crtime_extra; /* extra File Creation time (nsec << 2 | epoch) */
+ };
+
+ #define i_size_high i_dir_acl
+
++#define EXT3_EPOCH_BITS 2
++#define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1)
++#define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS)
++
++#define EXT3_FITS_IN_INODE(ext3_inode, einode, field) \
++ ((offsetof(typeof(*ext3_inode), field) + \
++ sizeof((ext3_inode)->field)) \
++ <= (EXT3_GOOD_OLD_INODE_SIZE + \
++ (einode)->i_extra_isize)) \
++
++static inline __le32 ext3_encode_extra_time(struct timespec *time)
++{
++ return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
++ time->tv_sec >> 32 : 0) |
++ ((time->tv_nsec << 2) & EXT3_NSEC_MASK));
++}
++
++static inline void ext3_decode_extra_time(struct timespec *time, __le32 extra) {
++ if (sizeof(time->tv_sec) > 4)
++ time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT3_EPOCH_MASK)
++ << 32;
++ time->tv_nsec = (le32_to_cpu(extra) & EXT3_NSEC_MASK) >> 2;
++}
++
++#define EXT3_INODE_SET_XTIME(xtime, inode, raw_inode) \
++do { \
++ (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
++ if (EXT3_FITS_IN_INODE(raw_inode, EXT3_I(inode), xtime ## _extra)) \
++ (raw_inode)->xtime ## _extra = \
++ ext3_encode_extra_time(&(inode)->xtime); \
++} while (0)
++
++#define EXT3_EINODE_SET_XTIME(xtime, einode, raw_inode) \
++do { \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime)) \
++ (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
++ (raw_inode)->xtime ## _extra = \
++ ext3_encode_extra_time(&(einode)->xtime); \
++} while (0)
++
++#define EXT3_INODE_GET_XTIME(xtime, inode, raw_inode) \
++do { \
++ (inode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime); \
++ if (EXT3_FITS_IN_INODE(raw_inode, EXT3_I(inode), xtime ## _extra))\
++ ext3_decode_extra_time(&(inode)->xtime, \
++ raw_inode->xtime ## _extra); \
++} while (0)
++
++#define EXT3_EINODE_GET_XTIME(xtime, einode, raw_inode) \
++do { \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime)) \
++ (einode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime);\
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
++ ext3_decode_extra_time(&(einode)->xtime, \
++ raw_inode->xtime ## _extra); \
++} while (0)
++
+ #if defined(__KERNEL__) || defined(__linux__)
+ #define i_reserved1 osd1.linux1.l_i_reserved1
+ #define i_frag osd2.linux2.l_i_frag
+@@ -508,7 +571,9 @@ struct ext3_super_block {
+ __u16 s_reserved_word_pad;
+ __le32 s_default_mount_opts;
+ __le32 s_first_meta_bg; /* First metablock block group */
+- __u32 s_reserved[190]; /* Padding to the end of the block */
++ __le16 s_min_extra_isize; /* All inodes have at least # bytes */
++ __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
++ __u32 s_reserved[189]; /* Padding to the end of the block */
+ };
+
+ #ifdef __KERNEL__
+@@ -583,6 +648,8 @@ static inline struct ext3_inode_info *EX
+ #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
+ #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
+ #define EXT3_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
++#define EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
++
+
+ #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
+ #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
+@@ -599,6 +666,7 @@ static inline struct ext3_inode_info *EX
+ #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
+ EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
+ EXT3_FEATURE_RO_COMPAT_DIR_NLINK| \
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE| \
+ EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
+
+ /*
+@@ -726,6 +794,12 @@ static inline struct ext3_inode *ext3_ra
+ return (struct ext3_inode *) (iloc->bh->b_data + iloc->offset);
+ }
+
++static inline struct timespec ext3_current_time(struct inode *inode)
++{
++ return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
++ current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
++}
++
+ /*
+ * This structure is stuffed into the struct file's private_data field
+ * for directories. It is where we put information so that we can do
+Index: linux-2.6.16.27-0.9/include/linux/ext3_fs_i.h
+===================================================================
+--- linux-2.6.16.27-0.9.orig/include/linux/ext3_fs_i.h
++++ linux-2.6.16.27-0.9/include/linux/ext3_fs_i.h
+@@ -135,6 +135,7 @@ struct ext3_inode_info {
+ struct inode vfs_inode;
+
+ __u32 i_cached_extent[4];
++ struct timespec i_crtime;
+
+ void *i_filterdata;
+ };
+Index: linux-2.6.16.27-0.9/include/linux/ext3_fs_sb.h
+===================================================================
+--- linux-2.6.16.27-0.9.orig/include/linux/ext3_fs_sb.h
++++ linux-2.6.16.27-0.9/include/linux/ext3_fs_sb.h
+@@ -119,6 +119,8 @@ struct ext3_sb_info {
+ spinlock_t s_bal_lock;
+ unsigned long s_mb_buddies_generated;
+ unsigned long long s_mb_generation_time;
++
++ unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
+ };
+
+ #define EXT3_GROUP_INFO(sb, group) \
--- /dev/null
+Index: linux-2.6.5-7.283/fs/ext3/ialloc.c
+===================================================================
+--- linux-2.6.5-7.283.orig/fs/ext3/ialloc.c
++++ linux-2.6.5-7.283/fs/ext3/ialloc.c
+@@ -613,7 +613,8 @@ got:
+ /* This is the optimal IO size (for stat), not the fs block size */
+ inode->i_blksize = PAGE_SIZE;
+ inode->i_blocks = 0;
+- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
++ inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
++ CURRENT_TIME;
+
+ memset(ei->i_data, 0, sizeof(ei->i_data));
+ ei->i_next_alloc_block = 0;
+@@ -651,9 +652,8 @@ got:
+ spin_unlock(&sbi->s_next_gen_lock);
+
+ ei->i_state = EXT3_STATE_NEW;
+- ei->i_extra_isize =
+- (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) ?
+- sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
++
++ ei->i_extra_isize = EXT3_SB(sb)->s_want_extra_isize;
+
+ ret = inode;
+ if(DQUOT_ALLOC_INODE(inode)) {
+Index: linux-2.6.5-7.283/fs/ext3/inode.c
+===================================================================
+--- linux-2.6.5-7.283.orig/fs/ext3/inode.c
++++ linux-2.6.5-7.283/fs/ext3/inode.c
+@@ -2459,7 +2459,11 @@ void ext3_read_inode(struct inode * inod
+ inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
+ inode->i_ctime.tv_sec = le32_to_cpu(raw_inode->i_ctime);
+ inode->i_mtime.tv_sec = le32_to_cpu(raw_inode->i_mtime);
+- inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec = 0;
++ if (EXT3_FITS_IN_INODE(raw_inode, ei, i_crtime)) {
++ ei->i_crtime.tv_sec = le32_to_cpu(raw_inode->i_crtime);
++ }
++ inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec =
++ ei->i_crtime.tv_nsec = 0;
+
+ ei->i_state = 0;
+ ei->i_next_alloc_block = 0;
+@@ -2603,6 +2607,10 @@ static int ext3_do_update_inode(handle_t
+ raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
+ raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
+ raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
++ if (EXT3_FITS_IN_INODE(raw_inode, ei, i_crtime)) {
++ raw_inode->i_crtime = cpu_to_le32(ei->i_crtime.tv_sec);
++ }
++
+ raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
+ raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
+ raw_inode->i_flags = cpu_to_le32(ei->i_flags);
+Index: linux-2.6.5-7.283/fs/ext3/super.c
+===================================================================
+--- linux-2.6.5-7.283.orig/fs/ext3/super.c
++++ linux-2.6.5-7.283/fs/ext3/super.c
+@@ -1515,6 +1515,32 @@ static int ext3_fill_super (struct super
+ }
+
+ ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
++
++ /* determine the minimum size of new large inodes, if present */
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ if (EXT3_HAS_RO_COMPAT_FEATURE(sb,
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE)) {
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_want_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_want_extra_isize);
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_min_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_min_extra_isize);
++ }
++ }
++ /* Check if enough inode space is available */
++ if (EXT3_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >
++ sbi->s_inode_size) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ printk(KERN_INFO "EXT3-fs: required extra inode space not"
++ "available.\n");
++ }
++
+ /*
+ * akpm: core read_super() calls in here with the superblock locked.
+ * That deadlocks, because orphan cleanup needs to lock the superblock
+Index: linux-2.6.5-7.283/include/linux/ext3_fs.h
+===================================================================
+--- linux-2.6.5-7.283.orig/include/linux/ext3_fs.h
++++ linux-2.6.5-7.283/include/linux/ext3_fs.h
+@@ -232,7 +232,7 @@ struct ext3_inode {
+ __u16 i_uid; /* Low 16 bits of Owner Uid */
+ __u32 i_size; /* Size in bytes */
+ __u32 i_atime; /* Access time */
+- __u32 i_ctime; /* Creation time */
++ __u32 i_ctime; /* Inode Change time */
+ __u32 i_mtime; /* Modification time */
+ __u32 i_dtime; /* Deletion Time */
+ __u16 i_gid; /* Low 16 bits of Group Id */
+@@ -281,10 +281,25 @@ struct ext3_inode {
+ } osd2; /* OS dependent 2 */
+ __u16 i_extra_isize;
+ __u16 i_pad1;
++ __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
++ __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
++ __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
++ __le32 i_crtime; /* File Creation time */
++ __le32 i_crtime_extra; /* extra File Creation time (nsec << 2 | epoch) */
+ };
+
+ #define i_size_high i_dir_acl
+
++#define EXT3_EPOCH_BITS 2
++#define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1)
++#define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS)
++
++#define EXT3_FITS_IN_INODE(ext3_inode, einode, field) \
++ ((offsetof(typeof(*ext3_inode), field) + \
++ sizeof((ext3_inode)->field)) \
++ <= (EXT3_GOOD_OLD_INODE_SIZE + \
++ (einode)->i_extra_isize)) \
++
+ #if defined(__KERNEL__) || defined(__linux__)
+ #define i_reserved1 osd1.linux1.l_i_reserved1
+ #define i_frag osd2.linux2.l_i_frag
+@@ -464,7 +479,9 @@ struct ext3_super_block {
+ __u16 s_reserved_word_pad;
+ __u32 s_default_mount_opts;
+ __u32 s_first_meta_bg; /* First metablock block group */
+- __u32 s_reserved[190]; /* Padding to the end of the block */
++ __le16 s_min_extra_isize; /* All inodes have at least # bytes */
++ __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
++ __u32 s_reserved[189]; /* Padding to the end of the block */
+ };
+
+ #ifdef __KERNEL__
+@@ -539,6 +556,7 @@ static inline struct ext3_inode_info *EX
+ #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
+ #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
+ #define EXT3_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
++#define EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
+
+ #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
+ #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
+@@ -555,6 +573,7 @@ static inline struct ext3_inode_info *EX
+ #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
+ EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
+ EXT3_FEATURE_RO_COMPAT_DIR_NLINK| \
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE| \
+ EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
+
+ /*
+Index: linux-2.6.5-7.283/include/linux/ext3_fs_i.h
+===================================================================
+--- linux-2.6.5-7.283.orig/include/linux/ext3_fs_i.h
++++ linux-2.6.5-7.283/include/linux/ext3_fs_i.h
+@@ -131,6 +131,7 @@ struct ext3_inode_info {
+ struct inode vfs_inode;
+
+ struct ext3_ext_cache i_cached_extent;
++ struct timespec i_crtime;
+ };
+
+ #endif /* _LINUX_EXT3_FS_I */
+Index: linux-2.6.5-7.283/include/linux/ext3_fs_sb.h
+===================================================================
+--- linux-2.6.5-7.283.orig/include/linux/ext3_fs_sb.h
++++ linux-2.6.5-7.283/include/linux/ext3_fs_sb.h
+@@ -119,6 +119,8 @@ struct ext3_sb_info {
+ spinlock_t s_bal_lock;
+ unsigned long s_mb_buddies_generated;
+ unsigned long long s_mb_generation_time;
++
++ unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
+ };
+
+ #define EXT3_GROUP_INFO(sb, group) \
--- /dev/null
+Index: linux-2.6.18/fs/ext3/ialloc.c
+===================================================================
+--- linux-2.6.18.orig/fs/ext3/ialloc.c
++++ linux-2.6.18/fs/ext3/ialloc.c
+@@ -615,7 +615,8 @@ got:
+ /* This is the optimal IO size (for stat), not the fs block size */
+ inode->i_blksize = PAGE_SIZE;
+ inode->i_blocks = 0;
+- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
++ ext3_current_time(inode);
+
+ memset(ei->i_data, 0, sizeof(ei->i_data));
+ ei->i_dir_start_lookup = 0;
+@@ -647,9 +648,8 @@ got:
+ spin_unlock(&sbi->s_next_gen_lock);
+
+ ei->i_state = EXT3_STATE_NEW;
+- ei->i_extra_isize =
+- (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) ?
+- sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
++
++ ei->i_extra_isize = EXT3_SB(sb)->s_want_extra_isize;
+
+ ret = inode;
+ if(DQUOT_ALLOC_INODE(inode)) {
+Index: linux-2.6.18/fs/ext3/inode.c
+===================================================================
+--- linux-2.6.18.orig/fs/ext3/inode.c
++++ linux-2.6.18/fs/ext3/inode.c
+@@ -729,7 +729,7 @@ static int ext3_splice_branch(handle_t *
+
+ /* We are done with atomic stuff, now do the rest of housekeeping */
+
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+
+ /* had we spliced it onto indirect block? */
+@@ -2388,7 +2388,7 @@ do_indirects:
+ ext3_discard_reservation(inode);
+
+ mutex_unlock(&ei->truncate_mutex);
+- inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_mtime = inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+
+ /*
+@@ -2624,10 +2624,6 @@ void ext3_read_inode(struct inode * inod
+ }
+ inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
+ inode->i_size = le32_to_cpu(raw_inode->i_size);
+- inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
+- inode->i_ctime.tv_sec = le32_to_cpu(raw_inode->i_ctime);
+- inode->i_mtime.tv_sec = le32_to_cpu(raw_inode->i_mtime);
+- inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec = 0;
+
+ ei->i_state = 0;
+ ei->i_dir_start_lookup = 0;
+@@ -2702,6 +2698,11 @@ void ext3_read_inode(struct inode * inod
+ } else
+ ei->i_extra_isize = 0;
+
++ EXT3_INODE_GET_XTIME(i_ctime, inode, raw_inode);
++ EXT3_INODE_GET_XTIME(i_mtime, inode, raw_inode);
++ EXT3_INODE_GET_XTIME(i_atime, inode, raw_inode);
++ EXT3_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
++
+ if (S_ISREG(inode->i_mode)) {
+ inode->i_op = &ext3_file_inode_operations;
+ inode->i_fop = &ext3_file_operations;
+@@ -2782,9 +2783,12 @@ static int ext3_do_update_inode(handle_t
+ }
+ raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
+ raw_inode->i_size = cpu_to_le32(ei->i_disksize);
+- raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
+- raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
+- raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
++
++ EXT3_INODE_SET_XTIME(i_ctime, inode, raw_inode);
++ EXT3_INODE_SET_XTIME(i_mtime, inode, raw_inode);
++ EXT3_INODE_SET_XTIME(i_atime, inode, raw_inode);
++ EXT3_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
++
+ raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
+ raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
+ raw_inode->i_flags = cpu_to_le32(ei->i_flags);
+Index: linux-2.6.18/fs/ext3/ioctl.c
+===================================================================
+--- linux-2.6.18.orig/fs/ext3/ioctl.c
++++ linux-2.6.18/fs/ext3/ioctl.c
+@@ -120,7 +120,7 @@ int ext3_ioctl (struct inode * inode, st
+ ei->i_flags = flags;
+
+ ext3_set_inode_flags(inode);
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+
+ err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+ flags_err:
+@@ -161,7 +161,7 @@ flags_err:
+ return PTR_ERR(handle);
+ err = ext3_reserve_inode_write(handle, inode, &iloc);
+ if (err == 0) {
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ inode->i_generation = generation;
+ err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+ }
+Index: linux-2.6.18/fs/ext3/namei.c
+===================================================================
+--- linux-2.6.18.orig/fs/ext3/namei.c
++++ linux-2.6.18/fs/ext3/namei.c
+@@ -1287,7 +1287,7 @@ static int add_dirent_to_buf(handle_t *h
+ * happen is that the times are slightly out of date
+ * and/or different from the directory change time.
+ */
+- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
++ dir->i_mtime = dir->i_ctime = ext3_current_time(dir);
+ ext3_update_dx_flag(dir);
+ dir->i_version++;
+ ext3_mark_inode_dirty(handle, dir);
+@@ -2079,7 +2079,7 @@ static int ext3_rmdir (struct inode * di
+ inode->i_version++;
+ inode->i_nlink = 0;
+ ext3_orphan_add(handle, inode);
+- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
++ inode->i_ctime = dir->i_ctime = dir->i_mtime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ ext3_dec_count(handle, dir);
+ ext3_update_dx_flag(dir);
+@@ -2129,13 +2129,13 @@ static int ext3_unlink(struct inode * di
+ retval = ext3_delete_entry(handle, dir, de, bh);
+ if (retval)
+ goto end_unlink;
+- dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
++ dir->i_ctime = dir->i_mtime = ext3_current_time(dir);
+ ext3_update_dx_flag(dir);
+ ext3_mark_inode_dirty(handle, dir);
+ ext3_dec_count(handle, inode);
+ if (!inode->i_nlink)
+ ext3_orphan_add(handle, inode);
+- inode->i_ctime = dir->i_ctime;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_mark_inode_dirty(handle, inode);
+ retval = 0;
+
+@@ -2237,7 +2237,7 @@ retry:
+ if (IS_DIRSYNC(dir))
+ handle->h_sync = 1;
+
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ ext3_inc_count(handle, inode);
+ atomic_inc(&inode->i_count);
+
+@@ -2340,7 +2340,7 @@ static int ext3_rename (struct inode * o
+ * Like most other Unix systems, set the ctime for inodes on a
+ * rename.
+ */
+- old_inode->i_ctime = CURRENT_TIME_SEC;
++ old_inode->i_ctime = ext3_current_time(old_inode);
+ ext3_mark_inode_dirty(handle, old_inode);
+
+ /*
+@@ -2373,9 +2373,9 @@ static int ext3_rename (struct inode * o
+
+ if (new_inode) {
+ ext3_dec_count(handle, new_inode);
+- new_inode->i_ctime = CURRENT_TIME_SEC;
++ new_inode->i_ctime = ext3_current_time(new_inode);
+ }
+- old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
++ old_dir->i_ctime = old_dir->i_mtime = ext3_current_time(old_dir);
+ ext3_update_dx_flag(old_dir);
+ if (dir_bh) {
+ BUFFER_TRACE(dir_bh, "get_write_access");
+Index: linux-2.6.18/fs/ext3/super.c
+===================================================================
+--- linux-2.6.18.orig/fs/ext3/super.c
++++ linux-2.6.18/fs/ext3/super.c
+@@ -1615,6 +1615,8 @@ static int ext3_fill_super (struct super
+ sbi->s_inode_size);
+ goto failed_mount;
+ }
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE)
++ sb->s_time_gran = 1 << (EXT3_EPOCH_BITS - 2);
+ }
+ sbi->s_frag_size = EXT3_MIN_FRAG_SIZE <<
+ le32_to_cpu(es->s_log_frag_size);
+@@ -1819,6 +1821,32 @@ static int ext3_fill_super (struct super
+ }
+
+ ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
++
++ /* determine the minimum size of new large inodes, if present */
++ if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ if (EXT3_HAS_RO_COMPAT_FEATURE(sb,
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE)) {
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_want_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_want_extra_isize);
++ if (sbi->s_want_extra_isize <
++ le16_to_cpu(es->s_min_extra_isize))
++ sbi->s_want_extra_isize =
++ le16_to_cpu(es->s_min_extra_isize);
++ }
++ }
++ /* Check if enough inode space is available */
++ if (EXT3_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >
++ sbi->s_inode_size) {
++ sbi->s_want_extra_isize = sizeof(struct ext3_inode) -
++ EXT3_GOOD_OLD_INODE_SIZE;
++ printk(KERN_INFO "EXT3-fs: required extra inode space not"
++ "available.\n");
++ }
++
+ /*
+ * akpm: core read_super() calls in here with the superblock locked.
+ * That deadlocks, because orphan cleanup needs to lock the superblock
+Index: linux-2.6.18/fs/ext3/xattr.c
+===================================================================
+--- linux-2.6.18.orig/fs/ext3/xattr.c
++++ linux-2.6.18/fs/ext3/xattr.c
+@@ -1007,7 +1007,7 @@ ext3_xattr_set_handle(handle_t *handle,
+ }
+ if (!error) {
+ ext3_xattr_update_super_block(handle, inode->i_sb);
+- inode->i_ctime = CURRENT_TIME_SEC;
++ inode->i_ctime = ext3_current_time(inode);
+ error = ext3_mark_iloc_dirty(handle, inode, &is.iloc);
+ /*
+ * The bh is consumed by ext3_mark_iloc_dirty, even with
+Index: linux-2.6.18/include/linux/ext3_fs.h
+===================================================================
+--- linux-2.6.18.orig/include/linux/ext3_fs.h
++++ linux-2.6.18/include/linux/ext3_fs.h
+@@ -268,7 +268,7 @@ struct ext3_inode {
+ __le16 i_uid; /* Low 16 bits of Owner Uid */
+ __le32 i_size; /* Size in bytes */
+ __le32 i_atime; /* Access time */
+- __le32 i_ctime; /* Creation time */
++ __le32 i_ctime; /* Inode Change time */
+ __le32 i_mtime; /* Modification time */
+ __le32 i_dtime; /* Deletion Time */
+ __le16 i_gid; /* Low 16 bits of Group Id */
+@@ -317,10 +317,73 @@ struct ext3_inode {
+ } osd2; /* OS dependent 2 */
+ __le16 i_extra_isize;
+ __le16 i_pad1;
++ __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
++ __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
++ __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
++ __le32 i_crtime; /* File Creation time */
++ __le32 i_crtime_extra; /* extra File Creation time (nsec << 2 | epoch) */
+ };
+
+ #define i_size_high i_dir_acl
+
++#define EXT3_EPOCH_BITS 2
++#define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1)
++#define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS)
++
++#define EXT3_FITS_IN_INODE(ext3_inode, einode, field) \
++ ((offsetof(typeof(*ext3_inode), field) + \
++ sizeof((ext3_inode)->field)) \
++ <= (EXT3_GOOD_OLD_INODE_SIZE + \
++ (einode)->i_extra_isize)) \
++
++static inline __le32 ext3_encode_extra_time(struct timespec *time)
++{
++ return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
++ time->tv_sec >> 32 : 0) |
++ ((time->tv_nsec << 2) & EXT3_NSEC_MASK));
++}
++
++static inline void ext3_decode_extra_time(struct timespec *time, __le32 extra) {
++ if (sizeof(time->tv_sec) > 4)
++ time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT3_EPOCH_MASK)
++ << 32;
++ time->tv_nsec = (le32_to_cpu(extra) & EXT3_NSEC_MASK) >> 2;
++}
++
++#define EXT3_INODE_SET_XTIME(xtime, inode, raw_inode) \
++do { \
++ (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
++ if (EXT3_FITS_IN_INODE(raw_inode, EXT3_I(inode), xtime ## _extra)) \
++ (raw_inode)->xtime ## _extra = \
++ ext3_encode_extra_time(&(inode)->xtime); \
++} while (0)
++
++#define EXT3_EINODE_SET_XTIME(xtime, einode, raw_inode)\
++do { \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime)) \
++ (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
++ (raw_inode)->xtime ## _extra = \
++ ext3_encode_extra_time(&(einode)->xtime); \
++} while (0)
++
++#define EXT3_INODE_GET_XTIME(xtime, inode, raw_inode) \
++do { \
++ (inode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime); \
++ if (EXT3_FITS_IN_INODE(raw_inode, EXT3_I(inode), xtime ## _extra)) \
++ ext3_decode_extra_time(&(inode)->xtime, \
++ raw_inode->xtime ## _extra); \
++} while (0)
++
++#define EXT3_EINODE_GET_XTIME(xtime, einode, raw_inode) \
++do { \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime)) \
++ (einode)->xtime.tv_sec = le32_to_cpu((raw_inode)->xtime); \
++ if (EXT3_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
++ ext3_decode_extra_time(&(einode)->xtime, \
++ raw_inode->xtime ## _extra); \
++} while (0)
++
+ #if defined(__KERNEL__) || defined(__linux__)
+ #define i_reserved1 osd1.linux1.l_i_reserved1
+ #define i_frag osd2.linux2.l_i_frag
+@@ -503,8 +566,10 @@ struct ext3_super_block {
+ __u8 s_reserved_char_pad;
+ __u16 s_reserved_word_pad;
+ __le32 s_default_mount_opts;
+- __le32 s_first_meta_bg; /* First metablock block group */
+- __u32 s_reserved[190]; /* Padding to the end of the block */
++ __le32 s_first_meta_bg; /* First metablock block group */
++ __le16 s_min_extra_isize; /* All inodes have at least # bytes */
++ __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
++ __u32 s_reserved[189]; /* Padding to the end of the block */
+ };
+
+ #ifdef __KERNEL__
+@@ -519,6 +584,13 @@ static inline struct ext3_inode_info *EX
+ return container_of(inode, struct ext3_inode_info, vfs_inode);
+ }
+
++static inline struct timespec ext3_current_time(struct inode *inode)
++{
++ return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
++ current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
++}
++
++
+ static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
+ {
+ return ino == EXT3_ROOT_INO ||
+@@ -590,6 +662,8 @@ static inline int ext3_valid_inum(struct
+ #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
+ #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
+ #define EXT3_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
++#define EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
++
+
+ #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
+ #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
+@@ -606,6 +680,7 @@ static inline int ext3_valid_inum(struct
+ #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
+ EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
+ EXT3_FEATURE_RO_COMPAT_DIR_NLINK| \
++ EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE| \
+ EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
+
+ /*
+Index: linux-2.6.18/include/linux/ext3_fs_sb.h
+===================================================================
+--- linux-2.6.18.orig/include/linux/ext3_fs_sb.h
++++ linux-2.6.18/include/linux/ext3_fs_sb.h
+@@ -119,6 +119,8 @@ struct ext3_sb_info {
+ spinlock_t s_bal_lock;
+ unsigned long s_mb_buddies_generated;
+ unsigned long long s_mb_generation_time;
++
++ unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
+ };
+
+ #define EXT3_GROUP_INFO(sb, group) \
+Index: linux-2.6.18/include/linux/ext3_fs_i.h
+===================================================================
+--- linux-2.6.18.orig/include/linux/ext3_fs_i.h
++++ linux-2.6.18/include/linux/ext3_fs_i.h
+@@ -144,6 +144,7 @@ struct ext3_inode_info {
+ struct inode vfs_inode;
+
+ __u32 i_cached_extent[4];
++ struct timespec i_crtime;
+
+ void *i_filterdata;
+ };
ext3-lookup-dotdot-2.6.9.patch
ext3-sector_t-overflow-2.6.9-rhel4.patch
ext3-check-jbd-errors-2.6.9.patch
+ext3-nanosecond-2.6-rhel4.patch
ext3-remove-cond_resched-calls-2.6.12.patch
ext3-filterdata-2.6.15.patch
ext3-disable-write-barrier-by-default-2.6-sles10.patch
+ext3-nanosecond-2.6-sles10.patch
ext3-lookup-dotdot-2.6.9.patch
ext3-sector_t-overflow-2.6.5-suse.patch
ext3-check-jbd-errors-2.6.5.patch
+ext3-nanosecond-2.6-suse.patch
ext3-ialloc-2.6.patch
ext3-remove-cond_resched-calls-2.6.12.patch
ext3-filterdata-2.6.15.patch
+ext3-nanosecond-2.6.18-vanilla.patch
ext3-lookup-dotdot-2.6.9.patch
ext3-sector_t-overflow-2.6.9-rhel4.patch
ext3-check-jbd-errors-2.6.9.patch
+ext3-nanosecond-2.6.9-rhel4.patch
ext3-remove-cond_resched-calls-2.6.12.patch
ext3-filterdata-2.6.15.patch
ext3-disable-write-barrier-by-default-2.6-sles10.patch
+ext3-nanosecond-2.6-sles10.patch
ext3-lookup-dotdot-2.6.9.patch
ext3-sector_t-overflow-2.6.5-suse.patch
ext3-check-jbd-errors-2.6.5.patch
+ext3-nanosecond-2.6-suse.patch
ext3-ialloc-2.6.patch
ext3-remove-cond_resched-calls-2.6.12.patch
ext3-filterdata-2.6.15.patch
+ext3-nanosecond-2.6.18-vanilla.patch