From patchwork Wed Oct 17 22:46:05 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: 10646363 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 CAF37157A for ; Wed, 17 Oct 2018 22:46:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB102288C7 for ; Wed, 17 Oct 2018 22:46:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEE3F288E4; Wed, 17 Oct 2018 22:46:12 +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 3820E288C7 for ; Wed, 17 Oct 2018 22:46:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B8506B0283; Wed, 17 Oct 2018 18:46:11 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 266A16B0284; Wed, 17 Oct 2018 18:46:11 -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 107D46B0285; Wed, 17 Oct 2018 18:46:11 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by kanga.kvack.org (Postfix) with ESMTP id D04FC6B0283 for ; Wed, 17 Oct 2018 18:46:10 -0400 (EDT) Received: by mail-yb1-f198.google.com with SMTP id j71-v6so15896341ybg.1 for ; Wed, 17 Oct 2018 15:46:10 -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=HOn8xVwkR3JYwNdX4ZaYESKF2/1a5rj2a7MLye/55c0=; b=PtpVd0ELdinmf/CzWZOFmqrYwZTjt4cPiLKi9fybcWPV+3pfl2AQSPUErsaQinrN7i JOo1mnQ3RZV/D2ZIxRReEwxIliml5XQwOlPQc2pLeGkRKlf1PC4QUkEKaQzOlpn6ZAu5 4LVOJukh/gDQCaAeX6my2ySrxdGA1E+gn315abwLEFm0EsVgY/q0MS1MihaN+IKrnAzx fN/BWyT+Sq4RjyMlVCPxNAUelk1p+4OYKo487hmmcYCeuYjATW7rOw6HvZxnaPo8POS4 UKVuJ7dyeqUHTlz/jfChXMoWXmHFDs2ONflUaavj0/C/mFYPC1imTxbLr6oCg7E1Pirq P41g== X-Gm-Message-State: ABuFfoikJnSdA7c2ZCJLpDgbEu34NSZ7qp17p2ktIdvYRJHZbtXjr0z4 NLc5mi1JLOq5e52Ro7CBS23A2bzlkS77yOW/X8YzXBZgilRhCytEddZXanzi7Q86A/+1YccwlHd iPuazqEsi541lC1bfEUiMHmjotbnE29OU/ok04G5TJmgs4R4kmAzMrZaL5MGdqHp17w== X-Received: by 2002:a25:4148:: with SMTP id o69-v6mr15687944yba.492.1539816370610; Wed, 17 Oct 2018 15:46:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV62YWQWQpv2xbnBxZaAM00TJva3wcPgRyw7Adx60QanY+0QvHVWWROKPu6zijmzJ4HtfQrgE X-Received: by 2002:a25:4148:: with SMTP id o69-v6mr15687922yba.492.1539816370049; Wed, 17 Oct 2018 15:46:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539816370; cv=none; d=google.com; s=arc-20160816; b=pQkdBrnOs5EEz7/If11TD08oIrIodKk8RnRbF4CkuYb0KHYmXDhHPEENGDaD0R6uol 43ycDl/YH9JjDELPKq4JnonBjTa+fqkjN7Q25bz5PYeAqqS9hnmFXoginfAYK0306amw NKR675lZutGaE+fIpGI25ZiibTHDTwxzBKg8L6h6LR+yTd0jEU7MBMClgMUVe4JT6WJY zRbM2P3I/FaodxFAnqaYu9JtxpQ6FPI52y1lhh5tqlVUHxFkJrjGTRx3cjb1wbQnV5SL LG/FVIjfJ7ZWZnOd55W8+3DvXbc73LwHd2ADLIlf0u5W0XzNLdzn37QV8GYtFDnRXywX NNqQ== 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=HOn8xVwkR3JYwNdX4ZaYESKF2/1a5rj2a7MLye/55c0=; b=x6mnSMQ5xk8kc7q3DufJySo84dxO+ui1XhzVQA0b+OYzmt2tDb/PVBs2eSO3MFgeP4 CZj3d8+jZM9Bl0gLWMGdw6gWvOaWDvsmbLP5BIHoRA5of1XPA+bgOXzkP49WtKQzj7X+ NQWx21QY264D+8ng0qrjMKiXHXF1xpTuZyu5RyQL9631Me2Uysj2A8DX4vAgR/FCnRpN LFgbbGr465b3YQv/lJGXAK+Cvt4p6CgZLbhLCecTkLlHjVwWHK3MSHTZYWngpGeBPVY5 ge5PdDVUa32kq6SOcO7JyT6lFjTxjxyyxTlOdiIduZLYJbuuOHd2Kd/u2clVSRvLRzY1 RYvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=xkLlJwfa; 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 f62-v6si6772541ywd.388.2018.10.17.15.46.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 15:46:10 -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=xkLlJwfa; 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 w9HMhpju048476; Wed, 17 Oct 2018 22:46:07 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=HOn8xVwkR3JYwNdX4ZaYESKF2/1a5rj2a7MLye/55c0=; b=xkLlJwfaBBdV2InSDSQFzbV42FS6ndUXIM2QfrB9HS11MCxb2E7q8za1iI9JyLppgAx0 G0yl775T8asSQTeQXJ/O5Jo3GE4yYk/QDBiCk+6iyw0nMAFfaF9qdFKs3teORPalhYQw rk9uHEPpECSJOFQRyfdnNE/17ivVdzi9XzPpDM4kl02POlXuDLX3o1vobuwi866Pdzib cQkw9uDVAkY3osExOpopDGaRueXtRa4uRYMS8gXgSODPtrP8TH51A7QGvq9Zx+qXL3cM sZanjggJvjxA9PcE/oNDER72kufd1T+Cc9pC/mRdQHfiNmucwyy7jZpLu3tOFotkPpzZ 7A== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2n38nq9sx5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Oct 2018 22:46:07 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9HMk7KH005400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Oct 2018 22:46:07 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9HMk7Na015235; Wed, 17 Oct 2018 22:46:07 GMT Received: from localhost (/10.159.132.177) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 17 Oct 2018 15:46:06 -0700 Subject: [PATCH 15/29] vfs: plumb 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, 17 Oct 2018 15:46:05 -0700 Message-ID: <153981636536.5568.11691478301880924161.stgit@magnolia> In-Reply-To: <153981625504.5568.2708520119290577378.stgit@magnolia> References: <153981625504.5568.2708520119290577378.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9049 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=517 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810170188 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 0393815c8971..84dd957efa24 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 0d1ac1b9bc22..ea30666013b0 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -2010,10 +2010,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 & ~(REMAP_FILE_DEDUP)); + ret = mnt_want_write_file(dst_file); if (ret) return ret; @@ -2044,7 +2046,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, REMAP_FILE_DEDUP); + dst_pos, len, remap_flags | REMAP_FILE_DEDUP); out_drop_write: mnt_drop_write_file(dst_file); @@ -2112,7 +2114,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 bc78ad7e21b2..ea2c2f673ecb 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1854,7 +1854,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 {