Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6928163ybx; Mon, 11 Nov 2019 17:33:59 -0800 (PST) X-Google-Smtp-Source: APXvYqxafr5Ck7hZ0LASjjd9tHpnpyBV2Tx9jLBZw5Jfoh1faNo56fq5yLwQbavVCYNFaCkq7a13 X-Received: by 2002:a50:b6cb:: with SMTP id f11mr29824626ede.299.1573522439390; Mon, 11 Nov 2019 17:33:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573522439; cv=none; d=google.com; s=arc-20160816; b=urdWwlW7d1xcKdK91Kttjaaw1TJ9k6RdwcUprLo41Rdr/uxTmQBFTarnoqyRbMnsQI 856TBHeXdFwFnT5EXkFBvw+oJQa0+qHJoC7p8tdSbmoaBOpf2KX24gKkrDjhRBfE8bFK /QcCJc893bvDRNChCUeTbTiTDz9lYP+FRBWfmcPV7RwCu92/yygw2y46jNSQNOJIL1Qu vrgol2ERefGElwNCkmm8n30SRmN3/v2bKrs9QVKiig+lixZHzWI0qoIDjBSLy5/mFIl+ snayMWWLvRjdzp5D8Ogo9klJedpH3itNzwZXywTA7i28C7V4ci5Dbh6oj8YdxO3WVVNv W1ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fTgWHJSuJxj4enhVwv1L7tLVXaaO+logj3ywjSrwRZE=; b=SisBj93DhQ1oY1zyshj3HrWZCBM5V7Pz4zC+zoxOXrzQtafdInlTx5skXMq2Pg6FoE ZPPQPvgq5gP0+sm/D6g6e2p5FmYmMbMZHWnZxzoBnszDaGG/7jQpcAkuoycIloPAS1Om 5LP0CYMX5WbjF5xxGguInon/DLA0mF8YJFNhn/7MO+TkjbIz/QIsOns5eKMU1HxFWH+f naZLZk0gluFc4aVcxX0tn7DDs5B6yOSThp9iOtViyRpyNInI2VpLt6e0vXeEMO58/7CS MVQqlp7ToEPsZwSHXLbZj/Eg4vFebxggFO1imrbCOsUEJQ54osUE53ruKk6hCLMDpzVh Jq4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=YI4bOiO6; 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 z5si10131062ejm.51.2019.11.11.17.33.35; Mon, 11 Nov 2019 17:33:59 -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=YI4bOiO6; 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 S1726978AbfKLBc7 (ORCPT + 99 others); Mon, 11 Nov 2019 20:32:59 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:56108 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726932AbfKLBc7 (ORCPT ); Mon, 11 Nov 2019 20:32:59 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xAC1JjIO173779; Tue, 12 Nov 2019 01:32:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2019-08-05; bh=fTgWHJSuJxj4enhVwv1L7tLVXaaO+logj3ywjSrwRZE=; b=YI4bOiO6wN/W0dLV/r2UFrXiihHcnxfijh6AQ2sY61eElle1gLkkMpqnaP3h6C7sNgbb 39Gci5pqtewehUM0KDV9nq4wIBMOk8Zoua1fugmIGuCyJOJoobPfrZ9kcPrxlZPeiXES bpBwdTRIvf71hNpV3bMXvkqxUI/oAWh41IgVnCxRhpH98s6V5NTS6yM5ToO4Ue42FTSf ekwx1++VNGQtObYn0UA4n/x0ZT0VSLZ7F5KE4CCMU8D1f8BrRqyHPH4utO1mOzcIxNVd noeE538ZGGK39SvlaeNu1gQLJ1G5bZ93VB9iRJFhbSYfYfVXsugwGvjv9ijc7kMHmosN Lg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2w5p3qhhqg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Nov 2019 01:32:52 +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 xAC1IKOp113548; Tue, 12 Nov 2019 01:32:52 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2w66wmya5r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Nov 2019 01:32:52 +0000 Received: from abhmp0022.oracle.com (abhmp0022.oracle.com [141.146.116.28]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id xAC1WoSg007351; Tue, 12 Nov 2019 01:32:51 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 12 Nov 2019 01:32:50 +0000 Date: Mon, 11 Nov 2019 17:32:49 -0800 From: "Darrick J. Wong" To: Evan Green Cc: Jens Axboe , Martin K Petersen , Gwendal Grignou , Ming Lei , Alexis Savery , Douglas Anderson , Bart Van Assche , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 0/2] loop: Better discard for block devices Message-ID: <20191112013249.GD6235@magnolia> References: <20191111185030.215451-1-evgreen@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191111185030.215451-1-evgreen@chromium.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9438 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-1910280000 definitions=main-1911120009 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9438 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=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911120009 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 11, 2019 at 10:50:28AM -0800, Evan Green wrote: > This series addresses some errors seen when using the loop > device directly backed by a block device. The first change plumbs > out the correct error message, and the second change prevents the > error from occurring in many cases. > > The errors look like this: > [ 90.880875] print_req_error: I/O error, dev loop5, sector 0 > > The errors occur when trying to do a discard or write zeroes operation > on a loop device backed by a block device that does not support write zeroes. > Firstly, the error itself is incorrectly reported as I/O error, but is > actually EOPNOTSUPP. The first patch plumbs out EOPNOTSUPP to properly > report the error. > > The second patch prevents these errors from occurring by mirroring the > zeroing capabilities of the underlying block device into the loop device. > Before this change, discard was always reported as being supported, and > the loop device simply turns around and does an fallocate operation on the > backing device. After this change, backing block devices that do support > zeroing will continue to work as before, and continue to get all the > benefits of doing that. Backing devices that do not support zeroing will > fail earlier, avoiding hitting the loop device at all and ultimately > avoiding this error in the logs. > > I can also confirm that this fixes test block/003 in the blktests, when > running blktests on a loop device backed by a block device. > > Darrick, I see you've got a related change in linux-next. I'm not sure what > the status of that is, so I didn't base my latest spin on top of yours. AFAIK the patch you reference changes NOUNMAP requests to use FALLOC_FL_ZERO_RANGE and is queued for 5.5, which means patch #2 will clash with it. It sort of looks like patch #2 reimplements the patch that Jens already pulled for 5.5, so you probably want to rebase this series atop his for-next tree.... but you should really ask Jens. --D > Changes in v6: > - Updated tags > > Changes in v5: > - Don't mirror discard if lo_encrypt_key_size is non-zero (Gwendal) > > Changes in v4: > - Mirror blkdev's write_zeroes into loopdev's discard_sectors. > > Changes in v3: > - Updated tags > - Updated commit description > > Changes in v2: > - Unnested error if statement (Bart) > > Evan Green (2): > loop: Report EOPNOTSUPP properly > loop: Better discard support for block devices > > drivers/block/loop.c | 66 +++++++++++++++++++++++++++++--------------- > 1 file changed, 44 insertions(+), 22 deletions(-) > > -- > 2.21.0 >