f2fs: fix sparse warnings
f2fs contained a number of endianness conversion bugs. Also, one function should have been 'static'. Found with sparse by running 'make C=2 CF=-D__CHECK_ENDIAN__ fs/f2fs/' Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
9de6927975
commit
0c0b471e43
|
@ -136,7 +136,7 @@ struct f2fs_dir_entry *find_target_dentry(struct fscrypt_name *fname,
|
||||||
|
|
||||||
/* show encrypted name */
|
/* show encrypted name */
|
||||||
if (fname->hash) {
|
if (fname->hash) {
|
||||||
if (de->hash_code == fname->hash)
|
if (de->hash_code == cpu_to_le32(fname->hash))
|
||||||
goto found;
|
goto found;
|
||||||
} else if (de_name.len == name->len &&
|
} else if (de_name.len == name->len &&
|
||||||
de->hash_code == namehash &&
|
de->hash_code == namehash &&
|
||||||
|
|
|
@ -421,7 +421,7 @@ static int f2fs_add_inline_entries(struct inode *dir,
|
||||||
}
|
}
|
||||||
|
|
||||||
new_name.name = d.filename[bit_pos];
|
new_name.name = d.filename[bit_pos];
|
||||||
new_name.len = de->name_len;
|
new_name.len = le16_to_cpu(de->name_len);
|
||||||
|
|
||||||
ino = le32_to_cpu(de->ino);
|
ino = le32_to_cpu(de->ino);
|
||||||
fake_mode = get_de_type(de) << S_SHIFT;
|
fake_mode = get_de_type(de) << S_SHIFT;
|
||||||
|
|
|
@ -270,8 +270,9 @@ static void cache_nat_entry(struct f2fs_sb_info *sbi, nid_t nid,
|
||||||
e = grab_nat_entry(nm_i, nid);
|
e = grab_nat_entry(nm_i, nid);
|
||||||
node_info_from_raw_nat(&e->ni, ne);
|
node_info_from_raw_nat(&e->ni, ne);
|
||||||
} else {
|
} else {
|
||||||
f2fs_bug_on(sbi, nat_get_ino(e) != ne->ino ||
|
f2fs_bug_on(sbi, nat_get_ino(e) != le32_to_cpu(ne->ino) ||
|
||||||
nat_get_blkaddr(e) != ne->block_addr ||
|
nat_get_blkaddr(e) !=
|
||||||
|
le32_to_cpu(ne->block_addr) ||
|
||||||
nat_get_version(e) != ne->version);
|
nat_get_version(e) != ne->version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,7 +313,7 @@ static inline bool is_recoverable_dnode(struct page *page)
|
||||||
((unsigned char *)ckpt + crc_offset)));
|
((unsigned char *)ckpt + crc_offset)));
|
||||||
cp_ver |= (crc << 32);
|
cp_ver |= (crc << 32);
|
||||||
}
|
}
|
||||||
return cpu_to_le64(cp_ver) == cpver_of_node(page);
|
return cp_ver == cpver_of_node(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -635,7 +635,7 @@ static void f2fs_submit_bio_wait_endio(struct bio *bio)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this function is copied from blkdev_issue_discard from block/blk-lib.c */
|
/* this function is copied from blkdev_issue_discard from block/blk-lib.c */
|
||||||
int __f2fs_issue_discard_async(struct f2fs_sb_info *sbi, sector_t sector,
|
static int __f2fs_issue_discard_async(struct f2fs_sb_info *sbi, sector_t sector,
|
||||||
sector_t nr_sects, gfp_t gfp_mask, unsigned long flags)
|
sector_t nr_sects, gfp_t gfp_mask, unsigned long flags)
|
||||||
{
|
{
|
||||||
struct block_device *bdev = sbi->sb->s_bdev;
|
struct block_device *bdev = sbi->sb->s_bdev;
|
||||||
|
|
Loading…
Reference in New Issue