aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext4/namei.c7
-rw-r--r--fs/ext4/super.c6
-rw-r--r--fs/ext4/xattr.c13
-rw-r--r--include/trace/events/ext4.h6
4 files changed, 17 insertions, 15 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 3825d6aa8336..45a5ca89797f 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -416,15 +416,16 @@ static __le32 ext4_dx_csum(struct inode *inode, struct ext4_dir_entry *dirent,
416{ 416{
417 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); 417 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
418 struct ext4_inode_info *ei = EXT4_I(inode); 418 struct ext4_inode_info *ei = EXT4_I(inode);
419 __u32 csum, old_csum; 419 __u32 csum;
420 __le32 save_csum;
420 int size; 421 int size;
421 422
422 size = count_offset + (count * sizeof(struct dx_entry)); 423 size = count_offset + (count * sizeof(struct dx_entry));
423 old_csum = t->dt_checksum; 424 save_csum = t->dt_checksum;
424 t->dt_checksum = 0; 425 t->dt_checksum = 0;
425 csum = ext4_chksum(sbi, ei->i_csum_seed, (__u8 *)dirent, size); 426 csum = ext4_chksum(sbi, ei->i_csum_seed, (__u8 *)dirent, size);
426 csum = ext4_chksum(sbi, csum, (__u8 *)t, sizeof(struct dx_tail)); 427 csum = ext4_chksum(sbi, csum, (__u8 *)t, sizeof(struct dx_tail));
427 t->dt_checksum = old_csum; 428 t->dt_checksum = save_csum;
428 429
429 return cpu_to_le32(csum); 430 return cpu_to_le32(csum);
430} 431}
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6fea87db7daa..f355c28fa080 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1952,16 +1952,16 @@ static __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 block_group,
1952 if ((sbi->s_es->s_feature_ro_compat & 1952 if ((sbi->s_es->s_feature_ro_compat &
1953 cpu_to_le32(EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))) { 1953 cpu_to_le32(EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))) {
1954 /* Use new metadata_csum algorithm */ 1954 /* Use new metadata_csum algorithm */
1955 __u16 old_csum; 1955 __le16 save_csum;
1956 __u32 csum32; 1956 __u32 csum32;
1957 1957
1958 old_csum = gdp->bg_checksum; 1958 save_csum = gdp->bg_checksum;
1959 gdp->bg_checksum = 0; 1959 gdp->bg_checksum = 0;
1960 csum32 = ext4_chksum(sbi, sbi->s_csum_seed, (__u8 *)&le_group, 1960 csum32 = ext4_chksum(sbi, sbi->s_csum_seed, (__u8 *)&le_group,
1961 sizeof(le_group)); 1961 sizeof(le_group));
1962 csum32 = ext4_chksum(sbi, csum32, (__u8 *)gdp, 1962 csum32 = ext4_chksum(sbi, csum32, (__u8 *)gdp,
1963 sbi->s_desc_size); 1963 sbi->s_desc_size);
1964 gdp->bg_checksum = old_csum; 1964 gdp->bg_checksum = save_csum;
1965 1965
1966 crc = csum32 & 0xFFFF; 1966 crc = csum32 & 0xFFFF;
1967 goto out; 1967 goto out;
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 3a120b277240..c081e34f717f 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -122,17 +122,18 @@ static __le32 ext4_xattr_block_csum(struct inode *inode,
122 struct ext4_xattr_header *hdr) 122 struct ext4_xattr_header *hdr)
123{ 123{
124 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); 124 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
125 __u32 csum, old; 125 __u32 csum;
126 __le32 save_csum;
127 __le64 dsk_block_nr = cpu_to_le64(block_nr);
126 128
127 old = hdr->h_checksum; 129 save_csum = hdr->h_checksum;
128 hdr->h_checksum = 0; 130 hdr->h_checksum = 0;
129 block_nr = cpu_to_le64(block_nr); 131 csum = ext4_chksum(sbi, sbi->s_csum_seed, (__u8 *)&dsk_block_nr,
130 csum = ext4_chksum(sbi, sbi->s_csum_seed, (__u8 *)&block_nr, 132 sizeof(dsk_block_nr));
131 sizeof(block_nr));
132 csum = ext4_chksum(sbi, csum, (__u8 *)hdr, 133 csum = ext4_chksum(sbi, csum, (__u8 *)hdr,
133 EXT4_BLOCK_SIZE(inode->i_sb)); 134 EXT4_BLOCK_SIZE(inode->i_sb));
134 135
135 hdr->h_checksum = old; 136 hdr->h_checksum = save_csum;
136 return cpu_to_le32(csum); 137 return cpu_to_le32(csum);
137} 138}
138 139
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 58459b785565..d0e686402df8 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -1948,7 +1948,7 @@ TRACE_EVENT(ext4_remove_blocks,
1948 __entry->to = to; 1948 __entry->to = to;
1949 __entry->partial = partial_cluster; 1949 __entry->partial = partial_cluster;
1950 __entry->ee_pblk = ext4_ext_pblock(ex); 1950 __entry->ee_pblk = ext4_ext_pblock(ex);
1951 __entry->ee_lblk = cpu_to_le32(ex->ee_block); 1951 __entry->ee_lblk = le32_to_cpu(ex->ee_block);
1952 __entry->ee_len = ext4_ext_get_actual_len(ex); 1952 __entry->ee_len = ext4_ext_get_actual_len(ex);
1953 ), 1953 ),
1954 1954
@@ -2052,7 +2052,7 @@ TRACE_EVENT(ext4_ext_remove_space,
2052 2052
2053TRACE_EVENT(ext4_ext_remove_space_done, 2053TRACE_EVENT(ext4_ext_remove_space_done,
2054 TP_PROTO(struct inode *inode, ext4_lblk_t start, int depth, 2054 TP_PROTO(struct inode *inode, ext4_lblk_t start, int depth,
2055 ext4_lblk_t partial, unsigned short eh_entries), 2055 ext4_lblk_t partial, __le16 eh_entries),
2056 2056
2057 TP_ARGS(inode, start, depth, partial, eh_entries), 2057 TP_ARGS(inode, start, depth, partial, eh_entries),
2058 2058
@@ -2071,7 +2071,7 @@ TRACE_EVENT(ext4_ext_remove_space_done,
2071 __entry->start = start; 2071 __entry->start = start;
2072 __entry->depth = depth; 2072 __entry->depth = depth;
2073 __entry->partial = partial; 2073 __entry->partial = partial;
2074 __entry->eh_entries = eh_entries; 2074 __entry->eh_entries = le16_to_cpu(eh_entries);
2075 ), 2075 ),
2076 2076
2077 TP_printk("dev %d,%d ino %lu since %u depth %d partial %u " 2077 TP_printk("dev %d,%d ino %lu since %u depth %d partial %u "