From patchwork Wed Oct 10 00:13:50 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: 10633617 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 76AEE16B1 for ; Wed, 10 Oct 2018 00:13:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64DB1284C9 for ; Wed, 10 Oct 2018 00:13:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5936A28F95; Wed, 10 Oct 2018 00:13:57 +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 D5964284C9 for ; Wed, 10 Oct 2018 00:13:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A438C6B0281; Tue, 9 Oct 2018 20:13:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9F3C36B0282; Tue, 9 Oct 2018 20:13:55 -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 894866B0283; Tue, 9 Oct 2018 20:13:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id 4325C6B0281 for ; Tue, 9 Oct 2018 20:13:55 -0400 (EDT) Received: by mail-pf1-f200.google.com with SMTP id r67-v6so3210187pfd.21 for ; Tue, 09 Oct 2018 17:13:55 -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=Zy8BSFKM2bFSbax5Kg0akKWQ9LnNLVMQpUtsJ7wkExk=; b=lKZCAipT5TUSv8uCxzEycSZGeH50vwgJU3v0yE6r17cJOY4/kAifBuEdbBtgpKDCPT hug2T8xJ8deMkmAuFj5ifcUxq+Z0gxmQohJJd9YqyMcDocmoZWXdAcFtp+U8Rnagyc4v vJ1Jfn1JM4alxF+yQwDiD/2c/vTEIa6MxVSyfNEYoS0X+2G3F5phfkmU1yULD4pLuTCu P+taUHM/y01d4Rnu37PREb5pKDOB455KLzn4VMq6bKg2tMm/qw4VggsRsm9R16CiZSdW 6DxKxsmao822K+gEMrQO3v88Taq8Dx3xTL6bFb2PCaSX33cdOImkgGTEMq18H0WvEieS hLAg== X-Gm-Message-State: ABuFfoibnCkMOIYAHEkjKxS/RMf7eALw84jmL5zeNmeJe54Ww58BebCy lNLLwjYntQpch5GS/zf61kMMIODkDNtnrVLHe7QJiR7itt2WxkunzUFxzeyfDVDMrNBa1MwxTGt ulSIrWsDwxn3Vyt+Yp2z4gC4q5keXsZwbsTivnC++F1bi41WDSA6M6a+AWC12hI/F0w== X-Received: by 2002:aa7:814f:: with SMTP id d15-v6mr32570525pfn.78.1539130434949; Tue, 09 Oct 2018 17:13:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV60qVkXOR/pF34PPBJVpOHRdPJrTiNhGpk1tz1ZlzSI/K91BcF1Qu7NJMvcV5oTxWhJX8ANn X-Received: by 2002:aa7:814f:: with SMTP id d15-v6mr32570459pfn.78.1539130434133; Tue, 09 Oct 2018 17:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539130434; cv=none; d=google.com; s=arc-20160816; b=rAccQPxLavSTUgxDk+pcO5gHycNaWCwi8nKCD2Zgqnx7cs8NrH0fnCPWmhd9Btjnpl x9a8YtjWx6mYzSnfJifjNucPCIrKysnA/fu07xpyYNoc5OMSlH0JBcVsc0N4QcPd61/y IHpn4O8zbDHOqGCjcjem1NxECUVSXPufflNmgGEg01BQa4xLVtPjFkc4Pke8h/mfFSdi zqYGtCeYRPPUdsWHmT8LCRJfk4Vg4v5VSGSgcJzW5rb6Nt21wcA72ee/i0BZ8tKcmrdM jVbANyDTRVyV4YS3H9K98u8s3N2Aq+A3zywjlQM4/ClSnxJPEotaXYlT3N9nWgFo8OTK hBVw== 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=Zy8BSFKM2bFSbax5Kg0akKWQ9LnNLVMQpUtsJ7wkExk=; b=eoZWKvAyHb6VQDCO8J01maQxkRPbF7CLScMUgXA8pAut5epnO2ZHjTDKNSjFPHePJ5 iDB7Co0LrCXoMjWWqsCILpoimo9ou3NQsjXj3nHYTQ8WfbdpkvuQuag8Slg9yDnDTDgt LZ8YGgwRzjvWX61kDPyuWXoDcSUwIbVRTzcrVz8ct1Zva31w3j78OOGy5urWKFHWMJ6P TTZZZEZnE/S/6EwXPzsCGQQbM3twMo4mS0WouOag+lfv5qiibWyQDw95AakUTvn1Vrlz Gn7xqRloA2znv8EEBkt8tsYSiRzDdyq0SogELnUdtB8+Advw0fGMX/DXFSL0ZYRSMnWn POvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=UmE8KBk2; 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 r68-v6si24609917pfk.151.2018.10.09.17.13.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 17:13:54 -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=UmE8KBk2; 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 w9A0DhqS123156; Wed, 10 Oct 2018 00:13:53 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=Zy8BSFKM2bFSbax5Kg0akKWQ9LnNLVMQpUtsJ7wkExk=; b=UmE8KBk2gPAUmdnUxRBfFjgtMB2acZrPVwvN+5lluOkBtAPiva1ro+tkKKQhL7O/6MFR jRQrFxD90D0V8B9ctEm5pabgZtjOo6gPk3Fq0Ypve5Bs3aINcS4LsGecBy85A1Rcn9Ii MAPsXpl97yCyb77Jpp8NcJB5qRD4moCoccboyDdqmBVvAcWjXWWHn0e/NCrwD8oonnTq dn+DKIEFZ7MXVZJrtUrfBSibt+ONDDR3d5nOkV3p97za+DF9heRx6HgONJMIkcgLq3AY MKZKq5fdfGClwY4W0gzf1lBA1gndBYgEwc/9D7MspQvLLY5TYVvjlaBWCBGJnZvqXUXF Qw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2mxmftrvqf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Oct 2018 00:13:53 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9A0DqXb029932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Oct 2018 00:13:52 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9A0DqEA017741; Wed, 10 Oct 2018 00:13:52 GMT Received: from localhost (/10.159.249.114) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 10 Oct 2018 00:13:52 +0000 Subject: [PATCH 16/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, 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: Tue, 09 Oct 2018 17:13:50 -0700 Message-ID: <153913043056.32295.889586450104360207.stgit@magnolia> In-Reply-To: <153913023835.32295.13962696655740190941.stgit@magnolia> References: <153913023835.32295.13962696655740190941.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9041 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=470 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810100001 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 --- 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 8b22035af4d7..8b804e86ed4d 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 cf81d1f68b69..479eb810c8e6 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1983,10 +1983,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_IDENTICAL_DATA)); + ret = mnt_want_write_file(dst_file); if (ret) return ret; @@ -2017,7 +2019,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_IDENTICAL_DATA); + dst_pos, len, remap_flags | RFR_IDENTICAL_DATA); out_drop_write: mnt_drop_write_file(dst_file); @@ -2085,7 +2087,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 21f947b20f37..5c1bf1c35bc6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1849,7 +1849,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 {