Skip to contentSkip to conversation

cleanup for blk-wbt

PATCH In review weiping zhang 2 participants 7 messages Nov 23, 2017 – Nov 24, 2017 Block layer

lore
Share & tools
lore
#0 lore raw

cover cleanup for blk-wbt

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(-)
Signature · 1 line
2.9.4
#1 lore raw

PATCH 1/5 blk-wbt: remove duplicated setting in wbt_init

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

---
 block/blk-wbt.c | 2 --
 1 file changed, 2 deletions(-)
block/blk-wbt.c +0 -2
index e59d59c..edb09e93 100644
@@ -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;
Signature · 1 line
2.9.4
#2 lore raw

PATCH 2/5 blk-wbt: cleanup comments to one line

In reply to weiping zhang
---
 block/blk-wbt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
block/blk-wbt.c +1 -3
index edb09e93..0fb65f0 100644
@@ -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);
 
Signature · 1 line
2.9.4
#3 lore raw

PATCH 3/5 blk-sysfs: remove NULL pointer checking in queue_wb_lat_store

In reply to weiping zhang

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

---
 block/blk-sysfs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
block/blk-sysfs.c +1 -4
index b8362c0..9b1093a 100644
@@ -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)
Signature · 1 line
2.9.4
#4 lore raw

PATCH 4/5 blk-wbt: move wbt_clear_stat to common place in wbt_done

In reply to weiping zhang

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

---
 block/blk-wbt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
block/blk-wbt.c +1 -2
index 0fb65f0..cd9a20a 100644
@@ -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);
 }
 
 /*
Signature · 1 line
2.9.4
#5 lore raw

PATCH 5/5 blk-wbt: fix comments typo

In reply to weiping zhang
---
 block/blk-wbt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-wbt.c +1 -1
index cd9a20a..9f4ef9c 100644
@@ -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
Signature · 1 line
2.9.4
maintainer
#6 lore raw
In reply to weiping zhang
Quoted 10 lines · weiping zhang

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.

Signature · 1 line
Jens Axboe