From patchwork Tue Oct 16 03:10:44 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: 10642763 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 2E20E3B73 for ; Tue, 16 Oct 2018 03:10:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BF8729867 for ; Tue, 16 Oct 2018 03:10:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FDDA298A8; Tue, 16 Oct 2018 03:10:52 +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 ACDD729867 for ; Tue, 16 Oct 2018 03:10:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F06F6B026C; Mon, 15 Oct 2018 23:10:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 79F616B026D; Mon, 15 Oct 2018 23:10:50 -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 6B4946B026E; Mon, 15 Oct 2018 23:10:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id 2E6626B026C for ; Mon, 15 Oct 2018 23:10:50 -0400 (EDT) Received: by mail-pg1-f197.google.com with SMTP id e24-v6so16118049pga.16 for ; Mon, 15 Oct 2018 20:10:50 -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=hMOe4fj5d+ure/XK2zqUBWtMESfs/bhYFtxovBeHkzVZ7rtmsBRsdW+rF/htkC+egX /Dj6GhU8Q9TDEP/1kdHGMKktC1IwWzNYjezMuBuT+ieR5QCNM+JEn77p4r7iLxoBx6cC fKIXxKJ4mYkGDByqI8W6/2e83+vInmAJ3xZDxSgmVBbCKUfuB6zfMJItXvM2IC4d/VsD qNIsVOiWImVQXRPy9Jq77JWNjj1k//MUYw2vO8xUU64drmnAhsYSw/DMbNO+sdgAejOI 69L1L6ZulolfE4UtSLMwlhLzc7EAi4WW4neubD4DSTrYUEqzH0QXYjnKDbMxUGUDFpGm ewaw== X-Gm-Message-State: ABuFfoixfPNYZSLOFvrMVjnuuLFGp71yJjhKv8HRUPQBfdEeTa9JSwRm uGhA3FUEo/Uw/aABe+ShYqj2LhKthS+XjA+Z85ssljXjoP5GVrKrtRfixIfgJfEbhHzFrc1ODDq UT73KbIX7cBoLoD6I/+0Y9BJ3ijnhEa6rvUeQmpPLqNGfI3iZNh3Q94hoe5EI1ZDMVA== X-Received: by 2002:a63:4e18:: with SMTP id c24-v6mr14041072pgb.6.1539659449864; Mon, 15 Oct 2018 20:10:49 -0700 (PDT) X-Google-Smtp-Source: ACcGV62sU0OWBWbaQXv9rofp29ByKpXNTg8X1JyzlvmjXPJdGeAaCGl1x6Rw0Oh9F2efU4X3pZSL X-Received: by 2002:a63:4e18:: with SMTP id c24-v6mr14041050pgb.6.1539659449317; Mon, 15 Oct 2018 20:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539659449; cv=none; d=google.com; s=arc-20160816; b=0bMC1Tbdq/TdPLEE6huW+roKZfQHZUy0mAxU+i9LA8gxhKt4UmqiXP4IXzwKsAvqrb 2WscdFGeygJ7Bh6SFGGkdnpVM5cBME1hw0m05uxtcswbppjXDqZi1C5uZH9SQ6Za/56O ZJqX7F1f+lc46863cJinaxlquBQs5d2tEdd3chheWKJAJrk49IrS+M076XjKsmBMjs1j q3WWjGJudXvqL3DzR+YGwcUsyn7sXsOuLN+J8arwzYsANUaleLw1CVRliYXoAps4wdhH A6Etwpkd+X0woPKhLvATSWgu0MlhY0U8dojAXcgJlYRc1a+0pwWKw5eiDyE59bNusBs1 Njlw== 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=myM18rMduQiuYGZkLlaCiJnr3lw6HLVPhU+lL+846WPIbF4IL83v6APTEpp+2rhjFY aeMUiYHOrxc/Q66S0dZxdjecFbfa0ll15YRl+jsXF1ozCFC/pcu7Ut4yKJWyGJZXgfCa 0dR8J6VAoqJxIdkv4qXiUORfI7fAidEce4ZIzZhns8FxTgWXpyZAXMLd1XMvljSVCJ8A ngCGrqZFbKCtlxRv3wcMmsbrtW/FDzAvRvPFiiiFbsZo60PrXW/Q3gtwoXcBy0Nxf3GR EgE1CqNjg0mWGErwo/7wdANmDBQL/+H6KOlP9TFMVXNEjzTxPFEEwvh6GcS0XHE1r2b5 HI6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=B3DtSJGk; 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 w24-v6si11843229plp.110.2018.10.15.20.10.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Oct 2018 20:10:49 -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=B3DtSJGk; 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 w9G38Tlk044633; Tue, 16 Oct 2018 03:10:47 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=B3DtSJGkuK54Rbl73cfmQCqzlcavzgWdUCNjlOGpYEDPTi+4hCIZETHNyZFqjXQ6aGqp CQISGI96pQqKbOHl2AJVFc7yiixXp+1TSLggIvHAUjYpYPRW6xGvGHbI0a4UwZDFW7Tt l2BrgiYjsaGBmolrqwMP8tWR6e5fKQRHH6mYSAROMMPvfINfl7/VysrmmTLGNgb9gXEH CQ0iNCI6NIba96ROQ0OkANqAVH8ep7zQpNw0Ckyc1Au76IkUed5QowwwIAGHtzbwsB4y W5TCYKt5F2Tg0coTbxI7TMSI+QFVVk4SqYH13bDe4li/86qj8Zq8NkWgKB6LGNHeVRnH ng== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2n384tx1kc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Oct 2018 03:10:47 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9G3Ak0x029351 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Oct 2018 03:10:46 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9G3AkSu002531; Tue, 16 Oct 2018 03:10:46 GMT Received: from localhost (/10.159.227.150) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 15 Oct 2018 20:10:46 -0700 Subject: [PATCH 07/26] 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: Mon, 15 Oct 2018 20:10:44 -0700 Message-ID: <153965944451.1256.13419242995682379278.stgit@magnolia> In-Reply-To: <153965939489.1256.7400115244528045860.stgit@magnolia> References: <153965939489.1256.7400115244528045860.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9047 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=750 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810160026 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: