All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] f2fs: introduce macro __cp_payload
@ 2015-02-25 23:57 ` Wanpeng Li
  0 siblings, 0 replies; 6+ messages in thread
From: Wanpeng Li @ 2015-02-25 23:57 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: Changman Lee, linux-f2fs-devel, linux-kernel, Wanpeng Li

This patch introduce macro __cp_payload.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
 fs/f2fs/checkpoint.c | 7 +++----
 fs/f2fs/f2fs.h       | 7 ++++++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 7f794b7..4dbcc81 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -471,8 +471,7 @@ void recover_orphan_inodes(struct f2fs_sb_info *sbi)
 
 	set_sbi_flag(sbi, SBI_POR_DOING);
 
-	start_blk = __start_cp_addr(sbi) + 1 +
-		le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
+	start_blk = __start_cp_addr(sbi) + 1 + __cp_payload(sbi);
 	orphan_blkaddr = __start_sum_addr(sbi) - 1;
 
 	ra_meta_pages(sbi, start_blk, orphan_blkaddr, META_CP);
@@ -615,7 +614,7 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
 	unsigned long blk_size = sbi->blocksize;
 	unsigned long long cp1_version = 0, cp2_version = 0;
 	unsigned long long cp_start_blk_no;
-	unsigned int cp_blks = 1 + le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
+	unsigned int cp_blks = 1 + __cp_payload(sbi);
 	block_t cp_blk_no;
 	int i;
 
@@ -884,7 +883,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 	__u32 crc32 = 0;
 	void *kaddr;
 	int i;
-	int cp_payload_blks = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
+	int cp_payload_blks = __cp_payload(sbi);
 
 	/*
 	 * This avoids to conduct wrong roll-forward operations and uses
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 7fa3313..f8bde23 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -920,12 +920,17 @@ static inline unsigned long __bitmap_size(struct f2fs_sb_info *sbi, int flag)
 	return 0;
 }
 
+static inline block_t __cp_payload(struct f2fs_sb_info *sbi)
+{
+	return le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
+}
+
 static inline void *__bitmap_ptr(struct f2fs_sb_info *sbi, int flag)
 {
 	struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
 	int offset;
 
-	if (le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload) > 0) {
+	if (__cp_payload(sbi) > 0) {
 		if (flag == NAT_BITMAP)
 			return &ckpt->sit_nat_version_bitmap;
 		else
-- 
1.9.1


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

* [PATCH 1/2] f2fs: introduce macro __cp_payload
@ 2015-02-25 23:57 ` Wanpeng Li
  0 siblings, 0 replies; 6+ messages in thread
From: Wanpeng Li @ 2015-02-25 23:57 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: Wanpeng Li, linux-kernel, linux-f2fs-devel

This patch introduce macro __cp_payload.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
 fs/f2fs/checkpoint.c | 7 +++----
 fs/f2fs/f2fs.h       | 7 ++++++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 7f794b7..4dbcc81 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -471,8 +471,7 @@ void recover_orphan_inodes(struct f2fs_sb_info *sbi)
 
 	set_sbi_flag(sbi, SBI_POR_DOING);
 
-	start_blk = __start_cp_addr(sbi) + 1 +
-		le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
+	start_blk = __start_cp_addr(sbi) + 1 + __cp_payload(sbi);
 	orphan_blkaddr = __start_sum_addr(sbi) - 1;
 
 	ra_meta_pages(sbi, start_blk, orphan_blkaddr, META_CP);
@@ -615,7 +614,7 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
 	unsigned long blk_size = sbi->blocksize;
 	unsigned long long cp1_version = 0, cp2_version = 0;
 	unsigned long long cp_start_blk_no;
-	unsigned int cp_blks = 1 + le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
+	unsigned int cp_blks = 1 + __cp_payload(sbi);
 	block_t cp_blk_no;
 	int i;
 
@@ -884,7 +883,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 	__u32 crc32 = 0;
 	void *kaddr;
 	int i;
