📄 ext3-nanosecond-2.6-sles10.patch
字号:
+ 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 superblockIndex: linux-2.6.16-sles10/fs/ext3/xattr.c===================================================================--- linux-2.6.16-sles10.orig/fs/ext3/xattr.c+++ linux-2.6.16-sles10/fs/ext3/xattr.c@@ -1006,7 +1006,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 withIndex: linux-2.6.16-sles10/include/linux/ext3_fs.h===================================================================--- linux-2.6.16-sles10.orig/include/linux/ext3_fs.h+++ linux-2.6.16-sles10/include/linux/ext3_fs.h@@ -294,7 +294,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 */@@ -343,10 +343,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@@ -526,11 +589,19 @@ struct ext3_super_block { __le32 s_last_orphan; /* start of list of inodes to delete */ __le32 s_hash_seed[4]; /* HTREE hash seed */ __u8 s_def_hash_version; /* Default hash version to use */- __u8 s_reserved_char_pad;- __u16 s_reserved_word_pad;+ __u8 s_jnl_backup_type; /* Default type of journal backup */+ __le16 s_desc_size; /* Group desc. size: INCOMPAT_64BIT */ __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 */+ __le32 s_mkfs_time; /* When the filesystem was created */+ __le32 s_jnl_blocks[17]; /* Backup of the journal inode */+ __le32 s_blocks_count_hi; /* Blocks count high 32 bits */+ __le32 s_r_blocks_count_hi; /* Reserved blocks count high 32 bits*/+ __le32 s_free_blocks_hi; /* Free blocks count high 32 bits */+ __le16 s_min_extra_isize; /* All inodes have at least # bytes */+ __le16 s_want_extra_isize; /* New inodes should reserve # bytes */+ __le32 s_flags; /* Miscellaneous flags */+ __u32 s_reserved[167]; /* Padding to the end of the block */ }; #ifdef __KERNEL__@@ -615,6 +686,8 @@ static inline int ext3_valid_inum(struct #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020+#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040+ #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001 #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002@@ -632,6 +705,7 @@ static inline int ext3_valid_inum(struct EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \ EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \ EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \+ EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE| \ EXT3_FEATURE_RO_COMPAT_BTREE_DIR) /*@@ -759,6 +833,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 doIndex: linux-2.6.16-sles10/include/linux/ext3_fs_i.h===================================================================--- linux-2.6.16-sles10.orig/include/linux/ext3_fs_i.h+++ linux-2.6.16-sles10/include/linux/ext3_fs_i.h@@ -120,6 +120,7 @@ struct ext3_inode_info { /* on-disk additional length */ __u16 i_extra_isize;+ struct timespec i_crtime; /* * truncate_sem is for serialising ext3_truncate() againstIndex: linux-2.6.16-sles10/include/linux/ext3_fs_sb.h===================================================================--- linux-2.6.16-sles10.orig/include/linux/ext3_fs_sb.h+++ linux-2.6.16-sles10/include/linux/ext3_fs_sb.h@@ -68,6 +68,8 @@ struct ext3_sb_info { /* Last group used to allocate inode */ int s_last_alloc_group; + unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */+ /* root of the per fs reservation window tree */ spinlock_t s_rsv_window_lock; struct rb_root s_rsv_window_root;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -