All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] f2fs: Replace expression with offsetof()
@ 2020-12-22 13:34 ` Zheng Yongjun
  0 siblings, 0 replies; 4+ messages in thread
From: Zheng Yongjun @ 2020-12-22 13:34 UTC (permalink / raw)
  To: jaegeuk, chao, linux-f2fs-devel, linux-kernel; +Cc: Zheng Yongjun

Use the existing offsetof() macro instead of duplicating code.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 fs/f2fs/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index d5d8ce077f29..000cafb522ec 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2686,7 +2686,7 @@ int f2fs_recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
 	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);
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [f2fs-dev] [PATCH -next] f2fs: Replace expression with offsetof()
@ 2020-12-22 13:34 ` Zheng Yongjun
  0 siblings, 0 replies; 4+ messages in thread
From: Zheng Yongjun @ 2020-12-22 13:34 UTC (permalink / raw)
  To: jaegeuk, chao, linux-f2fs-devel, linux-kernel; +Cc: Zheng Yongjun

Use the existing offsetof() macro instead of duplicating code.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 fs/f2fs/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index d5d8ce077f29..000cafb522ec 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2686,7 +2686,7 @@ int f2fs_recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
 	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);
-- 
2.22.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH -next] f2fs: Replace expression with offsetof()
  2020-12-22 13:34 ` [f2fs-dev] " Zheng Yongjun
@ 2020-12-24  2:52   ` Chao Yu
  -1 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2020-12-24  2:52 UTC (permalink / raw)
  To: Zheng Yongjun, jaegeuk, chao, linux-f2fs-devel, linux-kernel

On 2020/12/22 21:34, Zheng Yongjun wrote:
> Use the existing offsetof() macro instead of duplicating code.
> 
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH -next] f2fs: Replace expression with offsetof()
@ 2020-12-24  2:52   ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2020-12-24  2:52 UTC (permalink / raw)
  To: Zheng Yongjun, jaegeuk, chao, linux-f2fs-devel, linux-kernel

On 2020/12/22 21:34, Zheng Yongjun wrote:
> Use the existing offsetof() macro instead of duplicating code.
> 
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-24  2:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22 13:34 [PATCH -next] f2fs: Replace expression with offsetof() Zheng Yongjun
2020-12-22 13:34 ` [f2fs-dev] " Zheng Yongjun
2020-12-24  2:52 ` Chao Yu
2020-12-24  2:52   ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.