From patchwork Thu Feb 13 07:39:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 11393607 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 930661892 for ; Thu, 20 Feb 2020 09:06:35 +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 5069E2465D for ; Thu, 20 Feb 2020 09:06:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DYUqhJyi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5069E2465D 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=1582189594; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=P4HlSIEKVz4VOH5+3mGmWv7UvaGX5tc/fOVbT0GJFXs=; b=DYUqhJyiUs5263qqvvGEghkreNr6FJz4O0Pxj/dOO0TxrereAPyDfu2y5OLFJ1krzPzaN+ XZejajmgctjCei27va754QXWX2NMAK/srXPuHzl74ro78N0GYMug+DnqKVj8VGXMSQymWI TGl9jMSOpeRzOfZb0Ub0/duvm/9HlOQ= 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-292-YHK6lgMVPHeeylE6G9Nwyw-1; Thu, 20 Feb 2020 04:06:31 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 369351007270; Thu, 20 Feb 2020 09:06:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D9791001920; Thu, 20 Feb 2020 09:06:22 +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 BB4FD8B2CC; Thu, 20 Feb 2020 09:06:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01D7dsXw017103 for ; Thu, 13 Feb 2020 02:39:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 890F111232F; Thu, 13 Feb 2020 07:39:54 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 84698112327 for ; Thu, 13 Feb 2020 07:39:49 +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 8E0608EFB21 for ; Thu, 13 Feb 2020 07:39:49 +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-282-1acXQO9LPgqOxzb4FNZT4g-1; Thu, 13 Feb 2020 02:39:46 -0500 Received: from [192.168.15.156] (helo=localhost.localdomain) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1j295d-0001TW-OE; Thu, 13 Feb 2020 10:39:13 +0300 From: Kirill Tkhai To: martin.petersen@oracle.com, bob.liu@oracle.com, axboe@kernel.dk, darrick.wong@oracle.com Date: Thu, 13 Feb 2020 10:39:13 +0300 Message-ID: <158157955322.111879.16371696985080169961.stgit@localhost.localdomain> In-Reply-To: <158157930219.111879.12072477040351921368.stgit@localhost.localdomain> References: <158157930219.111879.12072477040351921368.stgit@localhost.localdomain> User-Agent: StGit/0.19 MIME-Version: 1.0 X-MC-Unique: 1acXQO9LPgqOxzb4FNZT4g-1 X-MC-Unique: YHK6lgMVPHeeylE6G9Nwyw-1 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01D7dsXw017103 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Thu, 20 Feb 2020 04:05:51 -0500 Cc: andrea.parri@amarulasolutions.com, snitzer@redhat.com, dhowells@redhat.com, song@kernel.org, dm-devel@redhat.com, adilger.kernel@dilger.ca, osandov@fb.com, agk@redhat.com, hare@suse.com, bvanassche@acm.org, minwoo.im.dev@gmail.com, jthumshirn@suse.de, ajay.joshi@wdc.com, chaitanya.kulkarni@wdc.com, ming.lei@redhat.com, linux-block@vger.kernel.org, ktkhai@virtuozzo.com, dsterba@suse.com, sagi@grimberg.me, damien.lemoal@wdc.com, tytso@mit.edu, linux-kernel@vger.kernel.org, tj@kernel.org, asml.silence@gmail.com Subject: [dm-devel] [PATCH v7 2/6] 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.84 on 10.5.11.22 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 Reviewed-by: Bob Liu --- 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 089e890ab208..28a6d46eb982 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1221,10 +1221,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 1e3c08854b09..f4ec7ae214ab 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -988,8 +988,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); @@ -1028,10 +1030,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)