Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4693261ybl; Wed, 22 Jan 2020 03:00:41 -0800 (PST) X-Google-Smtp-Source: APXvYqxGGKUQtSMQn43s/WKBRpCyAZD0HrqwJNRf5qyXoo7fUGN9ivRSwlLBsEqOoHpFI43tdGuu X-Received: by 2002:aca:e106:: with SMTP id y6mr6483285oig.131.1579690841309; Wed, 22 Jan 2020 03:00:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579690841; cv=none; d=google.com; s=arc-20160816; b=NYUf8cDqFa2OGdrhoxCX1hP/X3v6S2XamY/Bll38w+WT6t2EG3yKMRljx4qRZihtKr 1j5UMp6Xlpi4+lDH0I98Z8F4qWZC6l4dNQjd8wu3wBLkvY3Mlf1+Px/satxZJHRjCoLs d2C24vV2jf34oF0VFWToiYW+oDjHJMYTEF3NioSjS+HelLQgdupoIpwaF12x10+4RgUx FVylgIhPyRBRwj7KxyMNl4opJZCI0yJNwJIu5aVhbLUAEgGw83R+/B1EYIBEkL1Lq0DT tntMtBuflXATYGALbAXf0Hd6ifRcXezqWKNDzwm504L0m+a/yU3LrdD5VtrhBXgxZeqY BJMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject; bh=eHtse4bgWCILp9WsfMrBylUPTDwopjbnDqK2M4AnR3k=; b=hqyVNgMO5Wu7TccvHJLvNZpoYtRynUupUq7Qg6GL+ze34MiL839B0u8NJ1FB4gRI21 VZjUGcjdsL1eVmbp6wvCbaTZwC9XO2lmSjx+hVExqUYPMmK7RuCHkcBKCru0rnnedFlv 04pnpmpaNOb8t7bdHIDRmd/HJ8a2ur0+HeTzYwzg0DS6RTlJUBhLEqu+dX3H0iMfezeW c0iWyChfftzLrV7xFMUwIyYryYuLS6oJzhWwvjTsPXvc82vsNi/2dnf7nbM9wcrte/VM O+z69xZP1yMrlYWaoIHADiXUMQD+SRX+KkoZ8FqtFmHzHRredtAcHfMRO7VyAFaM98aI LVEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2si20816309ois.221.2020.01.22.03.00.26; Wed, 22 Jan 2020 03:00:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729074AbgAVK63 (ORCPT + 99 others); Wed, 22 Jan 2020 05:58:29 -0500 Received: from relay.sw.ru ([185.231.240.75]:49990 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728733AbgAVK62 (ORCPT ); Wed, 22 Jan 2020 05:58:28 -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 1iuDhz-0002gT-4b; Wed, 22 Jan 2020 13:58:03 +0300 Subject: [PATCH v5 2/6] block: Pass op_flags into blk_queue_get_max_sectors() 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: Wed, 22 Jan 2020 13:58:03 +0300 Message-ID: <157969068296.174869.13461609442947913096.stgit@localhost.localdomain> In-Reply-To: <157968992539.174869.7490844754165043549.stgit@localhost.localdomain> References: <157968992539.174869.7490844754165043549.stgit@localhost.localdomain> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) 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)