From patchwork Fri Oct 19 09:24:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "jianchao.wang" X-Patchwork-Id: 10648911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 581B3157A for ; Fri, 19 Oct 2018 09:22:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4715F287D5 for ; Fri, 19 Oct 2018 09:22:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3ABC228A46; Fri, 19 Oct 2018 09:22:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3B6F287D5 for ; Fri, 19 Oct 2018 09:22:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727215AbeJSR1z (ORCPT ); Fri, 19 Oct 2018 13:27:55 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:54156 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727227AbeJSR1z (ORCPT ); Fri, 19 Oct 2018 13:27:55 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9J9JQ8p187685; Fri, 19 Oct 2018 09:22:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2018-07-02; bh=elVnaE5MJgkuZBx44YoTIEIMQxUMI9tISOx6nAl3fSo=; b=FPKolBfqbIS2dWRDbg3KJK0Z5/GaqM3mJb6APWBvQNIeHbMAjzWeEhpoWReIyajuH1ln qz2VtSie4TkX1VoomT6zVPilsqPtciGx2cMzszGauxihIn7nFUOZUY/I9MYfC0AUt2Mm Sm1njEqth8TwsHmEryGD5xfmNrUgMVqTLCHsFF63h0UNC/kI7/CwlsmKY0zIQIi8iSQq nJAF2KUXpDhIwbpxPOKLprVG7F7iXFDbTDs1tTgmpFhI2oR5ZjgBEtQGSqRxhJ5R9nTN bl8Hm6H1+M8SApEOJ9qFgKSekhqElFxZBXy5/pmdRIXjHBPOXtgrsZL6vXE1yUXLAHuE LA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2n38nqk200-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Oct 2018 09:22:38 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9J9Mbc0015894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Oct 2018 09:22:38 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9J9Mbch009727; Fri, 19 Oct 2018 09:22:37 GMT Received: from will-ThinkCentre-M910s.cn.oracle.com (/10.182.70.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 19 Oct 2018 02:22:36 -0700 From: Jianchao Wang To: axboe@kernel.dk Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] block: don't check position contiguity for DISCARD in attempt_merge Date: Fri, 19 Oct 2018 17:24:53 +0800 Message-Id: <1539941093-32058-1-git-send-email-jianchao.w.wang@oracle.com> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9050 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=937 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810190085 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Discard command supports multiple ranges of blocks, so needn't checking position contiguity when merging. Let's do the same thing in attempt_merge as the blk_try_merge. Signed-off-by: Jianchao Wang Reviewed-by: Ming Lei --- block/blk-merge.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 42a4674..c94749b 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -732,9 +732,10 @@ static struct request *attempt_merge(struct request_queue *q, return NULL; /* - * not contiguous + * not contiguous, except for DISCARD */ - if (blk_rq_pos(req) + blk_rq_sectors(req) != blk_rq_pos(next)) + if ((req_op(req) != REQ_OP_DISCARD) && + (blk_rq_pos(req) + blk_rq_sectors(req) != blk_rq_pos(next))) return NULL; if (rq_data_dir(req) != rq_data_dir(next)