]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
f2fs: align data types between on-disk and in-memory block addresses
authorJaegeuk Kim <jaegeuk.kim@samsung.com>
Fri, 24 May 2013 03:41:04 +0000 (12:41 +0900)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Tue, 28 May 2013 06:03:04 +0000 (15:03 +0900)
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>
fs/f2fs/f2fs.h
include/linux/f2fs_fs.h

index 7b050298d6c907c57748d1ebcfe053347ef45103..92fd4e9285c03ef27539e8598900c968a22d857e 100644 (file)
                typecheck(unsigned long long, b) &&                     \
                ((long long)((a) - (b)) > 0))
 
-typedef u64 block_t;
+typedef u32 block_t;   /*
+                        * should not change u32, since it is the on-disk block
+                        * address format, __le32.
+                        */
 typedef u32 nid_t;
 
 struct f2fs_mount_info {
index df6fab82f87e7650bafaa247523713fc3cc4be2f..383d5e39b280a1eeb2dc2d60d37446112624a493 100644 (file)
@@ -20,8 +20,8 @@
 #define F2FS_BLKSIZE                   4096    /* support only 4KB block */
 #define F2FS_MAX_EXTENSION             64      /* # of extension entries */
 
-#define NULL_ADDR              0x0U
-#define NEW_ADDR               -1U
+#define NULL_ADDR              ((block_t)0)    /* used as block_t addresses */
+#define NEW_ADDR               ((block_t)-1)   /* used as block_t addresses */
 
 #define F2FS_ROOT_INO(sbi)     (sbi->root_ino_num)
 #define F2FS_NODE_INO(sbi)     (sbi->node_ino_num)