From: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org, dm-devel@redhat.com,
jens.axboe@oracle.com, nauman@google.com, dpshah@google.com,
lizf@cn.fujitsu.com, mikew@google.com, fchecconi@gmail.com,
paolo.valente@unimore.it, ryov@valinux.co.jp,
fernando@oss.ntt.co.jp, s-uchida@ap.jp.nec.com,
taka@valinux.co.jp, jmoyer@redhat.com, dhaval@linux.vnet.ibm.com,
balbir@linux.vnet.ibm.com, righi.andrea@gmail.com,
m-ikeda@ds.jp.nec.com, jbaron@redhat.com, agk@redhat.com,
snitzer@redhat.com, akpm@linux-foundation.org,
peterz@infradead.org
Subject: Re: [PATCH 02/19] io-controller: Common flat fair queuing code in elevaotor layer
Date: Tue, 09 Jun 2009 16:45:14 +0800 [thread overview]
Message-ID: <4A2E211A.3030303@cn.fujitsu.com> (raw)
In-Reply-To: <1244513342-11758-3-git-send-email-vgoyal@redhat.com>
Vivek Goyal wrote:
...
> +
> +ssize_t elv_slice_idle_store(struct request_queue *q, const char *name,
> + size_t count)
> +{
> + struct elv_fq_data *efqd;
> + unsigned int data;
> + unsigned long flags;
> +
> + char *p = (char *)name;
> +
> + data = simple_strtoul(p, &p, 10);
> +
> + if (data < 0)
Hi Vivek,
data can never be less than zero. Same problems also exist for other sysfs entry.
Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
---
block/elevator-fq.c | 40 +++++++++++++---------------------------
block/elevator-fq.h | 6 +++---
2 files changed, 16 insertions(+), 30 deletions(-)
diff --git a/block/elevator-fq.c b/block/elevator-fq.c
index 42d4279..8027f4c 100644
--- a/block/elevator-fq.c
+++ b/block/elevator-fq.c
@@ -2643,32 +2643,27 @@ ssize_t elv_fairness_store(struct request_queue *q, const char *name,
ssize_t elv_slice_idle_show(struct request_queue *q, char *name)
{
struct elv_fq_data *efqd;
- unsigned int data;
+ unsigned long data;
unsigned long flags;
spin_lock_irqsave(q->queue_lock, flags);
efqd = &q->elevator->efqd;
data = jiffies_to_msecs(efqd->elv_slice_idle);
spin_unlock_irqrestore(q->queue_lock, flags);
- return sprintf(name, "%d\n", data);
+ return sprintf(name, "%lu\n", data);
}
ssize_t elv_slice_idle_store(struct request_queue *q, const char *name,
size_t count)
{
struct elv_fq_data *efqd;
- unsigned int data;
+ unsigned long data;
unsigned long flags;
char *p = (char *)name;
data = simple_strtoul(p, &p, 10);
- if (data < 0)
- data = 0;
- else if (data > INT_MAX)
- data = INT_MAX;
-
data = msecs_to_jiffies(data);
spin_lock_irqsave(q->queue_lock, flags);
@@ -2683,32 +2678,27 @@ ssize_t elv_slice_idle_store(struct request_queue *q, const char *name,
ssize_t elv_async_slice_idle_show(struct request_queue *q, char *name)
{
struct elv_fq_data *efqd;
- unsigned int data;
+ unsigned long data;
unsigned long flags;
spin_lock_irqsave(q->queue_lock, flags);
efqd = &q->elevator->efqd;
data = jiffies_to_msecs(efqd->elv_async_slice_idle);
spin_unlock_irqrestore(q->queue_lock, flags);
- return sprintf(name, "%d\n", data);
+ return sprintf(name, "%lu\n", data);
}
ssize_t elv_async_slice_idle_store(struct request_queue *q, const char *name,
size_t count)
{
struct elv_fq_data *efqd;
- unsigned int data;
+ unsigned long data;
unsigned long flags;
char *p = (char *)name;
data = simple_strtoul(p, &p, 10);
- if (data < 0)
- data = 0;
- else if (data > INT_MAX)
- data = INT_MAX;
-
data = msecs_to_jiffies(data);
spin_lock_irqsave(q->queue_lock, flags);
@@ -2730,24 +2720,22 @@ ssize_t elv_slice_sync_show(struct request_queue *q, char *name)
efqd = &q->elevator->efqd;
data = efqd->elv_slice[1];
spin_unlock_irqrestore(q->queue_lock, flags);
- return sprintf(name, "%d\n", data);
+ return sprintf(name, "%lu\n", data);
}
ssize_t elv_slice_sync_store(struct request_queue *q, const char *name,
size_t count)
{
struct elv_fq_data *efqd;
- unsigned int data;
+ unsigned long data;
unsigned long flags;
char *p = (char *)name;
data = simple_strtoul(p, &p, 10);
- if (data < 0)
- data = 0;
/* 100ms is the limit for now*/
- else if (data > 100)
+ if (data > 100)
data = 100;
spin_lock_irqsave(q->queue_lock, flags);
@@ -2762,31 +2750,29 @@ ssize_t elv_slice_sync_store(struct request_queue *q, const char *name,
ssize_t elv_slice_async_show(struct request_queue *q, char *name)
{
struct elv_fq_data *efqd;
- unsigned int data;
+ unsigned long data;
unsigned long flags;
spin_lock_irqsave(q->queue_lock, flags);
efqd = &q->elevator->efqd;
data = efqd->elv_slice[0];
spin_unlock_irqrestore(q->queue_lock, flags);
- return sprintf(name, "%d\n", data);
+ return sprintf(name, "%lu\n", data);
}
ssize_t elv_slice_async_store(struct request_queue *q, const char *name,
size_t count)
{
struct elv_fq_data *efqd;
- unsigned int data;
+ unsigned long data;
unsigned long flags;
char *p = (char *)name;
data = simple_strtoul(p, &p, 10);
- if (data < 0)
- data = 0;
/* 100ms is the limit for now*/
- else if (data > 100)
+ if (data > 100)
data = 100;
spin_lock_irqsave(q->queue_lock, flags);
diff --git a/block/elevator-fq.h b/block/elevator-fq.h
index 4fe843a..46e4dbc 100644
--- a/block/elevator-fq.h
+++ b/block/elevator-fq.h
@@ -338,13 +338,13 @@ struct elv_fq_data {
* have any notion of anticipation/idling. As of now, these are the
* users of this functionality.
*/
- unsigned int elv_slice_idle;
+ unsigned long elv_slice_idle;
/* idle slice for async queue */
- unsigned int elv_async_slice_idle;
+ unsigned long elv_async_slice_idle;
struct timer_list idle_slice_timer;
struct work_struct unplug_work;
- unsigned int elv_slice[2];
+ unsigned long elv_slice[2];
/* Fields for keeping track of average disk rate */
unsigned long rate_sectors; /* number of sectors finished */
--
1.5.4.rc3
next prev parent reply other threads:[~2009-06-09 8:46 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 2:08 [RFC] IO scheduler based IO controller V4 Vivek Goyal
2009-06-09 2:08 ` [PATCH 01/19] io-controller: Documentation Vivek Goyal
2009-06-09 2:08 ` [PATCH 02/19] io-controller: Common flat fair queuing code in elevaotor layer Vivek Goyal
2009-06-09 8:45 ` Gui Jianfeng [this message]
2009-06-16 3:54 ` Gui Jianfeng
2009-06-16 13:02 ` Vivek Goyal
2009-06-16 19:44 ` Divyesh Shah
2009-06-17 12:59 ` Vivek Goyal
2009-06-09 2:08 ` [PATCH 03/19] io-controller: Charge for time slice based on average disk rate Vivek Goyal
2009-06-09 2:08 ` [PATCH 04/19] io-controller: Modify cfq to make use of flat elevator fair queuing Vivek Goyal
2009-06-11 6:12 ` Gui Jianfeng
2009-06-11 14:21 ` Vivek Goyal
2009-06-15 8:56 ` Gui Jianfeng
2009-06-15 13:02 ` Vivek Goyal
2009-06-17 2:22 ` Gui Jianfeng
2009-06-17 13:00 ` Vivek Goyal
2009-06-09 2:08 ` [PATCH 05/19] io-controller: Common hierarchical fair queuing code in elevaotor layer Vivek Goyal
2009-06-09 2:08 ` [PATCH 06/19] io-controller: cfq changes to use " Vivek Goyal
2009-06-09 2:08 ` [PATCH 07/19] io-controller: Export disk time used and nr sectors dipatched through cgroups Vivek Goyal
2009-06-09 2:08 ` [PATCH 08/19] io-controller: idle for sometime on sync queue before expiring it Vivek Goyal
2009-06-09 2:08 ` [PATCH 09/19] io-controller: Separate out queue and data Vivek Goyal
2009-06-09 2:08 ` [PATCH 10/19] io-conroller: Prepare elevator layer for single queue schedulers Vivek Goyal
2009-06-11 8:10 ` Gui Jianfeng
2009-06-11 14:41 ` Vivek Goyal
2009-06-12 0:37 ` Gui Jianfeng
2009-06-15 13:00 ` Vivek Goyal
2009-06-09 2:08 ` [PATCH 11/19] io-controller: noop changes for hierarchical fair queuing Vivek Goyal
2009-06-09 2:08 ` [PATCH 12/19] io-controller: deadline " Vivek Goyal
2009-06-09 2:08 ` [PATCH 13/19] io-controller: anticipatory " Vivek Goyal
2009-06-09 2:08 ` [PATCH 14/19] blkio_cgroup patches from Ryo to track async bios Vivek Goyal
2009-06-09 2:08 ` [PATCH 15/19] io-controller: map async requests to appropriate cgroup Vivek Goyal
2009-06-17 9:17 ` Gui Jianfeng
2009-06-17 13:00 ` Vivek Goyal
2009-06-09 2:08 ` [PATCH 16/19] io-controller: Per cgroup request descriptor support Vivek Goyal
2009-06-09 2:09 ` [PATCH 17/19] io-controller: Support per cgroup per device weights and io class Vivek Goyal
2009-06-10 7:44 ` Gui Jianfeng
2009-06-10 13:22 ` Vivek Goyal
2009-06-09 2:09 ` [PATCH 18/19] io-controller: Debug hierarchical IO scheduling Vivek Goyal
2009-06-19 1:40 ` Gui Jianfeng
2009-06-19 14:05 ` Vivek Goyal
2009-06-19 6:26 ` Gui Jianfeng
2009-06-19 14:08 ` Vivek Goyal
2009-06-09 2:09 ` [PATCH 19/19] io-controller: experimental debug patch for async queue wait before expiry Vivek Goyal
2009-06-09 4:22 ` [RFC] IO scheduler based IO controller V4 Gui Jianfeng
2009-06-09 13:52 ` Vivek Goyal
2009-06-10 1:05 ` Gui Jianfeng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A2E211A.3030303@cn.fujitsu.com \
--to=guijianfeng@cn.fujitsu.com \
--cc=agk@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=containers@lists.linux-foundation.org \
--cc=dhaval@linux.vnet.ibm.com \
--cc=dm-devel@redhat.com \
--cc=dpshah@google.com \
--cc=fchecconi@gmail.com \
--cc=fernando@oss.ntt.co.jp \
--cc=jbaron@redhat.com \
--cc=jens.axboe@oracle.com \
--cc=jmoyer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=m-ikeda@ds.jp.nec.com \
--cc=mikew@google.com \
--cc=nauman@google.com \
--cc=paolo.valente@unimore.it \
--cc=peterz@infradead.org \
--cc=righi.andrea@gmail.com \
--cc=ryov@valinux.co.jp \
--cc=s-uchida@ap.jp.nec.com \
--cc=snitzer@redhat.com \
--cc=taka@valinux.co.jp \
--cc=vgoyal@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox