linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] cleanup for blk-wbt
@ 2017-11-23 13:37 weiping zhang
  2017-11-23 13:39 ` [PATCH 1/5] blk-wbt: remove duplicated setting in wbt_init weiping zhang
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: weiping zhang @ 2017-11-23 13:37 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

Hi Jens,

several cleanup for blk-wbt, no function change, thanks

weiping zhang (5):
  blk-wbt: remove duplicated setting in wbt_init
  blk-wbt: cleanup comments to one line
  blk-sysfs: remove NULL pointer checking in queue_wb_lat_store
  blk-wbt: move wbt_clear_stat to common place in wbt_done
  blk-wbt: fix comments typo

 block/blk-sysfs.c |  5 +----
 block/blk-wbt.c   | 11 +++--------
 2 files changed, 4 insertions(+), 12 deletions(-)

-- 
2.9.4

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

* [PATCH 1/5] blk-wbt: remove duplicated setting in wbt_init
  2017-11-23 13:37 [PATCH 0/5] cleanup for blk-wbt weiping zhang
@ 2017-11-23 13:39 ` weiping zhang
  2017-11-23 13:39 ` [PATCH 2/5] blk-wbt: cleanup comments to one line weiping zhang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: weiping zhang @ 2017-11-23 13:39 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

rwb->wc and rwb->queue_depth were overwritten by wbt_set_write_cache and
wbt_set_queue_depth, remove the default setting.

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
 block/blk-wbt.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index e59d59c..edb09e93 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -723,8 +723,6 @@ int wbt_init(struct request_queue *q)
 		init_waitqueue_head(&rwb->rq_wait[i].wait);
 	}
 
-	rwb->wc = 1;
-	rwb->queue_depth = RWB_DEF_DEPTH;
 	rwb->last_comp = rwb->last_issue = jiffies;
 	rwb->queue = q;
 	rwb->win_nsec = RWB_WINDOW_NSEC;
-- 
2.9.4

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

* [PATCH 2/5] blk-wbt: cleanup comments to one line
  2017-11-23 13:37 [PATCH 0/5] cleanup for blk-wbt weiping zhang
  2017-11-23 13:39 ` [PATCH 1/5] blk-wbt: remove duplicated setting in wbt_init weiping zhang
@ 2017-11-23 13:39 ` weiping zhang
  2017-11-23 13:39 ` [PATCH 3/5] blk-sysfs: remove NULL pointer checking in queue_wb_lat_store weiping zhang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: weiping zhang @ 2017-11-23 13:39 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
 block/blk-wbt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index edb09e93..0fb65f0 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -729,9 +729,7 @@ int wbt_init(struct request_queue *q)
 	rwb->enable_state = WBT_STATE_ON_DEFAULT;
 	wbt_update_limits(rwb);
 
-	/*
-	 * Assign rwb and add the stats callback.
-	 */
+	/* Assign rwb and add the stats callback. */
 	q->rq_wb = rwb;
 	blk_stat_add_callback(q, rwb->cb);
 
-- 
2.9.4

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

* [PATCH 3/5] blk-sysfs: remove NULL pointer checking in queue_wb_lat_store
  2017-11-23 13:37 [PATCH 0/5] cleanup for blk-wbt weiping zhang
  2017-11-23 13:39 ` [PATCH 1/5] blk-wbt: remove duplicated setting in wbt_init weiping zhang
  2017-11-23 13:39 ` [PATCH 2/5] blk-wbt: cleanup comments to one line weiping zhang
@ 2017-11-23 13:39 ` weiping zhang
  2017-11-23 13:39 ` [PATCH 4/5] blk-wbt: move wbt_clear_stat to common place in wbt_done weiping zhang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: weiping zhang @ 2017-11-23 13:39 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

wbt_init doesn't set q->rq_wb to NULL, if wbt_init return 0,
so check return value is enough, remove NULL checking.

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
 block/blk-sysfs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index b8362c0..9b1093a 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -449,12 +449,9 @@ static ssize_t queue_wb_lat_store(struct request_queue *q, const char *page,
 		ret = wbt_init(q);
 		if (ret)
 			return ret;
-
-		rwb = q->rq_wb;
-		if (!rwb)
-			return -EINVAL;
 	}
 
+	rwb = q->rq_wb;
 	if (val == -1)
 		rwb->min_lat_nsec = wbt_default_latency_nsec(q);
 	else if (val >= 0)
-- 
2.9.4

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

