From patchwork Sat Oct 13 00:07:30 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: 10639589 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 921FD1508 for ; Sat, 13 Oct 2018 00:07:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F69F2B78F for ; Sat, 13 Oct 2018 00:07:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 733452B79F; Sat, 13 Oct 2018 00:07:40 +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 B84372B78F for ; Sat, 13 Oct 2018 00:07:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 93D6F6B027A; Fri, 12 Oct 2018 20:07:38 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8C5716B027D; Fri, 12 Oct 2018 20:07:38 -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 7E7226B027A; Fri, 12 Oct 2018 20:07:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by kanga.kvack.org (Postfix) with ESMTP id 532836B027A for ; Fri, 12 Oct 2018 20:07:38 -0400 (EDT) Received: by mail-qk1-f198.google.com with SMTP id p128-v6so13499617qke.13 for ; Fri, 12 Oct 2018 17:07:38 -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=TN7HH2GCIHxCaoeyZbzZgqgssWZARYD3D8oz4GWwF4g=; b=t2m5KYTLFv7IXZKAIGIk04mkTLtuSIDCs/dNzk2OOKd2KUQ4k1ph0jNGrcdOzv1o5W s+54LB0iFWx+uxSlk7y981teZyyBJszZT5YfC1mUAlY1ff2RNfyxuFEy6uTS/rAIADkJ Z085vc5501nWkkc2obCk/gfbWDEKyK8fTTaCkQ+kwRAGI6VXH0EgABzsMibAVT+Kns88 Nt2x93O2lQk5sx4x2EmufsxxEMWWK7Xf7NmULiqgIKJ7tGrzwTEpIke7DWAnJw5YVkhL 4PTvR3s1ob9IKkHO+BXhW6uQ7sJKZx/DdmoVyR8PYYSQQjZkcihJFfyBB6WmghOxj0Jy lI1Q== X-Gm-Message-State: ABuFfogLL5Exi/0I9f4eROpC3n4VHzmo5PnmHKEXrj5NURAZtOlxIfAx yQhW5cnFGEJHmAku7BbuLT4MWXvqfPe8XbBicVlskCWPj1OAgWxVFaQJIFV19fh7MhQIHtPXcVD Th/W08+OvMbefwcFSTVIVhR/7AVNO7tR9rodY5YfsSBi85XAGw1h36CY7gjP8yepEbw== X-Received: by 2002:ae9:e507:: with SMTP id w7-v6mr7857462qkf.246.1539389258119; Fri, 12 Oct 2018 17:07:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV63I3nvMOjbDwAq4fqAi1lo8YEWzIeyWy+FToY8CwxXw8SUw41MBgdgATXJspQccQoT1vQXy X-Received: by 2002:ae9:e507:: with SMTP id w7-v6mr7857442qkf.246.1539389257559; Fri, 12 Oct 2018 17:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539389257; cv=none; d=google.com; s=arc-20160816; b=Mpl090lxVcCQieiM8Hqd1S2WLlBUVOHWciceRdTPbFYRw58fMbOokB6fEIjEXxJQ4h /D1vTe7YlszQRFJ5CpNZk1SqCv5wOytWKd5zcRkmon2ZQZg2a7NoYKau7vbIQwkBpVHe Uh+IRP00dE9jWOSetXuiCgKqU+KQ580beM4Ar0MmA8X06vd1Lu4qEgFejVXLQpkCgz9O xD4++j2ifmgmnbPCIqBjp1G4EuNSpfJUiLrhj6lcwp/4L63hzgiN12zZOR0WKzdzZJq5 aim04xwfjW+wcqnJhXShhF0xO1mXhGmIWpuAChfwq1Crr0rWykxuFHrgEAkWoI0BPdga LlbQ== 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=TN7HH2GCIHxCaoeyZbzZgqgssWZARYD3D8oz4GWwF4g=; b=Gsvr3/KYRBt1I8HoMzTAcr9F3BWdxkxq/2/AyxS8o9SIEKkf/Jab/H2rGbL8zkJ+9l R1xKaEVCqIcXbIqonOITZXYtw0oZpDS9n7Wh/goLqXrzVN6AT/zuw/o/zSb47d43onhJ fQ/VroHb01zXaAugE0ptYaChfvAq8tod6kk6Ul0MBP3YsBzCFb7qi3PwjGZLMBAD2wGw ksvC/BzHb14je23axlPyoHpb3ATvn3/mlt10yQoiuM/7EcVc71Njy7Bh/wC3RCDbBVgt FFAlArOMXfUOqjyl4xJsWz0eLTavz89eKbMQK7x7XRDycudmeOMb79JkV3QQ8H4+6hgY LPjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=nKTtE7Zc; 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 l11-v6si105273qtr.173.2018.10.12.17.07.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 17:07:37 -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=nKTtE7Zc; 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 w9D052ox163671; Sat, 13 Oct 2018 00:07:34 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=TN7HH2GCIHxCaoeyZbzZgqgssWZARYD3D8oz4GWwF4g=; b=nKTtE7ZcI+TH2aJMzxu1S8qnaQVm1r2qKOlfvwI7ot2t1+kMqtZZCeW4oFn5lWuDFleS /ktU1IE2qJbhu/eolBTYuqmyiJRtY9rSJ8Z8uvbk36BlG+9FV/wDPUMx+UKG1h8sKIqy +u8hbZtoP/iNIB2lRIz/xzs+XpX96BR3zY/BaDEgtMNsTqK8P993Wk/efsAD4qACT/Zm cIinCllnk0VBdl5btli4IErsx41pRUvL/zenC6mnRjtzFjoEjQIoaW++oiCFVMkbQKJc Yr2ClLNzt2yoSW/GjqksmncIJkbzt4eiuNH7pbxs77DD47Ogq9EwdQ8x6rugTcR6ISQb DQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2mxn0qnmg4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 13 Oct 2018 00:07:34 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9D07W00004001 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 13 Oct 2018 00:07:32 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9D07Wap018219; Sat, 13 Oct 2018 00:07:32 GMT Received: from localhost (/10.159.251.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 13 Oct 2018 00:07:32 +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: Fri, 12 Oct 2018 17:07:30 -0700 Message-ID: <153938925037.8361.16126790489559826169.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=525 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 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 30076ed38091..81e0f969da59 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1999,10 +1999,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; @@ -2033,7 +2035,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); @@ -2101,7 +2103,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 {