From patchwork Wed Oct 10 00:11:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10633495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 33BEB17E3 for ; Wed, 10 Oct 2018 00:11:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2127229BED for ; Wed, 10 Oct 2018 00:11:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F31529CA1; Wed, 10 Oct 2018 00:11:39 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADC4729BED for ; Wed, 10 Oct 2018 00:11:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A20DB6B026F; Tue, 9 Oct 2018 20:11:37 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9A70E6B0270; Tue, 9 Oct 2018 20:11:37 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 848F56B0271; Tue, 9 Oct 2018 20:11:37 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id 41F086B026F for ; Tue, 9 Oct 2018 20:11:37 -0400 (EDT) Received: by mail-pf1-f198.google.com with SMTP id i76-v6so3227242pfk.14 for ; Tue, 09 Oct 2018 17:11:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:subject:from:to:cc:date :message-id:in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=wh5HxGg/bRAL9efUSGh+2qdh0v0M5Mja7JnBFsFMIMQ=; b=oLvD5SDoKE6ZXIOCeS83vo4y0g+564YhOnB9ja2bZSoTCGPgHnxqbt2YlmiCz5l2Sm rCxRUpflqECRmh0emhnfOEdlAPaUyzuE8zAce0NgQNhV5Ww0/qB2M5EneuaW7X3bn+QZ mAyDpwujxjToHvu8/dzQgXTdzLhil1LkSkvPqFg2LMVC/fC5I3J8DB14134bMC1NooVu 89i4ET58bDtaY93L91l1cxP4vixFEtAX2d9lnl0v4I+vD/6oHrwdNzjTZqlq+OGPsAa6 nRIMc228AjQRabIIKHaeidLPq68pJ6TtyxhiS1AYj9/dQEaKmAfKaqeLPxq44P580Gaq tNdA== X-Gm-Message-State: ABuFfojIZhkt1HW0Fj0CLGBXtBe36uwldrPHItApSEurn5ckRzJhIiR+ /uXIuxWp38VOA+rLw4Sdnz/d1hoVoxMAYCVzRsHX59ldg3Olwn1gBp8MlBVHZvlqjDP6nEBj2qY VxLI8q/ygja4oBm36s34o2G0PlUGE22vwtZsEhidG6LvwDZKYiDW83+IRHVyKhwbNGA== X-Received: by 2002:aa7:880d:: with SMTP id c13-v6mr17913564pfo.251.1539130296949; Tue, 09 Oct 2018 17:11:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV61hZKLpvLPggaiFh8DpMFQlXjsbzQuAUPwuT8SS7BxCOwbkFQVLqL5xw5/v9RYAC2nkCVHb X-Received: by 2002:aa7:880d:: with SMTP id c13-v6mr17913515pfo.251.1539130296283; Tue, 09 Oct 2018 17:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539130296; cv=none; d=google.com; s=arc-20160816; b=MhwP+RGPRSgRjwVTtEyV7oZdQFOj0YkI4sXcriPomun4xJKC3cDn3VClN31av/Wo+j M2H8GFKUa4E1Bi6OkPiC1YVmGf0+FrWd655De0q4Y5p4r7HOujZZqxuloM2HHIKLb3pC t0V12o8Z5uKMAf4Hpmf3OL2y3e18xHoL03TF2jNLCedA3krwAS+ZWd8nhXuKaGBprRJz o82UM/ToRMrTvx3Qdbmc5SNmXYVF4iylmcQ3TFerA6JRZgHUm4LCiNdl4V3if9G49wXL 3aA7AXNiEsoDyov5yI2O4wifzmGVVE3KCRWWLq1SogmB9vxK+lFbqx5vzP8sjWdDoZVf z18g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject:dkim-signature; bh=wh5HxGg/bRAL9efUSGh+2qdh0v0M5Mja7JnBFsFMIMQ=; b=v04B1Cf5UswcJbXzQO2brn6M9y30/h5hzovSfRI5XJG/iyFvzYWP8xSEfqLo5FWTz3 KqtOFnpVeAiZJzPgs2WXWQ72kmUvNtKxoL2QVK9QBvyuorZhl9+TKF6gIBALmRU7U0Bk npXIi7zzvqZBKRyVpZYUgSHfiZYlzm+ie9ckiYKZ42c9Xf2nKtveXhB2pGT7OBQvvTJQ vhnoBCVwsLbOp155m1HYPMtbcSBNvqUpMT+8RC8zyYlsG/MOiy7C37GV8OjUuf9ZOK4O 8Dj5Nmky+T72KRRvbnB4S7QkDmp4PLt+vaGLpzSJ2OjNWqSL2QbhcWt9bxezXJj+mdF0 gX3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="tvvi/USr"; spf=pass (google.com: domain of darrick.wong@oracle.com designates 156.151.31.86 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from userp2130.oracle.com (userp2130.oracle.com. [156.151.31.86]) by mx.google.com with ESMTPS id x186-v6si24643467pfx.19.2018.10.09.17.11.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 17:11:36 -0700 (PDT) Received-SPF: pass (google.com: domain of darrick.wong@oracle.com designates 156.151.31.86 as permitted sender) client-ip=156.151.31.86; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="tvvi/USr"; spf=pass (google.com: domain of darrick.wong@oracle.com designates 156.151.31.86 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9A08pp2119795; Wed, 10 Oct 2018 00:11:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=wh5HxGg/bRAL9efUSGh+2qdh0v0M5Mja7JnBFsFMIMQ=; b=tvvi/USrB+UZhF1IqRPQW03XnX5YXlupLYSoDIJmEVbQW50dZu/gkDL9pBzj3hKmXzI3 NjnJ0sAQyVqELWbjSH5H48gNDd4qRyTHYnMqFwJ2H1fXwBltN5194xWACxT964HxDZUC /4B1SAp2SNTtyo1YpO0QoWSPeCLr/Xb8UFKa3faLJ8mV5Zkf8lVtCZudD8GoM0BYD2SZ 8a1d+L9LcR2WPFYnEKHli6oBxEQUxsBYxG9ABemqtIMD9lnqLuKLWbF63pc7HWyR9HDx YvDr3MqnNMsg6YLDQIr/qYCcmToZC/zj63xiD/lGBRuCFnjHA2JnBKy8T/NOHT3k1OER yQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2mxmftrvgh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Oct 2018 00:11:35 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9A0BYIO009889 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Oct 2018 00:11:34 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9A0BXDK003326; Wed, 10 Oct 2018 00:11:33 GMT Received: from localhost (/10.159.249.114) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 10 Oct 2018 00:11:33 +0000 Subject: [PATCH 07/25] vfs: skip zero-length dedupe requests From: "Darrick J. Wong" To: david@fromorbit.com, darrick.wong@oracle.com Cc: sandeen@redhat.com, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , ocfs2-devel@oss.oracle.com Date: Tue, 09 Oct 2018 17:11:27 -0700 Message-ID: <153913028716.32295.15849395030883190383.stgit@magnolia> In-Reply-To: <153913023835.32295.13962696655740190941.stgit@magnolia> References: <153913023835.32295.13962696655740190941.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9041 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=725 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810100000 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Don't bother calling the filesystem for a zero-length dedupe request; we can return zero and exit. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/read_write.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/read_write.c b/fs/read_write.c index f7b728d4972f..3ff90b3315fb 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1975,6 +1975,11 @@ int vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos, if (!dst_file->f_op->dedupe_file_range) goto out_drop_write; + if (len == 0) { + ret = 0; + goto out_drop_write; + } + ret = dst_file->f_op->dedupe_file_range(src_file, src_pos, dst_file, dst_pos, len); out_drop_write: