f2fs: Replace expression with offsetof()
authorZheng Yongjun <zhengyongjun3@huawei.com>
Tue, 22 Dec 2020 13:34:15 +0000 (21:34 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 27 Jan 2021 23:20:00 +0000 (15:20 -0800)
Use the existing offsetof() macro instead of duplicating code.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/node.c

index 3a24423..5e3faba 100644 (file)
@@ -2696,7 +2696,7 @@ retry:
        src = F2FS_INODE(page);
        dst = F2FS_INODE(ipage);
 
-       memcpy(dst, src, (unsigned long)&src->i_ext - (unsigned long)src);
+       memcpy(dst, src, offsetof(struct f2fs_inode, i_ext));
        dst->i_size = 0;
        dst->i_blocks = cpu_to_le64(1);
        dst->i_links = cpu_to_le32(1);