linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] f2fs: speed up gc_urgent mode with SSR
@ 2017-09-09 19:17 Jaegeuk Kim
  2017-09-09 19:17 ` [PATCH 2/2] f2fs: better to wait for fstrim completion Jaegeuk Kim
  2017-09-11 10:27 ` [f2fs-dev] [PATCH 1/2] f2fs: speed up gc_urgent mode with SSR Chao Yu
  0 siblings, 2 replies; 4+ messages in thread
From: Jaegeuk Kim @ 2017-09-09 19:17 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim, Jaegeuk Kim

From: Jaegeuk Kim <jaegeuk@google.com>

This patch activates SSR in gc_urgent mode.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/f2fs.h    |  1 +
 fs/f2fs/segment.c | 15 +++++++++++++++
 fs/f2fs/segment.h | 13 -------------
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index c0803b1873b3..9a7c90386947 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2511,6 +2511,7 @@ void destroy_node_manager_caches(void);
 /*
  * segment.c
  */
+bool need_SSR(struct f2fs_sb_info *sbi);
 void register_inmem_page(struct inode *inode, struct page *page);
 void drop_inmem_pages(struct inode *inode);
 void drop_inmem_page(struct inode *inode, struct page *page);
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 9e708e525ba8..f96e61e8ddf7 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -168,6 +168,21 @@ static unsigned long __find_rev_next_zero_bit(const unsigned long *addr,
 	return result - size + __reverse_ffz(tmp);
 }
 
+bool need_SSR(struct f2fs_sb_info *sbi)
+{
+	int node_secs = get_blocktype_secs(sbi, F2FS_DIRTY_NODES);
+	int dent_secs = get_blocktype_secs(sbi, F2FS_DIRTY_DENTS);
+	int imeta_secs = get_blocktype_secs(sbi, F2FS_DIRTY_IMETA);
+
+	if (test_opt(sbi, LFS))
+		return false;
+	if (sbi->gc_thread && sbi->gc_thread->gc_urgent)
+		return true;
+
+	return free_sections(sbi) <= (node_secs + 2 * dent_secs + imeta_secs +
+						2 * reserved_sections(sbi));
+}
+
 void register_inmem_page(struct inode *inode, struct page *page)
 {
 	struct f2fs_inode_info *fi = F2FS_I(inode);
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 613b2fa7b1c1..e0a6cc23ace3 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -497,19 +497,6 @@ static inline int reserved_sections(struct f2fs_sb_info *sbi)
 	return GET_SEC_FROM_SEG(sbi, (unsigned int)reserved_segments(sbi));
 }
 
-static inline bool need_SSR(struct f2fs_sb_info *sbi)
-{
-	int node_secs = get_blocktype_secs(sbi, F2FS_DIRTY_NODES);
-	int dent_secs = get_blocktype_secs(sbi, F2FS_DIRTY_DENTS);
-	int imeta_secs = get_blocktype_secs(sbi, F2FS_DIRTY_IMETA);
-
-	if (test_opt(sbi, LFS))
-		return false;
-
-	return free_sections(sbi) <= (node_secs + 2 * dent_secs + imeta_secs +
-						2 * reserved_sections(sbi));
-}
-
 static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi,
 					int freed, int needed)
 {
-- 
2.14.0.rc1.383.gd1ce394fe2-goog


------------------------------------------------------------------------------
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] 4+ messages in thread

* [PATCH 2/2] f2fs: better to wait for fstrim completion
  2017-09-09 19:17 [PATCH 1/2] f2fs: speed up gc_urgent mode with SSR Jaegeuk Kim
@ 2017-09-09 19:17 ` Jaegeuk Kim
  2017-09-11 10:35   ` Chao Yu
  2017-09-11 10:27 ` [f2fs-dev] [PATCH 1/2] f2fs: speed up gc_urgent mode with SSR Chao Yu
  1 sibling, 1 reply; 4+ messages in thread
From: Jaegeuk Kim @ 2017-09-09 19:17 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

In android, we'd better wait for fstrim completion instead of issuing the
discard commands asynchronous.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/segment.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index f96e61e8ddf7..beb15c834a34 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1076,6 +1076,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
 			if (dcc->pend_list_tag[i] & P_TRIM) {
 				__submit_discard_cmd(sbi, dc);
 				issued++;
+
+				if (fatal_signal_pending(current))
+					break;
 				continue;
 			}
 
@@ -1192,7 +1195,7 @@ void stop_discard_thread(struct f2fs_sb_info *sbi)
 	}
 }
 
-/* This comes from f2fs_put_super */
+/* This comes from f2fs_put_super and f2fs_trim_fs */
 void f2fs_wait_discard_bios(struct f2fs_sb_info *sbi)
 {
 	__issue_discard_cmd(sbi, false);
@@ -2227,6 +2230,7 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
 	}
 	/* It's time to issue all the filed discards */
 	mark_discard_range_all(sbi);
+	f2fs_wait_discard_bios(sbi);
 out:
 	range->len = F2FS_BLK_TO_BYTES(cpc.trimmed);
 	return err;
-- 
2.14.0.rc1.383.gd1ce394fe2-goog


------------------------------------------------------------------------------
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] 4+ messages in thread

* Re: [f2fs-dev] [PATCH 1/2] f2fs: speed up gc_urgent mode with SSR
  2017-09-09 19:17 [PATCH 1/2] f2fs: speed up gc_urgent mode with SSR Jaegeuk Kim
  2017-09-09 19:17 ` [PATCH 2/2] f2fs: better to wait for fstrim completion Jaegeuk Kim
