* + diskstats-fix-discard-request-accounting.patch added to -mm tree
@ 2009-04-23 20:13 akpm
[not found] ` <20090423140448.c2d34fb8.akpm@linux-foundation.org>
0 siblings, 1 reply; 5+ messages in thread
From: akpm @ 2009-04-23 20:13 UTC (permalink / raw)
To: mm-commits; +Cc: knikanth, dwmw2, jens.axboe
The patch titled
diskstats: fix discard request accounting
has been added to the -mm tree. Its filename is
diskstats-fix-discard-request-accounting.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: diskstats: fix discard request accounting
From: Nikanth Karthikesan <knikanth@suse.de>
When 2 discard requests are merged, the stats gets updated, but we do not
update statistics normally when a discard request is issued or completed.
For example the in_flight counter would be decremented when 2 discard
requests are merged, but it was not at all incremented when they were
issued, and in_flight counter will not be decremented, when they are
completed as well.
This patch fixes this by adding discard requests to the statistics.
Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
block/blk-core.c | 4 ++--
include/linux/blkdev.h | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff -puN block/blk-core.c~diskstats-fix-discard-request-accounting block/blk-core.c
--- a/block/blk-core.c~diskstats-fix-discard-request-accounting
+++ a/block/blk-core.c
@@ -68,7 +68,7 @@ static void drive_stat_acct(struct reque
int rw = rq_data_dir(rq);
int cpu;
- if (!blk_fs_request(rq) || !blk_do_io_stat(rq))
+ if (!rq_accountable(rq) || !blk_do_io_stat(rq))
return;
cpu = part_stat_lock();
@@ -1700,7 +1700,7 @@ static void blk_account_io_done(struct r
* IO on queueing nor completion. Accounting the containing
* request is enough.
*/
- if (blk_fs_request(req) && req != &req->q->bar_rq) {
+ if (rq_accountable(req) && req != &req->q->bar_rq) {
unsigned long duration = jiffies - req->start_time;
const int rw = rq_data_dir(req);
struct hd_struct *part;
diff -puN include/linux/blkdev.h~diskstats-fix-discard-request-accounting include/linux/blkdev.h
--- a/include/linux/blkdev.h~diskstats-fix-discard-request-accounting
+++ a/include/linux/blkdev.h
@@ -670,7 +670,9 @@ static inline void blk_clear_queue_full(
(REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
#define rq_mergeable(rq) \
(!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
- (blk_discard_rq(rq) || blk_fs_request((rq))))
+ (blk_discard_rq(rq) || blk_fs_request(rq)))
+#define rq_accountable(rq) \
+ (blk_discard_rq(rq) || blk_fs_request(rq))
/*
* q->prep_rq_fn return values
_
Patches currently in -mm which might be from knikanth@suse.de are
linux-next.patch
diskstats-fix-discard-request-accounting.patch
block-turn-some-buggy-macros-into-c-functions.patch
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <20090423140448.c2d34fb8.akpm@linux-foundation.org>]
[parent not found: <20090424051612.GT4593@kernel.dk>]
* [PATCH linux-2.6-block/for-linus] Fix discard requests accounting in the diskstats [not found] ` <20090424051612.GT4593@kernel.dk> @ 2009-04-24 5:48 ` Nikanth Karthikesan 2009-04-24 6:15 ` Jens Axboe 0 siblings, 1 reply; 5+ messages in thread From: Nikanth Karthikesan @ 2009-04-24 5:48 UTC (permalink / raw) To: Jens Axboe; +Cc: Andrew Morton, dwmw2, linux-kernel When 2 discard requests are merged, the stats gets updated, but we do not update statistics normally when a discard request is issued or completed. For example the in_flight counter would be decremented when 2 discard requests are merged, but it was not at all incremented when they were issued, and in_flight counter will not be decremented, when they are completed as well. This patch fixes this by adding discard requests to the statistics. Signed-off-by: Nikanth Karthikesan <knikanth@suse.de> --- diff --git a/block/blk-core.c b/block/blk-core.c index 2998fe3..0175b9f 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -68,7 +68,7 @@ static void drive_stat_acct(struct request *rq, int new_io) int rw = rq_data_dir(rq); int cpu; - if (!blk_fs_request(rq) || !blk_do_io_stat(rq)) + if (!rq_accountable(rq) || !blk_do_io_stat(rq)) return; cpu = part_stat_lock(); @@ -1700,7 +1700,7 @@ static void blk_account_io_done(struct request *req) * IO on queueing nor completion. Accounting the containing * request is enough. */ - if (blk_fs_request(req) && req != &req->q->bar_rq) { + if (rq_accountable(req) && req != &req->q->bar_rq) { unsigned long duration = jiffies - req->start_time; const int rw = rq_data_dir(req); struct hd_struct *part; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 2755d5c..a54d3ba 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -670,7 +670,9 @@ static inline void blk_clear_queue_full(struct request_queue *q, int sync) (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) #define rq_mergeable(rq) \ (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ - (blk_discard_rq(rq) || blk_fs_request((rq)))) + (blk_discard_rq(rq) || blk_fs_request(rq))) +#define rq_accountable(rq) \ + (blk_discard_rq(rq) || blk_fs_request(rq)) /* * q->prep_rq_fn return values ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH linux-2.6-block/for-linus] Fix discard requests accounting in the diskstats 2009-04-24 5:48 ` [PATCH linux-2.6-block/for-linus] Fix discard requests accounting in the diskstats Nikanth Karthikesan @ 2009-04-24 6:15 ` Jens Axboe 2009-04-24 7:38 ` Nikanth Karthikesan 0 siblings, 1 reply; 5+ messages in thread From: Jens Axboe @ 2009-04-24 6:15 UTC (permalink / raw) To: Nikanth Karthikesan; +Cc: Andrew Morton, dwmw2, linux-kernel On Fri, Apr 24 2009, Nikanth Karthikesan wrote: > When 2 discard requests are merged, the stats gets updated, but we do not > update statistics normally when a discard request is issued or completed. For > example the in_flight counter would be decremented when 2 discard requests are > merged, but it was not at all incremented when they were issued, and in_flight > counter will not be decremented, when they are completed as well. > > This patch fixes this by adding discard requests to the statistics. > > Signed-off-by: Nikanth Karthikesan <knikanth@suse.de> OK, so that's not quite what I had in mind. If we first do this as a preparatory patch: http://git.kernel.dk/?p=linux-2.6-block.git;a=commit;h=42fd769da4edadad83a779867ff1910ec35c6de7 then the discard fix becomes this one-liner: http://git.kernel.dk/?p=linux-2.6-block.git;a=commit;h=999ae79ae7f853bb9e60e95753ebf8d1628e632a -- Jens Axboe ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH linux-2.6-block/for-linus] Fix discard requests accounting in the diskstats 2009-04-24 6:15 ` Jens Axboe @ 2009-04-24 7:38 ` Nikanth Karthikesan 2009-04-24 7:43 ` Jens Axboe 0 siblings, 1 reply; 5+ messages in thread From: Nikanth Karthikesan @ 2009-04-24 7:38 UTC (permalink / raw) To: Jens Axboe; +Cc: Andrew Morton, dwmw2, linux-kernel On Friday 24 April 2009 11:45:18 Jens Axboe wrote: > On Fri, Apr 24 2009, Nikanth Karthikesan wrote: > > When 2 discard requests are merged, the stats gets updated, but we do not > > update statistics normally when a discard request is issued or completed. > > For example the in_flight counter would be decremented when 2 discard > > requests are merged, but it was not at all incremented when they were > > issued, and in_flight counter will not be decremented, when they are > > completed as well. > > > > This patch fixes this by adding discard requests to the statistics. > > > > Signed-off-by: Nikanth Karthikesan <knikanth@suse.de> > > OK, so that's not quite what I had in mind. If we first do this as a > preparatory patch: > > http://git.kernel.dk/?p=linux-2.6-block.git;a=commit;h=42fd769da4edadad83a7 >79867ff1910ec35c6de7 > Oh! I thought this cleanup along with the block-turn-some-buggy-macros-into-c-functions.patch from Andrew could be done on top of my original fix. But didn't, as you said, you would do it. Anyway, Thanks. > then the discard fix becomes this one-liner: > > http://git.kernel.dk/?p=linux-2.6-block.git;a=commit;h=999ae79ae7f853bb9e60 >e95753ebf8d1628e632a Thanks Nikanth ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH linux-2.6-block/for-linus] Fix discard requests accounting in the diskstats 2009-04-24 7:38 ` Nikanth Karthikesan @ 2009-04-24 7:43 ` Jens Axboe 0 siblings, 0 replies; 5+ messages in thread From: Jens Axboe @ 2009-04-24 7:43 UTC (permalink / raw) To: Nikanth Karthikesan; +Cc: Andrew Morton, dwmw2, linux-kernel On Fri, Apr 24 2009, Nikanth Karthikesan wrote: > On Friday 24 April 2009 11:45:18 Jens Axboe wrote: > > On Fri, Apr 24 2009, Nikanth Karthikesan wrote: > > > When 2 discard requests are merged, the stats gets updated, but we do not > > > update statistics normally when a discard request is issued or completed. > > > For example the in_flight counter would be decremented when 2 discard > > > requests are merged, but it was not at all incremented when they were > > > issued, and in_flight counter will not be decremented, when they are > > > completed as well. > > > > > > This patch fixes this by adding discard requests to the statistics. > > > > > > Signed-off-by: Nikanth Karthikesan <knikanth@suse.de> > > > > OK, so that's not quite what I had in mind. If we first do this as a > > preparatory patch: > > > > http://git.kernel.dk/?p=linux-2.6-block.git;a=commit;h=42fd769da4edadad83a7 > >79867ff1910ec35c6de7 > > > > Oh! I thought this cleanup along with the > block-turn-some-buggy-macros-into-c-functions.patch from Andrew could be done > on top of my original fix. But didn't, as you said, you would do it. Anyway, > Thanks. Refactor and then fix is the cleanest I think. Anyway, queued up for 2.6.31! -- Jens Axboe ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-04-24 7:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-23 20:13 + diskstats-fix-discard-request-accounting.patch added to -mm tree akpm
[not found] ` <20090423140448.c2d34fb8.akpm@linux-foundation.org>
[not found] ` <20090424051612.GT4593@kernel.dk>
2009-04-24 5:48 ` [PATCH linux-2.6-block/for-linus] Fix discard requests accounting in the diskstats Nikanth Karthikesan
2009-04-24 6:15 ` Jens Axboe
2009-04-24 7:38 ` Nikanth Karthikesan
2009-04-24 7:43 ` Jens Axboe
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.