From patchwork Thu May 5 15:17:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 9025271 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E3E939F1C1 for ; Thu, 5 May 2016 15:17:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2316E20384 for ; Thu, 5 May 2016 15:17:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3887F2038D for ; Thu, 5 May 2016 15:17:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756808AbcEEPRW (ORCPT ); Thu, 5 May 2016 11:17:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:33846 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757429AbcEEPRV (ORCPT ); Thu, 5 May 2016 11:17:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id ECD29ADC0; Thu, 5 May 2016 15:17:18 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 7EC3F1E09EF; Thu, 5 May 2016 17:17:16 +0200 (CEST) From: Jan Kara To: Jens Axboe Cc: linux-block@vger.kernel.org, Jan Kara Subject: [PATCH 5/9] btt: Replace overlapping IO Date: Thu, 5 May 2016 17:17:08 +0200 Message-Id: <1462461432-1900-6-git-send-email-jack@suse.cz> X-Mailer: git-send-email 2.6.6 In-Reply-To: <1462461432-1900-1-git-send-email-jack@suse.cz> References: <1462461432-1900-1-git-send-email-jack@suse.cz> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently btt keeps the original IO in its RB-tree even if it sees new IO that is beginning at the same sector. However such IO most likely means that we have just lost the completion event for the IO that is still in the tree. So in such case replacing the IO in RB-tree makes more sense to avoid bogus IOs being reported as taking huge amount of time. Signed-off-by: Jan Kara --- btt/dip_rb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/btt/dip_rb.c b/btt/dip_rb.c index 867a97bd9997..2aa7ffcc763b 100644 --- a/btt/dip_rb.c +++ b/btt/dip_rb.c @@ -37,8 +37,10 @@ int rb_insert(struct rb_root *root, struct io *iop) p = &(*p)->rb_left; else if (s > __s) p = &(*p)->rb_right; - else - return 0; + else { + rb_replace_node(parent, &iop->rb_node, root); + return 1; + } } rb_link_node(&iop->rb_node, parent, p);