* [PATCH 4/5] blk-wbt: move wbt_clear_stat to common place in wbt_done
  2017-11-23 13:37 [PATCH 0/5] cleanup for blk-wbt weiping zhang
                   ` (2 preceding siblings ...)
  2017-11-23 13:39 ` [PATCH 3/5] blk-sysfs: remove NULL pointer checking in queue_wb_lat_store weiping zhang
@ 2017-11-23 13:39 ` weiping zhang
  2017-11-23 13:40 ` [PATCH 5/5] blk-wbt: fix comments typo weiping zhang
  2017-11-24  4:59 ` [PATCH 0/5] cleanup for blk-wbt Jens Axboe
  5 siblings, 0 replies; 7+ messages in thread
From: weiping zhang @ 2017-11-23 13:39 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

wbt_done call wbt_clear_stat no matter current stat was tracked
or not, move it to common place.

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
 block/blk-wbt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 0fb65f0..cd9a20a 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -178,12 +178,11 @@ void wbt_done(struct rq_wb *rwb, struct blk_issue_stat *stat)
 
 		if (wbt_is_read(stat))
 			wb_timestamp(rwb, &rwb->last_comp);
-		wbt_clear_state(stat);
 	} else {
 		WARN_ON_ONCE(stat == rwb->sync_cookie);
 		__wbt_done(rwb, wbt_stat_to_mask(stat));
-		wbt_clear_state(stat);
 	}
+	wbt_clear_state(stat);
 }
 
 /*
-- 
2.9.4

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

* [PATCH 5/5] blk-wbt: fix comments typo
  2017-11-23 13:37 [PATCH 0/5] cleanup for blk-wbt weiping zhang
                   ` (3 preceding siblings ...)
  2017-11-23 13:39 ` [PATCH 4/5] blk-wbt: move wbt_clear_stat to common place in wbt_done weiping zhang
@ 2017-11-23 13:40 ` weiping zhang
  2017-11-24  4:59 ` [PATCH 0/5] cleanup for blk-wbt Jens Axboe
  5 siblings, 0 replies; 7+ messages in thread
From: weiping zhang @ 2017-11-23 13:40 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
 block/blk-wbt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index cd9a20a..9f4ef9c 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -481,7 +481,7 @@ static inline unsigned int get_limit(struct rq_wb *rwb, unsigned long rw)
 
 	/*
 	 * At this point we know it's a buffered write. If this is
-	 * kswapd trying to free memory, or REQ_SYNC is set, set, then
+	 * kswapd trying to free memory, or REQ_SYNC is set, then
 	 * it's WB_SYNC_ALL writeback, and we'll use the max limit for
 	 * that. If the write is marked as a background write, then use
 	 * the idle limit, or go to normal if we haven't had competing
-- 
2.9.4

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

* Re: [PATCH 0/5] cleanup for blk-wbt
  2017-11-23 13:37 [PATCH 0/5] cleanup for blk-wbt weiping zhang
                   ` (4 preceding siblings ...)
  2017-11-23 13:40 ` [PATCH 5/5] blk-wbt: fix comments typo weiping zhang
@ 2017-11-24  4:59 ` Jens Axboe
  5 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2017-11-24  4:59 UTC (permalink / raw)
  To: linux-block

On 11/23/2017 06:37 AM, weiping zhang wrote:
> Hi Jens,
> 
> several cleanup for blk-wbt, no function change, thanks
> 
> weiping zhang (5):
>   blk-wbt: remove duplicated setting in wbt_init
>   blk-wbt: cleanup comments to one line
>   blk-sysfs: remove NULL pointer checking in queue_wb_lat_store
>   blk-wbt: move wbt_clear_stat to common place in wbt_done
>   blk-wbt: fix comments typo

Thanks, looks good - I applied 4, I dropped the comment fixup. It's
pointless churn, and there are lots of other comments using that
style for one line, even in that same file.

-- 
Jens Axboe

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

end of thread, other threads:[~2017-11-24  4:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-23 13:37 [PATCH 0/5] cleanup for blk-wbt weiping zhang
2017-11-23 13:39 ` [PATCH 1/5] blk-wbt: remove duplicated setting in wbt_init weiping zhang
2017-11-23 13:39 ` [PATCH 2/5] blk-wbt: cleanup comments to one line weiping zhang
2017-11-23 13:39 ` [PATCH 3/5] blk-sysfs: remove NULL pointer checking in queue_wb_lat_store weiping zhang
2017-11-23 13:39 ` [PATCH 4/5] blk-wbt: move wbt_clear_stat to common place in wbt_done weiping zhang
2017-11-23 13:40 ` [PATCH 5/5] blk-wbt: fix comments typo weiping zhang
2017-11-24  4:59 ` [PATCH 0/5] cleanup for blk-wbt Jens Axboe

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).