From patchwork Thu Oct 11 04:13:06 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: 10635755 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 5E2A1933 for ; Thu, 11 Oct 2018 04:13:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43FC825223 for ; Thu, 11 Oct 2018 04:13:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3882C2787C; Thu, 11 Oct 2018 04:13:15 +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 BC68621BED for ; Thu, 11 Oct 2018 04:13:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DEAB66B0276; Thu, 11 Oct 2018 00:13:12 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D6FB06B0277; Thu, 11 Oct 2018 00:13:12 -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 C37EC6B0278; Thu, 11 Oct 2018 00:13:12 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id 861B06B0276 for ; Thu, 11 Oct 2018 00:13:12 -0400 (EDT) Received: by mail-pg1-f200.google.com with SMTP id e24-v6so5145699pga.16 for ; Wed, 10 Oct 2018 21:13:12 -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=mbCJTCJlHtGyJxCxGNwQiD9bwchYhi3Y610tPi4XMVI=; b=eE2didAlYtcjfny0yYOq8g/y61134418V/Pn8BpTzlVDd4Lt47GbHAM6OMIEFp23Zv pCyFu1aqDO1MVGW3SQUYJGNqoplup8jU3/94JxQuQLNi/EU4cmLbMKjgXzyWjSUwR53/ Bvvz6iyYiBhK/XicGeMhc49c5FtWatTPTnAggRM5FNC6tEcL0+UajjRSezTumWnc5S4l RpEmibfa85fSa+m6GzMRweVE9MdP9mlOq0KaCJ8g7U3RM3GJCXBNjmD42SGiN5uF5bOM V6cImk8KtXSd2QYqHfJF0ZeeOBAh5lcIt0Cf7U6aelTdj0No9hXA6+8A1WwJ/7j6FIN2 Kd/w== X-Gm-Message-State: ABuFfoi33/7jB5ND3m/dtj6R0XWCnP/XyZtUY4Dw4t1fDk44OdfzairA fGxsYZufa2ERtpyITmvuKvmpj0O7Weg6AuyQ64Ee4tDecJAxORyvsePx/9bUsYI/l1DIRydcfiY SgtM2aKj9S7QnGAL0sM0EsMad1UJcYDmrjM+YCJP8NKu6CvViOKjiTiSjVFKni1UVow== X-Received: by 2002:a62:4c3:: with SMTP id 186-v6mr37009539pfe.156.1539231192219; Wed, 10 Oct 2018 21:13:12 -0700 (PDT) X-Google-Smtp-Source: ACcGV61UNnJzASfJ0JyYyV5M7vomEl749FgREMyFbSVo5pqIWnx+4EMj+CEp9YXDQO+SACr+fzd0 X-Received: by 2002:a62:4c3:: with SMTP id 186-v6mr37009513pfe.156.1539231191574; Wed, 10 Oct 2018 21:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539231191; cv=none; d=google.com; s=arc-20160816; b=OP9QoqkU8MOrBBGU+/FMX4oRBKGacc/AGP+Titlmc3Ir+MvA+C21vp2eLNKLKGsmGQ oYJiRcnvoYCJZge37n6Jmjb/BeqkDOcJYmiszLzFoKr0Pg38kFkU2ux9gRTOeRD345IY nBFcwYSSedqurFJFagBe8IaBCw9Becf3uZeIYxWJh/prop+K36Pg+fJw5xOup+fUZC/I 5eOYoJGdAE0qCatBHPVssAfQxkIGZR4YAPwqp3VxphFxYLmnXR6cBnL6xViT1NBpke01 Kp8nF8QlXDNt29DlVOQaj95qaWtCjpZjaFgfsp9yStqvuCpDf41ANlPBeG2yPBZOziAC eUbA== 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=mbCJTCJlHtGyJxCxGNwQiD9bwchYhi3Y610tPi4XMVI=; b=rwuaORlMtr1rdvQY006Vk6buX5/qEnMb3ek0jvz9pZJ+6tOiBjJvrm5o+UPZfgM7uN VvqE6xj5JRghMm5YMtoGz7H6yAQX8QC+asNnktGGhyHCKKtYENwArZNZH64IdmOrqiQ9 biDWSo146ycFF9moxh31lqsgY/VYAnSUGrQ7Hu2Xx5TQB/IVTw5v3Noj4xYFkS3W9V0p 2f8ImiFClMfhdRv9xblIFISmZlLWC/uakI2jD5+bfJnIYT7rzIQT5p9v9CfSkKqQkGYY USdsxtQDfwjOyWFqP5cQUiyLWIxQTRZW7fvCTumNDUT2g+OyGLL1se1lAVYExUHdYaJq g66w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=teHEeHb8; spf=pass (google.com: domain of darrick.wong@oracle.com designates 156.151.31.85 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from userp2120.oracle.com (userp2120.oracle.com. [156.151.31.85]) by mx.google.com with ESMTPS id v12-v6si25691604pgn.547.2018.10.10.21.13.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 21:13:11 -0700 (PDT) Received-SPF: pass (google.com: domain of darrick.wong@oracle.com designates 156.151.31.85 as permitted sender) client-ip=156.151.31.85; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=teHEeHb8; spf=pass (google.com: domain of darrick.wong@oracle.com designates 156.151.31.85 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 (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9B49RmX191602; Thu, 11 Oct 2018 04:13:10 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=mbCJTCJlHtGyJxCxGNwQiD9bwchYhi3Y610tPi4XMVI=; b=teHEeHb8WJZPjuJ6X2yubSe9uTmR4HvMEk6QUTYBGBaIduMcO1/S1m4PfIrcV4RKk/Al +Ah53OS0lKm8b783yXgN7xgkioM9SXJ9ad2FhEk2YW1KxqmJ9ECJE9/FOzZhFVm+zqwD IfTXJHbHvTu9QqmlGOO/0Akf0BYwgqSQG2QxcDtqPIHy+/iyWZuDAVo3nmgzNo5Kpog2 L2Xn7U3DDrvA9fitcOuz5YLUAeDyZ9a9eB8l0Z77qtTCInwYqX3dmaLx7dzrI/uG0fuS 9Nl9Su80Dst4DTeDhARjo9y1JPxObpD3RvBsNnDDPcIX9B3noqayiPk+GKXsK7642B9f LQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2mxnpr98w9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Oct 2018 04:13:09 +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 w9B4D8ER018613 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Oct 2018 04:13:09 GMT 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 w9B4D8Nu011619; Thu, 11 Oct 2018 04:13:08 GMT Received: from localhost (/10.159.132.249) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 11 Oct 2018 04:13:08 +0000 Subject: [PATCH 06/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, 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, 10 Oct 2018 21:13:06 -0700 Message-ID: <153923118667.5546.2251008065628647198.stgit@magnolia> In-Reply-To: <153923113649.5546.9840926895953408273.stgit@magnolia> References: <153923113649.5546.9840926895953408273.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9042 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=749 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810110039 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 8498991e2f33..48d83231968f 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1996,6 +1996,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: