Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp827887ybg; Tue, 28 Jul 2020 21:36:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJPWbxqdH3RM78AkGLmtRJMHjO9PGxLJCdho+1PJxLhusttmo+8CliLEcnh3UXlvcuZjve X-Received: by 2002:aa7:d155:: with SMTP id r21mr26805815edo.87.1595997387908; Tue, 28 Jul 2020 21:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595997387; cv=none; d=google.com; s=arc-20160816; b=Sggjlc6T8sIEiUjEmLnpUNMAFLU4lr1Sc5cZpvgiiMN2XlZd3K5qn28PBmb6F8Pk9o KknEq/5BwMAIAjD1+HvVrCZMydd58VgigYd8qCzCCR5xc38xIpa+L2DvDUPJ0SEbdSag NbKPQ8KQkZOcX/YLrMi5Ja9lNhEaxcn0w2yvYmC1hNgUlL/U6EUfuU53AiaqBNZwWfci EBgAurRYxdvCxeJQXo4eT6CznTfL5SXpr5pAik4dLb6571JXEVx6jrXFXbdUk5saQoyh BWjlc9e8ul5dy7l3VKMUmXmqkcObbqh/foP6lSZOaSL078Nx+KMA8I72jGjGIoiyQcsS kcsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:in-reply-to:date:references :message-id:organization:from:subject:cc:to:dkim-signature; bh=h53xFNPOnAu2za+HlgzOC+33Caul8s3PIGMAjL9zqYc=; b=U7J1gmG7BCxxNNh881iSFpLJ6WqagwuDCp7XHW2/Cj1+QdZBfQOf1V0JB0HRDQXaHL WVrg5y6+CVKXc7fHZmRAWbQ5hibE2K5UAm9L9aIhHDHC+OU/gnfcClrLI1+fGPWllbUn psii5JJLRvVlCQwvL37Qqj/zmQYRng5igIiQtSdR/7l6KnHDNZ4dHgBKUjDWuP6HrBys NLxiyVtzM6wZHCP1q+ewZQwi31fliknhNNOxObbCljo+ZOVdjdO8pC9HbHN2MWA6NEkM XCjktmXKlAK1BpQ9TIGFusAUOsxjnPamrUz5F3/ctUpqx+n129zELHT3xXNLtowv+f+Y z3/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=MUANNLB3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id d19si347716ejj.468.2020.07.28.21.35.37; Tue, 28 Jul 2020 21:36:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=MUANNLB3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726709AbgG2EeJ (ORCPT + 99 others); Wed, 29 Jul 2020 00:34:09 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:56020 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726220AbgG2EeI (ORCPT ); Wed, 29 Jul 2020 00:34:08 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06T4X5NE120312; Wed, 29 Jul 2020 04:33:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : subject : from : message-id : references : date : in-reply-to : mime-version : content-type; s=corp-2020-01-29; bh=h53xFNPOnAu2za+HlgzOC+33Caul8s3PIGMAjL9zqYc=; b=MUANNLB3paLQES1ITCwvWFQWzJZAFz7rsJkF3D6lhZO3wRENywTiG0r+5okWKkGJ2N2M DaGTv20AHMYg355l9ym2tW1wVzEVZfTRSL7rjD5IUZkPYC+JW5RHvEwNR6deIoJMP3fE vm85fX/uL2WSTVv4X7PydVVBu8Ij9SyFYxJzsk/Qrysb8Kw0RNxxwExX7tquU7glJRud mp56sD5XgSnc/DW+CDlCnIO0jaY7bONl+rx5yQx/tL6inf/00RKjw65HiJjYXxY21VPd VcHpdd/DrGG4sD2M3hwfszIYUQymWQs2xeIiKfHeKOQGZZsJ/pBsWvVANuIeFNVm/GlP 7Q== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 32hu1jb81y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 29 Jul 2020 04:33:22 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06T4XMJD078386; Wed, 29 Jul 2020 04:33:22 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 32hu5u1w9x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Jul 2020 04:33:11 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 06T4X32F028038; Wed, 29 Jul 2020 04:33:03 GMT Received: from ca-mkp.ca.oracle.com (/10.159.214.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 28 Jul 2020 21:33:03 -0700 To: Maxim Levitsky Cc: "Martin K. Petersen" , Christoph Hellwig , linux-kernel@vger.kernel.org, Keith Busch , Josef Bacik , "open list:BLOCK LAYER" , Sagi Grimberg , Jens Axboe , "open list:NVM EXPRESS DRIVER" , "open list:SCSI CDROM DRIVER" , Tejun Heo , Bart Van Assche , Damien Le Moal , Jason Wang , Maxim Levitsky , Stefan Hajnoczi , Colin Ian King , "Michael S. Tsirkin" , Paolo Bonzini , Ulf Hansson , Ajay Joshi , Ming Lei , "open list:SONY MEMORYSTICK SUBSYSTEM" , Satya Tangirala , "open list:NETWORK BLOCK DEVICE (NBD)" , Hou Tao , Jens Axboe , "open list:VIRTIO CORE AND NET DRIVERS" , "James E.J. Bottomley" , Alex Dubov Subject: Re: [PATCH 02/10] block: virtio-blk: check logical block size From: "Martin K. Petersen" Organization: Oracle Corporation Message-ID: References: <20200721105239.8270-1-mlevitsk@redhat.com> <20200721105239.8270-3-mlevitsk@redhat.com> <20200721151437.GB10620@lst.de> Date: Wed, 29 Jul 2020 00:32:55 -0400 In-Reply-To: (Maxim Levitsky's message of "Wed, 22 Jul 2020 12:11:17 +0300") MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9696 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=1 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007290031 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9696 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 clxscore=1015 malwarescore=0 spamscore=0 suspectscore=1 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007290031 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Maxim, > Instead of this adding blk_is_valid_logical_block_size allowed me to > trivially convert most of the uses. > > For RFC I converted only some drivers that I am more familiar with > and/or can test but I can remove the driver's own checks in most other > drivers with low chance of introducing a bug, even if I can't test the > driver. > > What do you think? > > I can also both make blk_queue_logical_block_size return an error > value, and have blk_is_valid_logical_block_size and use either of > these checks, depending on the driver with eventual goal of > un-exporting blk_is_valid_logical_block_size. My concern is that blk_is_valid_logical_block_size() deviates from the regular block layer convention where the function to set a given queue limit will either adjust the passed value or print a warning. I guess I won't entirely object to having the actual check in a helper function that drivers with a peculiar initialization pattern can use. And then make blk_queue_logical_block_size() call that helper as well to validate the lbs. But I do think that blk_queue_logical_block_size() should be the preferred interface and that, where possible, drivers should be updated to check the return value of that. -- Martin K. Petersen Oracle Linux Engineering