From patchwork Thu Oct 11 04:14:11 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: 10635899 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 EFB8A933 for ; Thu, 11 Oct 2018 04:14:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6BFE2856E for ; Thu, 11 Oct 2018 04:14:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB2502A651; Thu, 11 Oct 2018 04:14:21 +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 5462A2856E for ; Thu, 11 Oct 2018 04:14:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2255D6B0286; Thu, 11 Oct 2018 00:14:20 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1FB856B0287; Thu, 11 Oct 2018 00:14:20 -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 0ED4F6B0288; Thu, 11 Oct 2018 00:14:20 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by kanga.kvack.org (Postfix) with ESMTP id C11C76B0286 for ; Thu, 11 Oct 2018 00:14:19 -0400 (EDT) Received: by mail-pl1-f200.google.com with SMTP id f17-v6so5388508plr.1 for ; Wed, 10 Oct 2018 21:14:19 -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=OdIc8YLsa80Ux9kQHDzThidqDdLKImkUmlD2xgowl3w=; b=QpK10zRmHmfpW5i6iW1b3BvTown22zP2QRf7VNvK3Ud0WSUTWsrW8ctWj63L18fMJo YVwEN4QBtQVFEhocBjU1t0/q5cWjUBhpqCrTNlq4Nt5RenBFEvPKqmZB+1UcBWc+qCa1 IWAXZvy/5wNerqkE7tnX0hHBXvozUO80l/gOKcc5ECQZaD0Gc0jdV/KGTk70ZrjUCI1G Tpfi8u61ytSwj3xyY9jyRVw1oqGna9EGzYghlY7gou1zA+KTraqXS/AXxJ+4e7efVia8 uXIZZn61ZpwumY39YexuKE2UdL67AlXco5RALqMSw3JGyOyVqFsQuk1GZJcaaTB+JH0E UomA== X-Gm-Message-State: ABuFfog4grHceNFMUaL2RYoZaPkgs3o+EeuSjh/pvv4MzJ1qaLt4dBHv QCGf4JHT/fHilWzYwA/NCt6krATbawxjNWGIwItguPWW+LenieiKJnZtIwDkQkN2Rx3tLtgsLUm Un+trIP9l5qpVEZSBPjkfM8psDBo93tVAHX6+bNtAo5Vy4ZvDA4UCgsj3hgs9Ct2K9Q== X-Received: by 2002:a62:12c9:: with SMTP id 70-v6mr37777061pfs.140.1539231259475; Wed, 10 Oct 2018 21:14:19 -0700 (PDT) X-Google-Smtp-Source: ACcGV63dwnyzNTqIqkbpRYGBe6iDTwshVB6+tSA7DUZyNR7VTTKIqJAeu3PGEQwRaDCrJHwvLhIc X-Received: by 2002:a62:12c9:: with SMTP id 70-v6mr37777034pfs.140.1539231258700; Wed, 10 Oct 2018 21:14:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539231258; cv=none; d=google.com; s=arc-20160816; b=n90w4qfG5fUZr0gdrGotyFqdLCtVjLvY28GexeDCIhgCVm4HHHdqQ1WLbBvIh5toVs 6kC6WJSkbotfrClZRVu180Z08Wh/xBzbdGFfIoNi3gbYtTzun5kQUtOuaqX2HSPEqSgr BB52jsAcdANqtNBmCkcnqQ9zuUZIXP9w0PoRta8A1mSLSc7xWC6MhpgdPR581f4ZpzN9 AaUuSEJ13kTTxwX/dpxHt7ZCZliZUhrbYMQq2C0WAM0Nshrapaz0gVrIJnqvXJIStmr7 3bclu8TV31sVbPK9E0m8gNAhVYEhoOAOOZKhivUIrKAm8WO5KGjQ/M+KyWZO1cTgCFbX thLA== 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=OdIc8YLsa80Ux9kQHDzThidqDdLKImkUmlD2xgowl3w=; b=rLLxJfoV6J9WjKr7iG9gPsN79zPbBQd/XpN6uappHzql5cEtn+qSE0e6qVz464fJSW 1PGWaUVTSMT9fRBT6Gq/LaWRH/1CCpDQ6bMfGv7JfDeS0x7shlN4R6WB3My8ZCqR4Ylb h28Owswm7Pde7akg3dxQ5Ytt61+bXRKMIDNHU9cQzObc3SePOa4LwzvAKYYi2l8dTDuK xDAPm8CbY0Ln2ZlVR6r3jYj+MtKyx4o0twrnJ0+4LzroLmaU9Avo2qcxDavviDIdIw7N PMq/OhYMHTMXiiKMkyFPTYuVOoMG1Gmmpe8gP4tiOGRVvTTeBPeJzelteYMR7ViszNau 26wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="Aifj+4/I"; 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 q76-v6si26422338pfa.91.2018.10.10.21.14.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 21:14:18 -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="Aifj+4/I"; 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 w9B4E2VE002940; Thu, 11 Oct 2018 04:14:16 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=OdIc8YLsa80Ux9kQHDzThidqDdLKImkUmlD2xgowl3w=; b=Aifj+4/IfYPh0+MHesC1MXbBCLW1Bn2Ygjyn1PR9oG7TYXIBvcu0t4roXhXGQ4JkODUF FEh4eQSCLLjkuGI3L/VucmP2L9Y/Pw/wC1f1LrCwryCJcvK7fLQ09a/8spT7rg/cG0ip z36LqU5LTuZxfNzhHedCjSoHg7iFIENwmfyaRjEE90cwaqxdM4iPWHNPzJSVjBb61I1e 9OpjkfzNeYTdFEx75TAJN2AOGCYPRvJS6MdqdiP13gTtAE0+vONKYoZWsW58P+qWIk65 uHB+sM0AehRY84lh0l5mf/zHW3ErGPIJvJFNADX43N4ANvOJKOHAwcqCL80RjXj9wOJW Nw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2mxnpr9922-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Oct 2018 04:14:16 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9B4EFI0018439 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Oct 2018 04:14:15 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9B4EEAm030112; Thu, 11 Oct 2018 04:14:14 GMT Received: from localhost (/10.159.132.249) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 11 Oct 2018 04:14:13 +0000 Subject: [PATCH 15/25] vfs: plumb RFR_* remap flags through the vfs dedupe functions 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, ocfs2-devel@oss.oracle.com Date: Wed, 10 Oct 2018 21:14:11 -0700 Message-ID: <153923125177.5546.7735584725952507239.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=524 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810110040 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 Plumb a remap_flags argument through the vfs_dedupe_file_range_one functions so that dedupe can take advantage of it. Signed-off-by: Darrick J. Wong Reviewed-by: Amir Goldstein --- fs/overlayfs/file.c | 3 ++- fs/read_write.c | 9 ++++++--- include/linux/fs.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index e5cc17281d0b..8f7a162768f2 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -467,7 +467,8 @@ static loff_t ovl_copyfile(struct file *file_in, loff_t pos_in, case OVL_DEDUPE: ret = vfs_dedupe_file_range_one(real_in.file, pos_in, - real_out.file, pos_out, len); + real_out.file, pos_out, len, + flags); break; } revert_creds(old_cred); diff --git a/fs/read_write.c b/fs/read_write.c index b3f8b4a2bdfc..a360274b0cdc 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -2004,10 +2004,12 @@ EXPORT_SYMBOL(vfs_dedupe_file_range_compare); loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos, struct file *dst_file, loff_t dst_pos, - loff_t len) + loff_t len, unsigned int remap_flags) { loff_t ret; + WARN_ON_ONCE(remap_flags & ~(RFR_SAME_DATA)); + ret = mnt_want_write_file(dst_file); if (ret) return ret; @@ -2038,7 +2040,7 @@ loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos, } ret = dst_file->f_op->remap_file_range(src_file, src_pos, dst_file, - dst_pos, len, RFR_SAME_DATA); + dst_pos, len, remap_flags | RFR_SAME_DATA); out_drop_write: mnt_drop_write_file(dst_file); @@ -2106,7 +2108,8 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same) } deduped = vfs_dedupe_file_range_one(file, off, dst_file, - info->dest_offset, len); + info->dest_offset, len, + 0); if (deduped == -EBADE) info->status = FILE_DEDUPE_RANGE_DIFFERS; else if (deduped < 0) diff --git a/include/linux/fs.h b/include/linux/fs.h index 4acda4809027..d77b8d90d65e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1863,7 +1863,7 @@ extern int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same); extern loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos, struct file *dst_file, loff_t dst_pos, - loff_t len); + loff_t len, unsigned int remap_flags); struct super_operations {