f2fs: remove useless io_aware_gran variable

Message ID 20221116131035.1056523-1-Yuwei.Guan@zeekrlife.com
State New
Headers
Series f2fs: remove useless io_aware_gran variable |

Commit Message

Yuwei Guan Nov. 16, 2022, 1:10 p.m. UTC
  This 'io_aware_gran' is initialized as MAX_PLIST_NUM in
__init_discard_policy(), and use as 'i < dpolicy->io_aware_gran'
in __issue_discard_cmd(), but 'i < dpolicy->io_aware_gran' is
true always, so remvoe this variable.

Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
---
 fs/f2fs/f2fs.h    | 1 -
 fs/f2fs/segment.c | 4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)
  

Comments

Chao Yu Nov. 23, 2022, 3:12 p.m. UTC | #1
On 2022/11/16 21:10, Yuwei Guan wrote:
> This 'io_aware_gran' is initialized as MAX_PLIST_NUM in
> __init_discard_policy(), and use as 'i < dpolicy->io_aware_gran'
> in __issue_discard_cmd(), but 'i < dpolicy->io_aware_gran' is
> true always, so remvoe this variable.

I guess we can export it via sysfs for better configuation?

Thanks,

> 
> Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
> ---
>   fs/f2fs/f2fs.h    | 1 -
>   fs/f2fs/segment.c | 4 +---
>   2 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index dedac413bf64..ced8a5b226b5 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -388,7 +388,6 @@ struct discard_policy {
>   	unsigned int mid_interval;	/* used for device busy */
>   	unsigned int max_interval;	/* used for candidates not exist */
>   	unsigned int max_requests;	/* # of discards issued per round */
> -	unsigned int io_aware_gran;	/* minimum granularity discard not be aware of I/O */
>   	bool io_aware;			/* issue discard in idle time */
>   	bool sync;			/* submit discard with REQ_SYNC flag */
>   	bool ordered;			/* issue discard by lba order */
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 8b0b76550578..1cc41a65a645 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1059,7 +1059,6 @@ static void __init_discard_policy(struct f2fs_sb_info *sbi,
>   	dpolicy->granularity = granularity;
>   
>   	dpolicy->max_requests = dcc->max_discard_request;
> -	dpolicy->io_aware_gran = MAX_PLIST_NUM;
>   	dpolicy->timeout = false;
>   
>   	if (discard_type == DPOLICY_BG) {
> @@ -1483,8 +1482,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
>   				f2fs_time_over(sbi, UMOUNT_DISCARD_TIMEOUT))
>   				break;
>   
> -			if (dpolicy->io_aware && i < dpolicy->io_aware_gran &&
> -						!is_idle(sbi, DISCARD_TIME)) {
> +			if (dpolicy->io_aware && !is_idle(sbi, DISCARD_TIME)) {
>   				io_interrupted = true;
>   				break;
>   			}
  

Patch

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index dedac413bf64..ced8a5b226b5 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -388,7 +388,6 @@  struct discard_policy {
 	unsigned int mid_interval;	/* used for device busy */
 	unsigned int max_interval;	/* used for candidates not exist */
 	unsigned int max_requests;	/* # of discards issued per round */
-	unsigned int io_aware_gran;	/* minimum granularity discard not be aware of I/O */
 	bool io_aware;			/* issue discard in idle time */
 	bool sync;			/* submit discard with REQ_SYNC flag */
 	bool ordered;			/* issue discard by lba order */
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 8b0b76550578..1cc41a65a645 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1059,7 +1059,6 @@  static void __init_discard_policy(struct f2fs_sb_info *sbi,
 	dpolicy->granularity = granularity;
 
 	dpolicy->max_requests = dcc->max_discard_request;
-	dpolicy->io_aware_gran = MAX_PLIST_NUM;
 	dpolicy->timeout = false;
 
 	if (discard_type == DPOLICY_BG) {
@@ -1483,8 +1482,7 @@  static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 				f2fs_time_over(sbi, UMOUNT_DISCARD_TIMEOUT))
 				break;
 
-			if (dpolicy->io_aware && i < dpolicy->io_aware_gran &&
-						!is_idle(sbi, DISCARD_TIME)) {
+			if (dpolicy->io_aware && !is_idle(sbi, DISCARD_TIME)) {
 				io_interrupted = true;
 				break;
 			}