From patchwork Wed Oct 17 22:44:56 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: 10646213 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 CAEEC15E2 for ; Wed, 17 Oct 2018 22:45:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB820288C7 for ; Wed, 17 Oct 2018 22:45:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC9DC288E7; Wed, 17 Oct 2018 22:45:04 +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 5068A288C7 for ; Wed, 17 Oct 2018 22:45:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17FA26B0272; Wed, 17 Oct 2018 18:45:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0E2AD6B0273; Wed, 17 Oct 2018 18:45:03 -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 EC4D36B0274; Wed, 17 Oct 2018 18:45:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yb1-f197.google.com (mail-yb1-f197.google.com [209.85.219.197]) by kanga.kvack.org (Postfix) with ESMTP id BA9AC6B0273 for ; Wed, 17 Oct 2018 18:45:02 -0400 (EDT) Received: by mail-yb1-f197.google.com with SMTP id y40-v6so15942825ybi.2 for ; Wed, 17 Oct 2018 15:45:02 -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=DsB/GfHe8rY/6K9TRDqJFG41++LpUZSoAdzvXmeEYVk=; b=KdM3/fz1PvjVHA34XCNZor2wNp8vf8NxUQdBjs2vBT4Em/n5os81AJLDrmZWEVuhMc 9qeSulrcZhsAF7W2p2Jzdknh4h3GQWwReDoM2uSeMaO8+rv+41xS/RuqMP9Y32iMZZB1 1dvW7NOHUXMNspXgDwClG7DTxabPm9r4Yth4z/+EmE4/9O0sOMxMJ8BBZBHOL17CeIDQ MdPr6YFfJTmcCC6tdS28Ef8Tp2Bl23Q/c36B2bfIjLomC6Eu07Y7d30eAUw1YopudIbL sIeqCRQvbNIo6vSr+23OrnAyb0vuYQpqe715sY6220/zMf9d0oIzhYdKZYcUXsY+E561 gXBg== X-Gm-Message-State: ABuFfog/KyLXqesrvkSH2lGTfvq4ZB5VwctnwK1zXxHivPk6RxpxpNuy ZnD/0yjeiKyXYE7B7MIPPolo/igDQfzkl6a5g/o/yhxD7k52CpHebeEPuvc5iy7Ss6CwHifWQZF Mh2/lVfzLko9fhgZ+LHdbuq6gBQ9cRWWRXggbt3DIwgL00ztsit+car/TMPuA2cqFLA== X-Received: by 2002:a5b:7c2:: with SMTP id t2-v6mr1755977ybq.212.1539816302425; Wed, 17 Oct 2018 15:45:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV60Sr/rk7d5duzBybIK4CxRM0JnlK8VYIU0WbNIDnp2ih4V3lk5Q0PkeOha2cqwMTin1lU5Q X-Received: by 2002:a5b:7c2:: with SMTP id t2-v6mr1755954ybq.212.1539816301852; Wed, 17 Oct 2018 15:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539816301; cv=none; d=google.com; s=arc-20160816; b=cwgrjpsa5o0KHLjQXCPmbK2R7c0HXDxpCzh6jOst1WW9k1+Xc+qzHN+8IDBqwfZiWo J7VCVATkcCUh3/BiSHelYWM0YpoIu5g8LHeS9Tfz0q6NC6vF+7jILrVkKHVygrn3UMYg rdXlPCdixRLgxDPlsdPJcgy5biKeiMig74XXLPVzQs2EZglNMOp2KmY0XZkLlA0ukxOY FB16QB9unKwIIny61SS822qodaBHExeyWrIdudRPI5fcc7WtREJ8izxP5Gy2xccCpfDX RzILZiLfWOVnN9S1O3b9smuujo5owXQeqHsQzTBfEq4z7yBDVM6xFMgavcr4HaZ+7f6h ptYQ== 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=DsB/GfHe8rY/6K9TRDqJFG41++LpUZSoAdzvXmeEYVk=; b=f39+QAJi32v5nJKIHEy0BjdLT/wLeh0ohgqLo1PJKDMLUmkqRvfZl/1offG+jZS19L AXL1xW157Ghp3/Xft7mPn1oDaq6NoAffmMTA7KNl9MDaglcFduhn98HPadfBx+6O2xed Z2DxRLGH8rpxZG/z176esgMsdJEuv05/KwHoRgsdDI7bL3F6SCEF3bYjUw0j25Ptk3yK rNYoqyFO0aAC0+cEq3jznIQO9nUk5VypYHzrq/Os2/yG/ZxXoHbwVP7AI2rVaPFHsZQZ j60EFF9jpfze1A/sK14QpLg9wYiUOdq45A9zWL4aGLFRtXZAPwJQCHUyGctXt7pErvnS duJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=PpxfeYre; spf=pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from aserp2120.oracle.com (aserp2120.oracle.com. [141.146.126.78]) by mx.google.com with ESMTPS id t82-v6si6760204yba.96.2018.10.17.15.45.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 15:45:01 -0700 (PDT) Received-SPF: pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) client-ip=141.146.126.78; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=PpxfeYre; spf=pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 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 (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9HMiAUC048830; Wed, 17 Oct 2018 22:45:00 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=DsB/GfHe8rY/6K9TRDqJFG41++LpUZSoAdzvXmeEYVk=; b=PpxfeYreEHqJ6vcORlZ7iIwVkK/qS8IqoNykPQqre69vtU4Xd3mMLGx73BLRXmhUj9yE bl5c1Zx7soRvcZCcUcIQMnE2d+KFLETNzE4pOv08JEQpQf/oHVRBlnbCp5S7005rk94+ jZbVYPaCT581APqiBmea6ZvLOALtEaVAPCXC1qMMiQSSr3HdBswEoGShXjh9gfiiUcUo /GHq3rrjiXKeak9arZrBjWtjMwkMWw6lGuXzOJbUdGw4SuXR/V6cXduazKzmcFA1UllG gCb1qV5B6TddpFw8dHzbdWy4YDxiW04Wxk0+Eu46plkevvvy0jch+urulROVmNFrWl4U AA== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2n38nq9srq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Oct 2018 22:45:00 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9HMixj7006278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Oct 2018 22:44:59 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9HMiwrN028452; Wed, 17 Oct 2018 22:44:58 GMT Received: from localhost (/10.159.132.177) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 17 Oct 2018 15:44:58 -0700 Subject: [PATCH 06/29] 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, Amir Goldstein , 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: Wed, 17 Oct 2018 15:44:56 -0700 Message-ID: <153981629660.5568.10517610908803733732.stgit@magnolia> In-Reply-To: <153981625504.5568.2708520119290577378.stgit@magnolia> References: <153981625504.5568.2708520119290577378.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9049 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=754 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810170188 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 Reviewed-by: Amir Goldstein --- fs/read_write.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/read_write.c b/fs/read_write.c index 0f0a6efdd502..f5395d8da741 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -2009,6 +2009,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: