All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: allow  ssa journal with nat bits enabled
@ 2018-04-25  7:56 Yunlei He
  2018-04-25 13:21 ` Chao Yu
  2018-05-04  8:27 ` heyunlei
  0 siblings, 2 replies; 3+ messages in thread
From: Yunlei He @ 2018-04-25  7:56 UTC (permalink / raw)
  To: jaegeuk, yuchao0, linux-f2fs-devel; +Cc: zhangdianfang

This patch enable ssa journal with nat bits, which is
benifit for nat metadata write.

Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
 fs/f2fs/node.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 681552b..220110a 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2446,7 +2446,7 @@ static void __adjust_nat_entry_set(struct nat_entry_set *nes,
 }
 
 static void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid,
-						struct page *page)
+					struct page *page, bool to_journal)
 {
 	struct f2fs_nm_info *nm_i = NM_I(sbi);
 	unsigned int nat_index = start_nid / NAT_ENTRY_PER_BLOCK;
@@ -2457,6 +2457,12 @@ static void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid,
 	if (!enabled_nat_bits(sbi, NULL))
 		return;
 
+	if (to_journal) {
+		__clear_bit_le(nat_index, nm_i->full_nat_bits);
+		__clear_bit_le(nat_index, nm_i->empty_nat_bits);
+		return;
+	}
+
 	if (nat_index == 0) {
 		valid = 1;
 		i = 1;
@@ -2494,8 +2500,7 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi,
 	 * #1, flush nat entries to journal in current hot data summary block.
 	 * #2, flush nat entries to nat page.
 	 */
-	if (enabled_nat_bits(sbi, cpc) ||
-		!__has_cursum_space(journal, set->entry_cnt, NAT_JOURNAL))
+	if (!__has_cursum_space(journal, set->entry_cnt, NAT_JOURNAL))
 		to_journal = false;
 
 	if (to_journal) {
@@ -2535,11 +2540,11 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi,
 		}
 	}
 
+	__update_nat_bits(sbi, start_nid, page, to_journal);
 	if (to_journal) {
 		up_write(&curseg->journal_rwsem);
 	} else {
 		scan_nat_page(sbi, page, start_nid, false);
-		__update_nat_bits(sbi, start_nid, page);
 		f2fs_put_page(page, 1);
 	}
 
@@ -2574,8 +2579,7 @@ void flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 	 * entries, remove all entries from journal and merge them
 	 * into nat entry set.
 	 */
-	if (enabled_nat_bits(sbi, cpc) ||
-		!__has_cursum_space(journal, nm_i->dirty_nat_cnt, NAT_JOURNAL))
+	if (!__has_cursum_space(journal, nm_i->dirty_nat_cnt, NAT_JOURNAL))
 		remove_nats_in_journal(sbi);
 
 	while ((found = __gang_lookup_nat_set(nm_i,
-- 
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

* Re: [PATCH] f2fs: allow ssa journal with nat bits enabled
  2018-04-25  7:56 [PATCH] f2fs: allow ssa journal with nat bits enabled Yunlei He
@ 2018-04-25 13:21 ` Chao Yu
  2018-05-04  8:27 ` heyunlei
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2018-04-25 13:21 UTC (permalink / raw)
  To: Yunlei He, jaegeuk, yuchao0, linux-f2fs-devel; +Cc: zhangdianfang

On 2018/4/25 15:56, Yunlei He wrote:
> This patch enable ssa journal with nat bits, which is
> benifit for nat metadata write.
> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>

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

Thanks,

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

* Re: [PATCH] f2fs: allow ssa journal with nat bits enabled
  2018-04-25  7:56 [PATCH] f2fs: allow ssa journal with nat bits enabled Yunlei He
  2018-04-25 13:21 ` Chao Yu
@ 2018-05-04  8:27 ` heyunlei
  1 sibling, 0 replies; 3+ messages in thread
From: heyunlei @ 2018-05-04  8:27 UTC (permalink / raw)
  To: heyunlei, jaegeuk, Yuchao (T), linux-f2fs-devel; +Cc: Zhangdianfang (Euler)

Ping

Thanks

>-----Original Message-----
>From: heyunlei
>Sent: Wednesday, April 25, 2018 3:57 PM
>To: jaegeuk@kernel.org; Yuchao (T); linux-f2fs-devel@lists.sourceforge.net
>Cc: Wangbintian; heyunlei; Zhangdianfang (Euler)
>Subject: [f2fs-dev][PATCH] f2fs: allow ssa journal with nat bits enabled
>
>This patch enable ssa journal with nat bits, which is
>benifit for nat metadata write.
>
>Signed-off-by: Yunlei He <heyunlei@huawei.com>
>---
> fs/f2fs/node.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
>diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
>index 681552b..220110a 100644
>--- a/fs/f2fs/node.c
>+++ b/fs/f2fs/node.c
>@@ -2446,7 +2446,7 @@ static void __adjust_nat_entry_set(struct nat_entry_set *nes,
> }
>
> static void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid,
>-						struct page *page)
>+					struct page *page, bool to_journal)
> {
> 	struct f2fs_nm_info *nm_i = NM_I(sbi);
> 	unsigned int nat_index = start_nid / NAT_ENTRY_PER_BLOCK;
>@@ -2457,6 +2457,12 @@ static void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid,
> 	if (!enabled_nat_bits(sbi, NULL))
> 		return;
>
>+	if (to_journal) {
>+		__clear_bit_le(nat_index, nm_i->full_nat_bits);
>+		__clear_bit_le(nat_index, nm_i->empty_nat_bits);
>+		return;
>+	}
>+
> 	if (nat_index == 0) {
> 		valid = 1;
> 		i = 1;
>@@ -2494,8 +2500,7 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi,
> 	 * #1, flush nat entries to journal in current hot data summary block.
> 	 * #2, flush nat entries to nat page.
> 	 */
>-	if (enabled_nat_bits(sbi, cpc) ||
>-		!__has_cursum_space(journal, set->entry_cnt, NAT_JOURNAL))
>+	if (!__has_cursum_space(journal, set->entry_cnt, NAT_JOURNAL))
> 		to_journal = false;
>
> 	if (to_journal) {
>@@ -2535,11 +2540,11 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi,
> 		}
> 	}
>
>+	__update_nat_bits(sbi, start_nid, page, to_journal);
> 	if (to_journal) {
> 		up_write(&curseg->journal_rwsem);
> 	} else {
> 		scan_nat_page(sbi, page, start_nid, false);
>-		__update_nat_bits(sbi, start_nid, page);
> 		f2fs_put_page(page, 1);
> 	}
>
>@@ -2574,8 +2579,7 @@ void flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
> 	 * entries, remove all entries from journal and merge them
> 	 * into nat entry set.
> 	 */
>-	if (enabled_nat_bits(sbi, cpc) ||
>-		!__has_cursum_space(journal, nm_i->dirty_nat_cnt, NAT_JOURNAL))
>+	if (!__has_cursum_space(journal, nm_i->dirty_nat_cnt, NAT_JOURNAL))
> 		remove_nats_in_journal(sbi);
>
> 	while ((found = __gang_lookup_nat_set(nm_i,
>--
>1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

end of thread, other threads:[~2018-05-04  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-25  7:56 [PATCH] f2fs: allow ssa journal with nat bits enabled Yunlei He
2018-04-25 13:21 ` Chao Yu
2018-05-04  8:27 ` heyunlei

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.