From patchwork Sat Oct 13 00:06:24 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: 10639467 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 66F791508 for ; Sat, 13 Oct 2018 00:06:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5344D2B78F for ; Sat, 13 Oct 2018 00:06:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 479A02B7A0; Sat, 13 Oct 2018 00:06:33 +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 D9F4D2B79F for ; Sat, 13 Oct 2018 00:06:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 98D236B026D; Fri, 12 Oct 2018 20:06:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 93A496B026E; Fri, 12 Oct 2018 20:06:31 -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 852356B026F; Fri, 12 Oct 2018 20:06:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by kanga.kvack.org (Postfix) with ESMTP id 57E8C6B026D for ; Fri, 12 Oct 2018 20:06:31 -0400 (EDT) Received: by mail-qk1-f199.google.com with SMTP id f81-v6so13542046qkb.14 for ; Fri, 12 Oct 2018 17:06:31 -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=tBsOiKs5Tphii3LWAmGXkEUO5FMwTmp8KPFNnf+7h0M=; b=kqaojsOGyK4aWLI1iLBcmVYtULWNRpnQeVO5ehx8g8cJqNp5xKOENvbYWm3Ji7Gk+7 P3UyQnj/B7Ue0kklHU71v1cqE/LC1YRhKSfg+ASeZaFI1PaTxHEEsndlswm7fqrA2zlC emlCBhmYnqf1jGNx9GzEFZixQ+NE7Mm1S0sxk/8e4ihtu/1VM4Yj5uMIsfdtNWYo97jx rvlLL2oQsdDe4jfWifTOW4/hvV5EhkxgiArqSN+fIg4iEiggt4tqbJfKJGst/1BpkrwR BDncW66xqsv4cOPZG3WIKLTMDFbOdb7gY6hNa/dbvNAbnjjvVTaDm3+rZ68zKFGiBjn+ d6YQ== X-Gm-Message-State: ABuFfoiybc2d99qy75s2lYMnjG2mx3l9Z5phDqkiG8YJpk0n9nTWcbhE ABEB/XZWX1c55aHFUSuq8jvBnNl2f/YhR8MulaHeFEWX9q3tt9VQH/4xN1IsoU0mIfWOWgq0rxU NYtNVMKKMYBvRtz3qQOwmtK0VQgEuU+v95tdDFj/pfyrhobo2cDriKvnTwrX4MxnNbg== X-Received: by 2002:a37:3947:: with SMTP id g68-v6mr7247512qka.289.1539389191072; Fri, 12 Oct 2018 17:06:31 -0700 (PDT) X-Google-Smtp-Source: ACcGV62hr0fZCZcdZGY5kOdRYUjvGyZS1QxnYl9KT15Zvlr92/KVwBJFGXFFtOoUlUwVu7MQfRLN X-Received: by 2002:a37:3947:: with SMTP id g68-v6mr7247493qka.289.1539389190660; Fri, 12 Oct 2018 17:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539389190; cv=none; d=google.com; s=arc-20160816; b=i4h07jmn81tiQsMSIirPqMWcsPxOqvU7u9n3VJieFVikFDfUyQIwqv/L9TnLAzZAQY /704WpPvAbUyw+n6mguF/IaPR5R9F9jWEm0HF5H/ZZc19U6w0sNqctf7KSC1bMGX4E7y NkjdkM3dM9N9B0Hp9waRtTXo0poj6ogc8EIYQ8G8UQNlHSdELG8RhTYeR9YWmJQcFwna 68xPj4cR/75eFmzTwW+2Q/11M9NBsNwewpoWYUHUlcxR3ZOEBSXjKUty86RfWmT1y3H5 9D3CEgyWQGJRe5e8C7hn8KLuuvtDFPxhIRUF/NJwTfRDpKdBIccfxVA8W9Y6+rQCE82k AJWQ== 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=tBsOiKs5Tphii3LWAmGXkEUO5FMwTmp8KPFNnf+7h0M=; b=QuKI3R1cNiId19ZiQ06quefFOzi91Tpb47Mt84BKbTcotkQEZjrWKjrgqxKHQvz6FW cWmmDNPe7pKhCQ/jUPB9iTNKQKMEXbGl6i19ELAany8BMo05SfzlWxaAoo9aaoS/17jC pj6LoiTt6vCGD/B0WrLH7BqzaseinUKMCcfPmhweySDr6LeVtKm53D009ee9cuXIg5Jy ZogEq+Tv8A6kpCb/+/qawQw9FzkA/0ZXj3OqNT34WeXsm6KUIAUZ7XWJejDlOg6bGgjy jY6Ak+IvwAHFWZ5xhvyC8SgT4V+b1ae+enzBsP1fPsYNi7eTUSrHRvP2BYvk+9jeDbFH H6Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=4w6RlY2y; 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 v12si2507490qve.43.2018.10.12.17.06.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 17:06:30 -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=4w6RlY2y; 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 w9D04Hmc104817; Sat, 13 Oct 2018 00:06:28 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=tBsOiKs5Tphii3LWAmGXkEUO5FMwTmp8KPFNnf+7h0M=; b=4w6RlY2ySxTaUwhaglkZLfH+0LwgfU/00dt3FTLBTdt733YOye26GqEEUEB+1r06lFOi tnYR27ACqyp0dUtEn0wySOmQQDre6ce0zeRnt9w71RWbs1YCRQg/XA8n5u200+Z9ofBA sMvA/KreJmfecL8io0OHt95XAEzYYClreEcNzC1bXClJn91ItIlvS9ny9wK61dS8X1FB WsIEB/oabVrT8TGe3GMEnb6tvb1LE9MepPeF2lCTHF+uvmTpHng2NBAMjITT+D6YvGLy PWfsAAFWipvmlLRxKzSE11hE1uovw+LBfjDzPWWEIJlQ1c2BYEG1HfCd6NhNVJz2X3Db xA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2mxnprnfgn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 13 Oct 2018 00:06:28 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9D06RBk017631 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 13 Oct 2018 00:06:27 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9D06QL2030265; Sat, 13 Oct 2018 00:06:26 GMT Received: from localhost (/10.159.251.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 13 Oct 2018 00:06:25 +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: Fri, 12 Oct 2018 17:06:24 -0700 Message-ID: <153938918436.8361.13374851564644374971.stgit@magnolia> In-Reply-To: <153938912912.8361.13446310416406388958.stgit@magnolia> References: <153938912912.8361.13446310416406388958.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9044 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-1810130000 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 067ff5698e0b..2d84d18dc095 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1991,6 +1991,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: