From patchwork Wed Aug 30 19:17:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaohua Li X-Patchwork-Id: 9930679 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B20C46032A for ; Wed, 30 Aug 2017 19:17:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A272028765 for ; Wed, 30 Aug 2017 19:17:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 977612877B; Wed, 30 Aug 2017 19:17:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 451BE28765 for ; Wed, 30 Aug 2017 19:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750995AbdH3TRY (ORCPT ); Wed, 30 Aug 2017 15:17:24 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:58297 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750972AbdH3TRW (ORCPT ); Wed, 30 Aug 2017 15:17:22 -0400 Received: from pps.filterd (m0109332.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v7UJDi19018127 for ; Wed, 30 Aug 2017 12:17:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=ecz4l164/mihsfzVBXzXpetJMbMXiXXprBtd20LDsps=; b=bMftfrQBREEevdkv6P4fnJCSK0GWm619fbnJcftiedt7Nb+zwp6c7MROKoeyUZzjlttU +ePe98nG9nTYfJ3AOMCFia4IAIR23m0gLvloKrdq1d9NCf3GzgQrQJ0edPcrvyK//4My rkDGmJS5y/QF1/C6Wzz3WykosOBhsnn9Jwg= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2cp0harrup-3 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 30 Aug 2017 12:17:21 -0700 Received: from mx-out.facebook.com (192.168.52.123) by PRN-CHUB10.TheFacebook.com (192.168.16.20) with Microsoft SMTP Server id 14.3.319.2; Wed, 30 Aug 2017 12:17:19 -0700 X-ThriftRelayHost: devbig638.prn2.facebook.com Received: by devbig638.prn2.facebook.com (Postfix, from userid 11222) id 5D13A42408F3; Wed, 30 Aug 2017 12:17:19 -0700 (PDT) Smtp-Origin-Hostprefix: devbig From: Shaohua Li Smtp-Origin-Hostname: devbig638.prn2.facebook.com To: CC: , Smtp-Origin-Cluster: prn2c22 Subject: [PATCH 3/3] block/loop: suppress discard IO error message Date: Wed, 30 Aug 2017 12:17:18 -0700 Message-ID: <1a2fdfc9a698aaee556028b828afef3daa5a51e0.1504120418.git.shli@fb.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: References: X-FB-Internal: Safe MIME-Version: 1.0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-08-30_08:, , signatures=0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We don't know if fallocate really supports FALLOC_FL_PUNCH_HOLE till fallocate is called. If it doesn't support, loop will return -EOPNOTSUPP and we seee a lot of error message printed by blk_update_request. Failure for discard IO isn't a problem, so we just return 0 in loop which will suppress the IO error message Signed-off-by: Shaohua Li --- drivers/block/loop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index a30aa45..15f51e3 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -441,6 +441,9 @@ static int lo_discard(struct loop_device *lo, struct request *rq, loff_t pos) ret = file->f_op->fallocate(file, mode, pos, blk_rq_bytes(rq)); if (unlikely(ret && ret != -EINVAL && ret != -EOPNOTSUPP)) ret = -EIO; + + if (req_op(rq) == REQ_OP_DISCARD && ret == -EOPNOTSUPP) + ret = 0; out: return ret; }