-	int cp_payload_blks = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
+	int cp_payload_blks = __cp_payload(sbi);
 
 	/*
 	 * This avoids to conduct wrong roll-forward operations and uses
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 7fa3313..f8bde23 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -920,12 +920,17 @@ static inline unsigned long __bitmap_size(struct f2fs_sb_info *sbi, int flag)
 	return 0;
 }
 
+static inline block_t __cp_payload(struct f2fs_sb_info *sbi)
+{
+	return le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
+}
+
 static inline void *__bitmap_ptr(struct f2fs_sb_info *sbi, int flag)
 {
 	struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
 	int offset;
 
-	if (le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload) > 0) {
+	if (__cp_payload(sbi) > 0) {
 		if (flag == NAT_BITMAP)
 			return &ckpt->sit_nat_version_bitmap;
 		else
-- 
1.9.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/

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

* [PATCH 2/2] f2fs: fix the number of orphan inode blocks
  2015-02-25 23:57 ` Wanpeng Li
  (?)
@ 2015-02-25 23:57 ` Wanpeng Li
  2015-02-26  1:33   ` [f2fs-dev] " Chao Yu
  -1 siblings, 1 reply; 6+ messages in thread
From: Wanpeng Li @ 2015-02-25 23:57 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: Changman Lee, linux-f2fs-devel, linux-kernel, Wanpeng Li

cp_pack_start_sum is calculated in do_checkpoint and is equal to 
cpu_to_le32(1 + cp_payload_blks + orphan_blocks). The number of 
orphan inode blocks is take advantage of by recover_orphan_inodes 
to readahead meta pages and recovery inodes. However, current codes 
forget to reduce the number of cp payload blocks when calculate 
the number of orphan inode blocks. This patch fix it.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
 fs/f2fs/checkpoint.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 4dbcc81..db82e09 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -464,7 +464,7 @@ static void recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
 
 void recover_orphan_inodes(struct f2fs_sb_info *sbi)
 {
-	block_t start_blk, orphan_blkaddr, i, j;
+	block_t start_blk, orphan_blocks, i, j;
 
 	if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ORPHAN_PRESENT_FLAG))
 		return;
@@ -472,11 +472,11 @@ void recover_orphan_inodes(struct f2fs_sb_info *sbi)
 	set_sbi_flag(sbi, SBI_POR_DOING);
 
 	start_blk = __start_cp_addr(sbi) + 1 + __cp_payload(sbi);
-	orphan_blkaddr = __start_sum_addr(sbi) - 1;
+	orphan_blocks = __start_sum_addr(sbi) - 1 - __cp_payload(sbi);
 
-	ra_meta_pages(sbi, start_blk, orphan_blkaddr, META_CP);
+	ra_meta_pages(sbi, start_blk, orphan_blocks, META_CP);
 
-	for (i = 0; i < orphan_blkaddr; i++) {
+	for (i = 0; i < orphan_blocks; i++) {
 		struct page *page = get_meta_page(sbi, start_blk + i);
 		struct f2fs_orphan_block *orphan_blk;
 
-- 
1.9.1


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

* RE: [f2fs-dev] [PATCH 1/2] f2fs: introduce macro __cp_payload
  2015-02-25 23:57 ` Wanpeng Li
  (?)
  (?)
@ 2015-02-26  1:27 ` Chao Yu
  -1 siblings, 0 replies; 6+ messages in thread
From: Chao Yu @ 2015-02-26  1:27 UTC (permalink / raw)
  To: 'Wanpeng Li', 'Jaegeuk Kim'
  Cc: linux-kernel, linux-f2fs-devel

Hi Wanpeng,

> -----Original Message-----
> From: Wanpeng Li [mailto:wanpeng.li@linux.intel.com]
> Sent: Thursday, February 26, 2015 7:57 AM
> To: Jaegeuk Kim
> Cc: Wanpeng Li; linux-kernel@vger.kernel.org; linux-f2fs-devel@lists.sourceforge.net
> Subject: [f2fs-dev] [PATCH 1/2] f2fs: introduce macro __cp_payload
> 
> This patch introduce macro __cp_payload.

Good work! This patch looks good to me.

> 
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>

Reviewed-by: Chao Yu <chao2.yu@samsung.com>


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

* RE: [f2fs-dev] [PATCH 2/2] f2fs: fix the number of orphan inode blocks
  2015-02-25 23:57 ` [PATCH 2/2] f2fs: fix the number of orphan inode blocks Wanpeng Li
@ 2015-02-26  1:33   ` Chao Yu
  2015-02-27  9:11     ` Wanpeng Li
  0 siblings, 1 reply; 6+ messages in thread
From: Chao Yu @ 2015-02-26  1:33 UTC (permalink / raw)
  To: 'Wanpeng Li', 'Jaegeuk Kim'
  Cc: linux-kernel, linux-f2fs-devel

Hi Wanpeng,

> -----Original Message-----
> From: Wanpeng Li [mailto:wanpeng.li@linux.intel.com]
> Sent: Thursday, February 26, 2015 7:57 AM
> To: Jaegeuk Kim
> Cc: Wanpeng Li; linux-kernel@vger.kernel.org; linux-f2fs-devel@lists.sourceforge.net
> Subject: [f2fs-dev] [PATCH 2/2] f2fs: fix the number of orphan inode blocks
> 
> cp_pack_start_sum is calculated in do_checkpoint and is equal to
> cpu_to_le32(1 + cp_payload_blks + orphan_blocks). The number of
> orphan inode blocks is take advantage of by recover_orphan_inodes
> to readahead meta pages and recovery inodes. However, current codes
> forget to reduce the number of cp payload blocks when calculate
> the number of orphan inode blocks. This patch fix it.

Nice work! looks good to me. :)

> 
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>

Reviewed-by: Chao Yu <chao2.yu@samsung.com>


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

* Re: [f2fs-dev] [PATCH 2/2] f2fs: fix the number of orphan inode blocks
  2015-02-26  1:33   ` [f2fs-dev] " Chao Yu
@ 2015-02-27  9:11     ` Wanpeng Li
  0 siblings, 0 replies; 6+ messages in thread
From: Wanpeng Li @ 2015-02-27  9:11 UTC (permalink / raw)
  To: Chao Yu
  Cc: 'Jaegeuk Kim',
	Changman Lee, linux-f2fs-devel, linux-fsdevel, linux-kernel,
	Wanpeng Li

Hi Chao,
On Thu, Feb 26, 2015 at 09:33:55AM +0800, Chao Yu wrote:
>Hi Wanpeng,
>
>> -----Original Message-----
>> From: Wanpeng Li [mailto:wanpeng.li@linux.intel.com]
>> Sent: Thursday, February 26, 2015 7:57 AM
>> To: Jaegeuk Kim
>> Cc: Wanpeng Li; linux-kernel@vger.kernel.org; linux-f2fs-devel@lists.sourceforge.net
>> Subject: [f2fs-dev] [PATCH 2/2] f2fs: fix the number of orphan inode blocks
>> 
>> cp_pack_start_sum is calculated in do_checkpoint and is equal to
>> cpu_to_le32(1 + cp_payload_blks + orphan_blocks). The number of
>> orphan inode blocks is take advantage of by recover_orphan_inodes
>> to readahead meta pages and recovery inodes. However, current codes
>> forget to reduce the number of cp payload blocks when calculate
>> the number of orphan inode blocks. This patch fix it.
>
>Nice work! looks good to me. :)
>
>> 
>> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
>
>Reviewed-by: Chao Yu <chao2.yu@samsung.com>

Thanks for your review. ;-)

Regards,
Wanpeng Li 

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

end of thread, other threads:[~2015-02-27  9:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 23:57 [PATCH 1/2] f2fs: introduce macro __cp_payload Wanpeng Li
2015-02-25 23:57 ` Wanpeng Li
2015-02-25 23:57 ` [PATCH 2/2] f2fs: fix the number of orphan inode blocks Wanpeng Li
2015-02-26  1:33   ` [f2fs-dev] " Chao Yu
2015-02-27  9:11     ` Wanpeng Li
2015-02-26  1:27 ` [f2fs-dev] [PATCH 1/2] f2fs: introduce macro __cp_payload 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.