Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1231021ybl; Fri, 24 Jan 2020 18:41:45 -0800 (PST) X-Google-Smtp-Source: APXvYqwo8ZHrZ5r3X5GTxhPKbTQKhwCvXRDrwed3bRyqkv9uTI3gNPU3yuYInsNWFb9b3QseEggs X-Received: by 2002:a05:6830:109a:: with SMTP id y26mr4715067oto.227.1579920105076; Fri, 24 Jan 2020 18:41:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579920105; cv=none; d=google.com; s=arc-20160816; b=vjQb6QhAYbCoGK8rvKI9iklvMPEJNZi5r5ZPRB+1EZ7a2zFo18rpYEq8cCN8dZ7W35 QIyylpi8NR/NirLG3I0zzXNV0BZM3lZEuEQPRQsUyT2XyCTE1izzBGB7XJ6u1T4ufgPP nOyZwOIMk/b0EPgyKVOBCP5fAB+l5ff6hFtPJ/5ug0B+7q67/nMbHpXGT6ePp1jUm9D+ mOHD9uIjXYXnQ41jnXlZOTOCjRQ0rNRqCaDntjqMwA6Z98eP3kTjrRD4d7jUaR15ov5N JL5hUZF9ERkT2DDdMuDU8wuNDRwXy/ph2o00hRhGC+nSgyafxjUTHB5LOdUpa5rtuv+d lo/g== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=dLhPPXFZ1NX+iTt0fiqbRMwm/CK4E4mRxRFzcuVz7P8=; b=R1PEpI4fI9wt4X9YSSiqjgunLO0iG/YKdHJ6ecuWi6jrUKqSRKgAdWhahGgBFNd8Zr SGioY87KZ/fs8sxuS3GPUWvnpWl6Jx8B+Y0IYkETaKE8cBqroR+S1fXb55TGUDH3aGQa gHlyoFGNhE7WjThQlHiHga5PxfOQz5r7grAjnkRygxk85ZHjSyQzod2mpEjUab6zCXX/ lpRoiVbJIjgj7gD9E8+D7NU0ylebW8GdcrPf0eQX1xsPx9nM28FM8oIaqm0ScKLNHk0Z XYfkjvagKfLvh7yXjWZbMXR4kqC4ROer2CA0zHWZ/PdBQpdiyrfAtaXZC1d60TRSxvoC qNBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=HdpPF3gP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si910140otp.57.2020.01.24.18.41.32; Fri, 24 Jan 2020 18:41:45 -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; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=HdpPF3gP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387739AbgAYCiw (ORCPT + 99 others); Fri, 24 Jan 2020 21:38:52 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:38050 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387675AbgAYCiv (ORCPT ); Fri, 24 Jan 2020 21:38:51 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00P2YD8j008807; Sat, 25 Jan 2020 02:38:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=dLhPPXFZ1NX+iTt0fiqbRMwm/CK4E4mRxRFzcuVz7P8=; b=HdpPF3gPTNNzkIiKb1TUu/p4gdOXu48gXDI01GmUwCtKiCJLUEWSefKBMG5UHx3h9z2T XoFBAiBwZ8YIx/FpNHOar/YoQnul38nEF/Ob66qpu91mt9duu7J3j5j9zH0Eg4BJWZdi CbsdPCGD4JOpof+QXEX+gb1/Zi8I4tRwM+Xcln0Q5o8aB8svsgmrkJc0k0MG6gWlz8Fm MfdOjkmwXfdbcK8FctbrvsTF+N/cvV7ojQ+MWL7QXodzqU/ULQ+aCPSqGXyPMy7tFSuo N6LJMBUY2VpYa8cJzlEtp1Tc0cEx+IGcBY9ERkeTkgXYLIqFsGNpqupkrcX+l3qN5hDR Ig== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 2xksyqva0q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 25 Jan 2020 02:38:20 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00P2XZNe005587; Sat, 25 Jan 2020 02:38:20 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 2xratapu48-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 25 Jan 2020 02:38:19 +0000 Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 00P2cGeB013620; Sat, 25 Jan 2020 02:38:16 GMT Received: from [192.168.0.110] (/39.176.206.183) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 24 Jan 2020 18:38:16 -0800 Subject: Re: [PATCH v5 3/6] block: Introduce blk_queue_get_max_write_zeroes_sectors() To: Kirill Tkhai , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, martin.petersen@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, bvanassche@acm.org, dhowells@redhat.com, asml.silence@gmail.com References: <157968992539.174869.7490844754165043549.stgit@localhost.localdomain> <157969068832.174869.10818825289800365633.stgit@localhost.localdomain> From: Bob Liu Message-ID: Date: Sat, 25 Jan 2020 10:38:00 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <157969068832.174869.10818825289800365633.stgit@localhost.localdomain> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9510 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001250021 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9510 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001250021 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/22/20 6:58 PM, Kirill Tkhai wrote: > This introduces a new primitive, which returns max sectors > for REQ_OP_WRITE_ZEROES operation. > @op_flags is unused now, and it will be enabled in next patch. > > Signed-off-by: Kirill Tkhai > --- > block/blk-core.c | 2 +- > block/blk-merge.c | 9 ++++++--- > include/linux/blkdev.h | 8 +++++++- > 3 files changed, 14 insertions(+), 5 deletions(-) > Reviewed-by: Bob Liu > diff --git a/block/blk-core.c b/block/blk-core.c > index ac2634bcda1f..2edcd55624f1 100644 > --- a/block/blk-core.c > +++ b/block/blk-core.c > @@ -978,7 +978,7 @@ generic_make_request_checks(struct bio *bio) > goto not_supported; > break; > case REQ_OP_WRITE_ZEROES: > - if (!q->limits.max_write_zeroes_sectors) > + if (!blk_queue_get_max_write_zeroes_sectors(q, bio->bi_opf)) > goto not_supported; > break; > default: > diff --git a/block/blk-merge.c b/block/blk-merge.c > index 1534ed736363..467b292bc6e8 100644 > --- a/block/blk-merge.c > +++ b/block/blk-merge.c > @@ -105,15 +105,18 @@ static struct bio *blk_bio_discard_split(struct request_queue *q, > static struct bio *blk_bio_write_zeroes_split(struct request_queue *q, > struct bio *bio, struct bio_set *bs, unsigned *nsegs) > { > + unsigned int max_sectors; > + > + max_sectors = blk_queue_get_max_write_zeroes_sectors(q, bio->bi_opf); > *nsegs = 0; > > - if (!q->limits.max_write_zeroes_sectors) > + if (!max_sectors) > return NULL; > > - if (bio_sectors(bio) <= q->limits.max_write_zeroes_sectors) > + if (bio_sectors(bio) <= max_sectors) > return NULL; > > - return bio_split(bio, q->limits.max_write_zeroes_sectors, GFP_NOIO, bs); > + return bio_split(bio, max_sectors, GFP_NOIO, bs); > } > > static struct bio *blk_bio_write_same_split(struct request_queue *q, > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index 23a5850f35f6..264202fa3bf8 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -988,6 +988,12 @@ static inline struct bio_vec req_bvec(struct request *rq) > return mp_bvec_iter_bvec(rq->bio->bi_io_vec, rq->bio->bi_iter); > } > > +static inline unsigned int blk_queue_get_max_write_zeroes_sectors( > + struct request_queue *q, unsigned int op_flags) > +{ > + return q->limits.max_write_zeroes_sectors; > +} > + > static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q, > unsigned int op_flags) > { > @@ -1001,7 +1007,7 @@ static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q, > return q->limits.max_write_same_sectors; > > if (unlikely(op == REQ_OP_WRITE_ZEROES)) > - return q->limits.max_write_zeroes_sectors; > + return blk_queue_get_max_write_zeroes_sectors(q, op_flags); > > return q->limits.max_sectors; > } > >