Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933925AbbELVqd (ORCPT ); Tue, 12 May 2015 17:46:33 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:65469 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754263AbbELVqa (ORCPT ); Tue, 12 May 2015 17:46:30 -0400 From: Shaohua Li To: CC: Subject: [PATCH] blk: don't account discard request size Date: Tue, 12 May 2015 14:46:27 -0700 Message-ID: <10cba6675b3e93f28b9c1c7a21e4b93b923e9531.1431467011.git.shli@fb.com> X-Mailer: git-send-email 1.8.1 X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-05-12_08:2015-05-12,2015-05-12,1970-01-01 signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1113 Lines: 34 In a workload with discard request, the IO throughput is generally much higher than expected. This is quite confusing checking iostat. Discard request doesn't really write data to drive, so don't account it. Signed-off-by: Shaohua Li --- block/blk-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index fd154b9..0128d18 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -2138,7 +2138,11 @@ EXPORT_SYMBOL_GPL(blk_rq_err_bytes); void blk_account_io_completion(struct request *req, unsigned int bytes) { - if (blk_do_io_stat(req)) { + /* + * discard request doesn't really write @bytes to drive, + * doesn't account it + **/ + if (blk_do_io_stat(req) && !(req->cmd_flags & REQ_DISCARD)) { const int rw = rq_data_dir(req); struct hd_struct *part; int cpu; -- 1.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/