Skip to content

Commit 11768cf

Browse files
ebiggerstytso
authored andcommitted
ext4: use ext4_fc_tl_mem in fast-commit replay path
To avoid 'sparse' warnings about missing endianness conversions, don't store native endianness values into struct ext4_fc_tl. Instead, use a separate struct type, ext4_fc_tl_mem. Fixes: dcc5827 ("ext4: factor out ext4_fc_get_tl()") Cc: Ye Bin <[email protected]> Signed-off-by: Eric Biggers <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 3478c83 commit 11768cf

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

fs/ext4/fast_commit.c

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,8 +1332,14 @@ struct dentry_info_args {
13321332
char *dname;
13331333
};
13341334

1335+
/* Same as struct ext4_fc_tl, but uses native endianness fields */
1336+
struct ext4_fc_tl_mem {
1337+
u16 fc_tag;
1338+
u16 fc_len;
1339+
};
1340+
13351341
static inline void tl_to_darg(struct dentry_info_args *darg,
1336-
struct ext4_fc_tl *tl, u8 *val)
1342+
struct ext4_fc_tl_mem *tl, u8 *val)
13371343
{
13381344
struct ext4_fc_dentry_info fcd;
13391345

@@ -1345,16 +1351,18 @@ static inline void tl_to_darg(struct dentry_info_args *darg,
13451351
darg->dname_len = tl->fc_len - sizeof(struct ext4_fc_dentry_info);
13461352
}
13471353

1348-
static inline void ext4_fc_get_tl(struct ext4_fc_tl *tl, u8 *val)
1354+
static inline void ext4_fc_get_tl(struct ext4_fc_tl_mem *tl, u8 *val)
13491355
{
1350-
memcpy(tl, val, EXT4_FC_TAG_BASE_LEN);
1351-
tl->fc_len = le16_to_cpu(tl->fc_len);
1352-
tl->fc_tag = le16_to_cpu(tl->fc_tag);
1356+
struct ext4_fc_tl tl_disk;
1357+
1358+
memcpy(&tl_disk, val, EXT4_FC_TAG_BASE_LEN);
1359+
tl->fc_len = le16_to_cpu(tl_disk.fc_len);
1360+
tl->fc_tag = le16_to_cpu(tl_disk.fc_tag);
13531361
}
13541362

13551363
/* Unlink replay function */
1356-
static int ext4_fc_replay_unlink(struct super_block *sb, struct ext4_fc_tl *tl,
1357-
u8 *val)
1364+
static int ext4_fc_replay_unlink(struct super_block *sb,
1365+
struct ext4_fc_tl_mem *tl, u8 *val)
13581366
{
13591367
struct inode *inode, *old_parent;
13601368
struct qstr entry;
@@ -1451,8 +1459,8 @@ static int ext4_fc_replay_link_internal(struct super_block *sb,
14511459
}
14521460

14531461
/* Link replay function */
1454-
static int ext4_fc_replay_link(struct super_block *sb, struct ext4_fc_tl *tl,
1455-
u8 *val)
1462+
static int ext4_fc_replay_link(struct super_block *sb,
1463+
struct ext4_fc_tl_mem *tl, u8 *val)
14561464
{
14571465
struct inode *inode;
14581466
struct dentry_info_args darg;
@@ -1506,8 +1514,8 @@ static int ext4_fc_record_modified_inode(struct super_block *sb, int ino)
15061514
/*
15071515
* Inode replay function
15081516
*/
1509-
static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl,
1510-
u8 *val)
1517+
static int ext4_fc_replay_inode(struct super_block *sb,
1518+
struct ext4_fc_tl_mem *tl, u8 *val)
15111519
{
15121520
struct ext4_fc_inode fc_inode;
15131521
struct ext4_inode *raw_inode;
@@ -1609,8 +1617,8 @@ static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl,
16091617
* inode for which we are trying to create a dentry here, should already have
16101618
* been replayed before we start here.
16111619
*/
1612-
static int ext4_fc_replay_create(struct super_block *sb, struct ext4_fc_tl *tl,
1613-
u8 *val)
1620+
static int ext4_fc_replay_create(struct super_block *sb,
1621+
struct ext4_fc_tl_mem *tl, u8 *val)
16141622
{
16151623
int ret = 0;
16161624
struct inode *inode = NULL;
@@ -1708,7 +1716,7 @@ int ext4_fc_record_regions(struct super_block *sb, int ino,
17081716

17091717
/* Replay add range tag */
17101718
static int ext4_fc_replay_add_range(struct super_block *sb,
1711-
struct ext4_fc_tl *tl, u8 *val)
1719+
struct ext4_fc_tl_mem *tl, u8 *val)
17121720
{
17131721
struct ext4_fc_add_range fc_add_ex;
17141722
struct ext4_extent newex, *ex;
@@ -1828,8 +1836,8 @@ static int ext4_fc_replay_add_range(struct super_block *sb,
18281836

18291837
/* Replay DEL_RANGE tag */
18301838
static int
1831-
ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl,
1832-
u8 *val)
1839+
ext4_fc_replay_del_range(struct super_block *sb,
1840+
struct ext4_fc_tl_mem *tl, u8 *val)
18331841
{
18341842
struct inode *inode;
18351843
struct ext4_fc_del_range lrange;
@@ -2025,7 +2033,7 @@ static int ext4_fc_replay_scan(journal_t *journal,
20252033
struct ext4_fc_replay_state *state;
20262034
int ret = JBD2_FC_REPLAY_CONTINUE;
20272035
struct ext4_fc_add_range ext;
2028-
struct ext4_fc_tl tl;
2036+
struct ext4_fc_tl_mem tl;
20292037
struct ext4_fc_tail tail;
20302038
__u8 *start, *end, *cur, *val;
20312039
struct ext4_fc_head head;
@@ -2144,7 +2152,7 @@ static int ext4_fc_replay(journal_t *journal, struct buffer_head *bh,
21442152
{
21452153
struct super_block *sb = journal->j_private;
21462154
struct ext4_sb_info *sbi = EXT4_SB(sb);
2147-
struct ext4_fc_tl tl;
2155+
struct ext4_fc_tl_mem tl;
21482156
__u8 *start, *end, *cur, *val;
21492157
int ret = JBD2_FC_REPLAY_CONTINUE;
21502158
struct ext4_fc_replay_state *state = &sbi->s_fc_replay_state;

0 commit comments

Comments
 (0)