Commit a9841c4dbbdd8a2fb919ea305ffa95ab5ec80af2
1 parent
f28c06fa6f
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
f2fs: align data types between on-disk and in-memory block addresses
The on-disk block address is defined as __le32, but in-memory block address, block_t, does as u64. Let's synchronize them to 32 bits. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Showing 2 changed files with 6 additions and 3 deletions Side-by-side Diff
fs/f2fs/f2fs.h
... | ... | @@ -37,7 +37,10 @@ |
37 | 37 | typecheck(unsigned long long, b) && \ |
38 | 38 | ((long long)((a) - (b)) > 0)) |
39 | 39 | |
40 | -typedef u64 block_t; | |
40 | +typedef u32 block_t; /* | |
41 | + * should not change u32, since it is the on-disk block | |
42 | + * address format, __le32. | |
43 | + */ | |
41 | 44 | typedef u32 nid_t; |
42 | 45 | |
43 | 46 | struct f2fs_mount_info { |
include/linux/f2fs_fs.h
... | ... | @@ -20,8 +20,8 @@ |
20 | 20 | #define F2FS_BLKSIZE 4096 /* support only 4KB block */ |
21 | 21 | #define F2FS_MAX_EXTENSION 64 /* # of extension entries */ |
22 | 22 | |
23 | -#define NULL_ADDR 0x0U | |
24 | -#define NEW_ADDR -1U | |
23 | +#define NULL_ADDR ((block_t)0) /* used as block_t addresses */ | |
24 | +#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */ | |
25 | 25 | |
26 | 26 | #define F2FS_ROOT_INO(sbi) (sbi->root_ino_num) |
27 | 27 | #define F2FS_NODE_INO(sbi) (sbi->node_ino_num) |