From patchwork Tue Jan 21 10:18:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 11345195 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C81B417EF for ; Wed, 22 Jan 2020 08:21:27 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 85C5624656 for ; Wed, 22 Jan 2020 08:21:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EeUarBae" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85C5624656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579681286; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=83Lt/5YSxb5uC5j1FtXQKE+sCx048YV6DfNMh8gtvSQ=; b=EeUarBaefh2A4qSbCvFotqvtS49tZCMPl2bZymlrFxd/cnvFKlFnGhqMT02o8Ma1wEqSKy sYHBerZdhYq9A6gQbZsH25EnF/607Dx2Rm/JvQEiNBMTBYxgYohFFDJE/1BIExeceEhhMH 6u+3JAgT9RPKCM2v3M13TOn4+opu+TU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-82-vKs0EUArNiiUHG1vLAkfUg-1; Wed, 22 Jan 2020 03:21:24 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE7AD800D4E; Wed, 22 Jan 2020 08:21:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BB6848CCC9; Wed, 22 Jan 2020 08:21:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7AEA618089D0; Wed, 22 Jan 2020 08:21:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00LAJMhD004402 for ; Tue, 21 Jan 2020 05:19:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0723D202DDEA; Tue, 21 Jan 2020 10:19:22 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 026F12093CE3 for ; Tue, 21 Jan 2020 10:19:19 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8DA2A800A1B for ; Tue, 21 Jan 2020 10:19:19 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-398-owbdi_1UNlWMbgEEQxuxow-1; Tue, 21 Jan 2020 05:19:14 -0500 Received: from dhcp-172-16-24-104.sw.ru ([172.16.24.104] helo=localhost.localdomain) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1itqcU-00068K-L5; Tue, 21 Jan 2020 13:18:50 +0300 From: Kirill Tkhai To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, martin.petersen@oracle.com, bob.liu@oracle.com, axboe@kernel.dk, agk@redhat.com, snitzer@redhat.com, dm-devel@redhat.com, song@kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, Chaitanya.Kulkarni@wdc.com, darrick.wong@oracle.com, ming.lei@redhat.com, osandov@fb.com, jthumshirn@suse.de, minwoo.im.dev@gmail.com, damien.lemoal@wdc.com, andrea.parri@amarulasolutions.com, hare@suse.com, tj@kernel.org, ajay.joshi@wdc.com, sagi@grimberg.me, dsterba@suse.com, chaitanya.kulkarni@wdc.com, bvanassche@acm.org, dhowells@redhat.com, asml.silence@gmail.com, ktkhai@virtuozzo.com Date: Tue, 21 Jan 2020 13:18:50 +0300 Message-ID: <157960193056.97730.5556479428398013001.stgit@localhost.localdomain> In-Reply-To: <157960153921.97730.9973412459876396302.stgit@localhost.localdomain> References: <157960153921.97730.9973412459876396302.stgit@localhost.localdomain> User-Agent: StGit/0.19 MIME-Version: 1.0 X-MC-Unique: owbdi_1UNlWMbgEEQxuxow-1 X-MC-Unique: vKs0EUArNiiUHG1vLAkfUg-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 00LAJMhD004402 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Wed, 22 Jan 2020 03:20:59 -0500 Subject: [dm-devel] [PATCH v3 2/7] block: Pass op_flags into blk_queue_get_max_sectors() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com This preparation patch changes argument type, and now the function takes full op_flags instead of just op code. Signed-off-by: Kirill Tkhai --- block/blk-core.c | 4 ++-- include/linux/blkdev.h | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/block/blk-core.c b/block/blk-core.c index 50a5de025d5e..ac2634bcda1f 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1250,10 +1250,10 @@ EXPORT_SYMBOL(submit_bio); static int blk_cloned_rq_check_limits(struct request_queue *q, struct request *rq) { - if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, req_op(rq))) { + if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, rq->cmd_flags)) { printk(KERN_ERR "%s: over max size limit. (%u > %u)\n", __func__, blk_rq_sectors(rq), - blk_queue_get_max_sectors(q, req_op(rq))); + blk_queue_get_max_sectors(q, rq->cmd_flags)); return -EIO; } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0f1127d0b043..23a5850f35f6 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -989,8 +989,10 @@ static inline struct bio_vec req_bvec(struct request *rq) } static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q, - int op) + unsigned int op_flags) { + int op = op_flags & REQ_OP_MASK; + if (unlikely(op == REQ_OP_DISCARD || op == REQ_OP_SECURE_ERASE)) return min(q->limits.max_discard_sectors, UINT_MAX >> SECTOR_SHIFT); @@ -1029,10 +1031,10 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq, if (!q->limits.chunk_sectors || req_op(rq) == REQ_OP_DISCARD || req_op(rq) == REQ_OP_SECURE_ERASE) - return blk_queue_get_max_sectors(q, req_op(rq)); + return blk_queue_get_max_sectors(q, rq->cmd_flags); return min(blk_max_size_offset(q, offset), - blk_queue_get_max_sectors(q, req_op(rq))); + blk_queue_get_max_sectors(q, rq->cmd_flags)); } static inline unsigned int blk_rq_count_bios(struct request *rq)