Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753681Ab0LFQJA (ORCPT ); Mon, 6 Dec 2010 11:09:00 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:37874 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751942Ab0LFQI5 (ORCPT ); Mon, 6 Dec 2010 11:08:57 -0500 MIME-Version: 1.0 In-Reply-To: <4CFCB08F.4010509@jp.fujitsu.com> References: <4CFCB08F.4010509@jp.fujitsu.com> From: Linus Torvalds Date: Mon, 6 Dec 2010 08:08:06 -0800 Message-ID: Subject: Re: [PATCH 1/2] Don't merge different partition's IOs To: Yasuaki Ishimatsu Cc: jaxboe@fusionio.com, vgoyal@redhat.com, jmarchan@redhat.com, linux-kernel@vger.kernel.org Content-Type: multipart/mixed; boundary=001485eba1e823a9db0496c019cb Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5224 Lines: 92 --001485eba1e823a9db0496c019cb Content-Type: text/plain; charset=ISO-8859-1 2010/12/6 Yasuaki Ishimatsu : > > The problem is caused by merging different partition's I/Os. So the patch > check whether a merging bio or request is a same partition as a request or not > by using a partition's start sector and size. I really think this is wrong. We should just carry the partition information around in the req and the bio, and just compare the pointers, rather than compare the range. No need to even dereference the pointers, you should be able to just do /* don't merge if not on the same partition */ if (bio->part != req->part) return 0; or something. This is doubly true since the accounting already does that horrible partition lookup: rather than look it up, we should just _set_ it in __generic_make_request(), where I think we already know it since we do that whole blk_partition_remap(). So just something like the appended (TOTALLY UNTESTED) perhaps? Note that this should get it right even for overlapping partitions etc. Linus --001485eba1e823a9db0496c019cb Content-Type: text/x-patch; charset=US-ASCII; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ghdk1p780 IGJsb2NrL2Jsay1jb3JlLmMgICAgICAgICAgfCAgICAyICsrCiBibG9jay9ib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XYuaAorKysgYi9p bmNsdWRlL2xpbnV4L2Jsa2Rldi5oCkBAIC0xMTQsNiArMTE0LDcgQEAgc3RydWN0IHJlcXVlc3Qg ewogCXZvaWQgKmVsZXZhdG9yX3ByaXZhdGUyOwogCXZvaWQgKmVsZXZhdG9yX3ByaXZhdGUzOwog CisJc3RydWN0IGJsb2NrX2RldmljZSAqcnFfcGFydDsKIAlzdHJ1Y3QgZ2VuZGlzayAqcnFfZGlz azsKIAl1bnNpZ25lZCBsb25nIHN0YXJ0X3RpbWU7CiAjaWZkZWYgQ09ORklHX0JMS19DR1JPVVAK --001485eba1e823a9db0496c019cb-- -- 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/