@@ -1338,7 +1338,7 @@ struct dentry_info_args {
1338
1338
};
1339
1339
1340
1340
static inline void tl_to_darg (struct dentry_info_args * darg ,
1341
- struct ext4_fc_tl * tl , u8 * val )
1341
+ struct ext4_fc_tl * tl , u8 * val )
1342
1342
{
1343
1343
struct ext4_fc_dentry_info fcd ;
1344
1344
@@ -1347,8 +1347,14 @@ static inline void tl_to_darg(struct dentry_info_args *darg,
1347
1347
darg -> parent_ino = le32_to_cpu (fcd .fc_parent_ino );
1348
1348
darg -> ino = le32_to_cpu (fcd .fc_ino );
1349
1349
darg -> dname = val + offsetof(struct ext4_fc_dentry_info , fc_dname );
1350
- darg -> dname_len = le16_to_cpu (tl -> fc_len ) -
1351
- sizeof (struct ext4_fc_dentry_info );
1350
+ darg -> dname_len = tl -> fc_len - sizeof (struct ext4_fc_dentry_info );
1351
+ }
1352
+
1353
+ static inline void ext4_fc_get_tl (struct ext4_fc_tl * tl , u8 * val )
1354
+ {
1355
+ memcpy (tl , val , EXT4_FC_TAG_BASE_LEN );
1356
+ tl -> fc_len = le16_to_cpu (tl -> fc_len );
1357
+ tl -> fc_tag = le16_to_cpu (tl -> fc_tag );
1352
1358
}
1353
1359
1354
1360
/* Unlink replay function */
@@ -1513,7 +1519,7 @@ static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl,
1513
1519
struct ext4_inode * raw_fc_inode ;
1514
1520
struct inode * inode = NULL ;
1515
1521
struct ext4_iloc iloc ;
1516
- int inode_len , ino , ret , tag = le16_to_cpu ( tl -> fc_tag ) ;
1522
+ int inode_len , ino , ret , tag = tl -> fc_tag ;
1517
1523
struct ext4_extent_header * eh ;
1518
1524
1519
1525
memcpy (& fc_inode , val , sizeof (fc_inode ));
@@ -1538,7 +1544,7 @@ static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl,
1538
1544
if (ret )
1539
1545
goto out ;
1540
1546
1541
- inode_len = le16_to_cpu ( tl -> fc_len ) - sizeof (struct ext4_fc_inode );
1547
+ inode_len = tl -> fc_len - sizeof (struct ext4_fc_inode );
1542
1548
raw_inode = ext4_raw_inode (& iloc );
1543
1549
1544
1550
memcpy (raw_inode , raw_fc_inode , offsetof(struct ext4_inode , i_block ));
@@ -2027,12 +2033,12 @@ static int ext4_fc_replay_scan(journal_t *journal,
2027
2033
2028
2034
state -> fc_replay_expected_off ++ ;
2029
2035
for (cur = start ; cur < end ;
2030
- cur = cur + EXT4_FC_TAG_BASE_LEN + le16_to_cpu ( tl .fc_len ) ) {
2031
- memcpy (& tl , cur , EXT4_FC_TAG_BASE_LEN );
2036
+ cur = cur + EXT4_FC_TAG_BASE_LEN + tl .fc_len ) {
2037
+ ext4_fc_get_tl (& tl , cur );
2032
2038
val = cur + EXT4_FC_TAG_BASE_LEN ;
2033
2039
ext4_debug ("Scan phase, tag:%s, blk %lld\n" ,
2034
- tag2str (le16_to_cpu ( tl .fc_tag ) ), bh -> b_blocknr );
2035
- switch (le16_to_cpu ( tl .fc_tag ) ) {
2040
+ tag2str (tl .fc_tag ), bh -> b_blocknr );
2041
+ switch (tl .fc_tag ) {
2036
2042
case EXT4_FC_TAG_ADD_RANGE :
2037
2043
memcpy (& ext , val , sizeof (ext ));
2038
2044
ex = (struct ext4_extent * )& ext .fc_ex ;
@@ -2052,7 +2058,7 @@ static int ext4_fc_replay_scan(journal_t *journal,
2052
2058
case EXT4_FC_TAG_PAD :
2053
2059
state -> fc_cur_tag ++ ;
2054
2060
state -> fc_crc = ext4_chksum (sbi , state -> fc_crc , cur ,
2055
- EXT4_FC_TAG_BASE_LEN + le16_to_cpu ( tl .fc_len ) );
2061
+ EXT4_FC_TAG_BASE_LEN + tl .fc_len );
2056
2062
break ;
2057
2063
case EXT4_FC_TAG_TAIL :
2058
2064
state -> fc_cur_tag ++ ;
@@ -2085,7 +2091,7 @@ static int ext4_fc_replay_scan(journal_t *journal,
2085
2091
}
2086
2092
state -> fc_cur_tag ++ ;
2087
2093
state -> fc_crc = ext4_chksum (sbi , state -> fc_crc , cur ,
2088
- EXT4_FC_TAG_BASE_LEN + le16_to_cpu ( tl .fc_len ) );
2094
+ EXT4_FC_TAG_BASE_LEN + tl .fc_len );
2089
2095
break ;
2090
2096
default :
2091
2097
ret = state -> fc_replay_num_tags ?
@@ -2141,19 +2147,18 @@ static int ext4_fc_replay(journal_t *journal, struct buffer_head *bh,
2141
2147
end = (__u8 * )bh -> b_data + journal -> j_blocksize - 1 ;
2142
2148
2143
2149
for (cur = start ; cur < end ;
2144
- cur = cur + EXT4_FC_TAG_BASE_LEN + le16_to_cpu ( tl .fc_len ) ) {
2145
- memcpy (& tl , cur , EXT4_FC_TAG_BASE_LEN );
2150
+ cur = cur + EXT4_FC_TAG_BASE_LEN + tl .fc_len ) {
2151
+ ext4_fc_get_tl (& tl , cur );
2146
2152
val = cur + EXT4_FC_TAG_BASE_LEN ;
2147
2153
2148
2154
if (state -> fc_replay_num_tags == 0 ) {
2149
2155
ret = JBD2_FC_REPLAY_STOP ;
2150
2156
ext4_fc_set_bitmaps_and_counters (sb );
2151
2157
break ;
2152
2158
}
2153
- ext4_debug ("Replay phase, tag:%s\n" ,
2154
- tag2str (le16_to_cpu (tl .fc_tag )));
2159
+ ext4_debug ("Replay phase, tag:%s\n" , tag2str (tl .fc_tag ));
2155
2160
state -> fc_replay_num_tags -- ;
2156
- switch (le16_to_cpu ( tl .fc_tag ) ) {
2161
+ switch (tl .fc_tag ) {
2157
2162
case EXT4_FC_TAG_LINK :
2158
2163
ret = ext4_fc_replay_link (sb , & tl , val );
2159
2164
break ;
@@ -2174,19 +2179,18 @@ static int ext4_fc_replay(journal_t *journal, struct buffer_head *bh,
2174
2179
break ;
2175
2180
case EXT4_FC_TAG_PAD :
2176
2181
trace_ext4_fc_replay (sb , EXT4_FC_TAG_PAD , 0 ,
2177
- le16_to_cpu ( tl .fc_len ) , 0 );
2182
+ tl .fc_len , 0 );
2178
2183
break ;
2179
2184
case EXT4_FC_TAG_TAIL :
2180
- trace_ext4_fc_replay (sb , EXT4_FC_TAG_TAIL , 0 ,
2181
- le16_to_cpu ( tl .fc_len ) , 0 );
2185
+ trace_ext4_fc_replay (sb , EXT4_FC_TAG_TAIL ,
2186
+ 0 , tl .fc_len , 0 );
2182
2187
memcpy (& tail , val , sizeof (tail ));
2183
2188
WARN_ON (le32_to_cpu (tail .fc_tid ) != expected_tid );
2184
2189
break ;
2185
2190
case EXT4_FC_TAG_HEAD :
2186
2191
break ;
2187
2192
default :
2188
- trace_ext4_fc_replay (sb , le16_to_cpu (tl .fc_tag ), 0 ,
2189
- le16_to_cpu (tl .fc_len ), 0 );
2193
+ trace_ext4_fc_replay (sb , tl .fc_tag , 0 , tl .fc_len , 0 );
2190
2194
ret = - ECANCELED ;
2191
2195
break ;
2192
2196
}
0 commit comments