From patchwork Fri Jan 13 15:17:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 9515857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 953616077E for ; Fri, 13 Jan 2017 15:24:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 884A0286C3 for ; Fri, 13 Jan 2017 15:24:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A648286D6; Fri, 13 Jan 2017 15:24:12 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 30EDC286C3 for ; Fri, 13 Jan 2017 15:24:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752166AbdAMPX4 (ORCPT ); Fri, 13 Jan 2017 10:23:56 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36825 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752142AbdAMPXy (ORCPT ); Fri, 13 Jan 2017 10:23:54 -0500 Received: by mail-pf0-f196.google.com with SMTP id b22so8799709pfd.3; Fri, 13 Jan 2017 07:23:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=cLTEyFQZ0eikuFNG1ylNW+WxzO7NGJbslLcA+OHGIK8=; b=kvRG48TOxcAMehwqiUUJRwIrr/IA/RnuUifcWk9ph4uufefl4FUCQByypbx8gwabFG bjur/AmMdHn29PNXO91P7CYwCEWpp0k8N2+/yLjjyiCypnil1os02ksQNsPNZEXw/Og+ /UTEOdgNVMgcRGuW17SKTk94v6fN48pcDryyNcNUkNhgrV9SvN2QE8QxHKOldJyXNRp9 V+aH8ATQKcUs/DHh0M4K8d8NZfOe0KM2PqhtfZu1cyCBSUu0Kh1y42PYe3NHqXiXEfyB 75UMSiLkLYEXnSimk20LkUimzX9xaGNlZ1uZz3WlbyyDCrEyOCmC4MyAEJaLi2m0U2n4 Wc8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=cLTEyFQZ0eikuFNG1ylNW+WxzO7NGJbslLcA+OHGIK8=; b=PACTtoGJvmw4uiaoSxW8N+dkhsF4JDClMm2t1XjdFplle2vKmdY06THMiI8wKmePX6 KuEqmIMeoDdBKzJeTch5IkmwPReDD0XxylvACskHX3BuQzX0luTqkNozQuoe5pb335kV 2jpEE7qOgjFAPtWAW31gSStYD8esXowuPhtmPuhnb4YPdD25eL9HmSayO03eHaL40hG9 KDKeLBAFDH6ysL2dD41diB1IEFRxeke6d3GEj524K+CQ7Q9jtLowiAd/mEdgKSQTFl8V psuKasR1RzY7oZEg5kCN8lOU/09lsAeQJrAZmcoKLU4qABQcPbwvfYRnPMaba6VypjcV c/ng== X-Gm-Message-State: AIkVDXKbewlnWuK0ma695TP984YaPplidG64i8mKiVY7HPD3AyUHxmYLF2V2VzFNASEXUg== X-Received: by 10.98.218.9 with SMTP id c9mr21862574pfh.99.1484320639782; Fri, 13 Jan 2017 07:17:19 -0800 (PST) Received: from localhost (li411-102.members.linode.com. [106.187.91.102]) by smtp.gmail.com with ESMTPSA id c22sm30282616pgn.12.2017.01.13.07.17.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Jan 2017 07:17:19 -0800 (PST) From: Geliang Tang To: Jens Axboe Cc: Geliang Tang , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] block: use list_entry_rq Date: Fri, 13 Jan 2017 23:17:10 +0800 Message-Id: <5b23d0cb523f4719673a462ab1569ae99084337e.1483685419.git.geliangtang@gmail.com> X-Mailer: git-send-email 2.9.3 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 Use list_entry_rq() instead of open-coding it. Signed-off-by: Geliang Tang --- block/blk-core.c | 4 ++-- block/blk-mq.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 61ba08c..3c254d9 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -3148,8 +3148,8 @@ EXPORT_SYMBOL(blk_start_plug); static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b) { - struct request *rqa = container_of(a, struct request, queuelist); - struct request *rqb = container_of(b, struct request, queuelist); + struct request *rqa = list_entry_rq(a); + struct request *rqb = list_entry_rq(b); return !(rqa->q < rqb->q || (rqa->q == rqb->q && blk_rq_pos(rqa) < blk_rq_pos(rqb))); diff --git a/block/blk-mq.c b/block/blk-mq.c index a8e67a1..e24b881 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -553,7 +553,7 @@ static void blk_mq_requeue_work(struct work_struct *work) } while (!list_empty(&rq_list)) { - rq = list_entry(rq_list.next, struct request, queuelist); + rq = list_entry_rq(rq_list.next); list_del_init(&rq->queuelist); blk_mq_insert_request(rq, false, false, false); } @@ -1192,8 +1192,8 @@ static void blk_mq_insert_requests(struct request_queue *q, static int plug_ctx_cmp(void *priv, struct list_head *a, struct list_head *b) { - struct request *rqa = container_of(a, struct request, queuelist); - struct request *rqb = container_of(b, struct request, queuelist); + struct request *rqa = list_entry_rq(a); + struct request *rqb = list_entry_rq(b); return !(rqa->mq_ctx < rqb->mq_ctx || (rqa->mq_ctx == rqb->mq_ctx &&