@ 2017-09-11 10:27 ` Chao Yu
  1 sibling, 0 replies; 4+ messages in thread
From: Chao Yu @ 2017-09-11 10:27 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

On 2017/9/10 3:17, Jaegeuk Kim wrote:
> From: Jaegeuk Kim <jaegeuk@google.com>
> 
> This patch activates SSR in gc_urgent mode.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

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

> ---
>  fs/f2fs/f2fs.h    |  1 +
>  fs/f2fs/segment.c | 15 +++++++++++++++
>  fs/f2fs/segment.h | 13 -------------
>  3 files changed, 16 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index c0803b1873b3..9a7c90386947 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -2511,6 +2511,7 @@ void destroy_node_manager_caches(void);
>  /*
>   * segment.c
>   */
> +bool need_SSR(struct f2fs_sb_info *sbi);
>  void register_inmem_page(struct inode *inode, struct page *page);
>  void drop_inmem_pages(struct inode *inode);
>  void drop_inmem_page(struct inode *inode, struct page *page);
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 9e708e525ba8..f96e61e8ddf7 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -168,6 +168,21 @@ static unsigned long __find_rev_next_zero_bit(const unsigned long *addr,
>  	return result - size + __reverse_ffz(tmp);
>  }
>  
> +bool need_SSR(struct f2fs_sb_info *sbi)
> +{
> +	int node_secs = get_blocktype_secs(sbi, F2FS_DIRTY_NODES);
> +	int dent_secs = get_blocktype_secs(sbi, F2FS_DIRTY_DENTS);
> +	int imeta_secs = get_blocktype_secs(sbi, F2FS_DIRTY_IMETA);
> +
> +	if (test_opt(sbi, LFS))
> +		return false;
> +	if (sbi->gc_thread && sbi->gc_thread->gc_urgent)
> +		return true;
> +
> +	return free_sections(sbi) <= (node_secs + 2 * dent_secs + imeta_secs +
> +						2 * reserved_sections(sbi));
> +}
> +
>  void register_inmem_page(struct inode *inode, struct page *page)
>  {
>  	struct f2fs_inode_info *fi = F2FS_I(inode);
> diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
> index 613b2fa7b1c1..e0a6cc23ace3 100644
> --- a/fs/f2fs/segment.h
> +++ b/fs/f2fs/segment.h
> @@ -497,19 +497,6 @@ static inline int reserved_sections(struct f2fs_sb_info *sbi)
>  	return GET_SEC_FROM_SEG(sbi, (unsigned int)reserved_segments(sbi));
>  }
>  
> -static inline bool need_SSR(struct f2fs_sb_info *sbi)
> -{
> -	int node_secs = get_blocktype_secs(sbi, F2FS_DIRTY_NODES);
> -	int dent_secs = get_blocktype_secs(sbi, F2FS_DIRTY_DENTS);
> -	int imeta_secs = get_blocktype_secs(sbi, F2FS_DIRTY_IMETA);
> -
> -	if (test_opt(sbi, LFS))
> -		return false;
> -
> -	return free_sections(sbi) <= (node_secs + 2 * dent_secs + imeta_secs +
> -						2 * reserved_sections(sbi));
> -}
> -
>  static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi,
>  					int freed, int needed)
>  {
> 

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

* Re: [PATCH 2/2] f2fs: better to wait for fstrim completion
  2017-09-09 19:17 ` [PATCH 2/2] f2fs: better to wait for fstrim completion Jaegeuk Kim
@ 2017-09-11 10:35   ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2017-09-11 10:35 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-fsdevel, linux-f2fs-devel

On 2017/9/10 3:17, Jaegeuk Kim wrote:
> In android, we'd better wait for fstrim completion instead of issuing the
> discard commands asynchronous.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

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

> ---
>  fs/f2fs/segment.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index f96e61e8ddf7..beb15c834a34 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1076,6 +1076,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
>  			if (dcc->pend_list_tag[i] & P_TRIM) {
>  				__submit_discard_cmd(sbi, dc);
>  				issued++;
> +
> +				if (fatal_signal_pending(current))
> +					break;
>  				continue;
>  			}
>  
> @@ -1192,7 +1195,7 @@ void stop_discard_thread(struct f2fs_sb_info *sbi)
>  	}
>  }
>  
> -/* This comes from f2fs_put_super */
> +/* This comes from f2fs_put_super and f2fs_trim_fs */
>  void f2fs_wait_discard_bios(struct f2fs_sb_info *sbi)
>  {
>  	__issue_discard_cmd(sbi, false);
> @@ -2227,6 +2230,7 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
>  	}
>  	/* It's time to issue all the filed discards */
>  	mark_discard_range_all(sbi);
> +	f2fs_wait_discard_bios(sbi);
>  out:
>  	range->len = F2FS_BLK_TO_BYTES(cpc.trimmed);
>  	return err;
> 


------------------------------------------------------------------------------
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] 4+ messages in thread

end of thread, other threads:[~2017-09-11 10:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-09 19:17 [PATCH 1/2] f2fs: speed up gc_urgent mode with SSR Jaegeuk Kim
2017-09-09 19:17 ` [PATCH 2/2] f2fs: better to wait for fstrim completion Jaegeuk Kim
2017-09-11 10:35   ` Chao Yu
2017-09-11 10:27 ` [f2fs-dev] [PATCH 1/2] f2fs: speed up gc_urgent mode with SSR Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).