btrfs-progs: free-space-cache: fix endianity when reading from disk_key

Sparse reports:

free-space-cache.c:921:13: warning: incorrect type in assignment (different base types)
free-space-cache.c:921:13:    expected unsigned long long [unsigned] [usertype] ino
free-space-cache.c:921:13:    got restricted __le64 [addressable] [usertype] objectid

we need to use the helper to read objectid, as read_eb_member just
copies the data without disk->cpu transformation. This could lead to
bogus results on bigendian machines.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2017-09-23 21:00:41 +02:00
parent 510a282f7f
commit b4b069dcb2
1 changed files with 1 additions and 1 deletions

View File

@ -918,7 +918,7 @@ int btrfs_clear_free_space_cache(struct btrfs_fs_info *fs_info,
slot = path.slots[0];
sc_header = btrfs_item_ptr(node, slot, struct btrfs_free_space_header);
btrfs_free_space_key(node, sc_header, &location);
ino = location.objectid;
ino = btrfs_disk_key_objectid(&location);
/* Delete the free space header, as we have the ino to continue */
ret = btrfs_del_item(trans, tree_root, &path);