History

blk-throttle: fix unused variable warning with BLK_DEV_THROTTLING_LOW=n

We trigger this warning: block/blk-throttle.c: In function ‘blk_throtl_bio’: block/blk-throttle.c:2042:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] int ret; ^~~ since we only assign 'ret' if BLK_DEV_THROTTLING_LOW is off, we never check it.

Jens Axboe committed 9 years ago

Commit 2bc19cd1 parent 659b3391 file · +15 −7Browse files

Unified · Split

block/blk-throttle.c+15−7
@@ -2030,6 +2030,20 @@ static inline void throtl_update_latency_buckets(struct throtl_data *td) · 2029 unmodified lines
20302030 }
20312031 #endif
20322032
2033+static void blk_throtl_assoc_bio(struct throtl_grp *tg, struct bio *bio)
2034+{
2035+#ifdef CONFIG_BLK_DEV_THROTTLING_LOW
2036+ int ret;
2037+
2038+ ret = bio_associate_current(bio);
2039+ if (ret == 0 || ret == -EBUSY)
2040+ bio->bi_cg_private = tg;
2041+ blk_stat_set_issue(&bio->bi_issue_stat, bio_sectors(bio));
2042+#else
2043+ bio_associate_current(bio);
2044+#endif
2045+}
2046+
20332047 bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg,
20342048 struct bio *bio)
20352049 {
@@ -2039,7 +2053,6 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, · 3 unmodified lines
20392053 bool rw = bio_data_dir(bio);
20402054 bool throttled = false;
20412055 struct throtl_data *td = tg->td;
2042− int ret;
20432056
20442057 WARN_ON_ONCE(!rcu_read_lock_held());
20452058
@@ -2054,12 +2067,7 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, · 8 unmodified lines
20542067 if (unlikely(blk_queue_bypass(q)))
20552068 goto out_unlock;
20562069
2057− ret = bio_associate_current(bio);
2058−#ifdef CONFIG_BLK_DEV_THROTTLING_LOW
2059− if (ret == 0 || ret == -EBUSY)
2060− bio->bi_cg_private = tg;
2061− blk_stat_set_issue(&bio->bi_issue_stat, bio_sectors(bio));
2062−#endif
2070+ blk_throtl_assoc_bio(tg, bio);
20632071 blk_throtl_update_idletime(tg);
20642072
20652073 sq = &tg->service_queue;